|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #ifndef nsHtml5PendingNotification_h |
|
6 #define nsHtml5PendingNotification_h |
|
7 |
|
8 #include "nsNodeUtils.h" |
|
9 |
|
10 class nsHtml5TreeBuilder; |
|
11 |
|
12 class nsHtml5PendingNotification { |
|
13 public: |
|
14 |
|
15 nsHtml5PendingNotification(nsIContent* aParent) |
|
16 : mParent(aParent), |
|
17 mChildCount(aParent->GetChildCount() - 1) |
|
18 { |
|
19 MOZ_COUNT_CTOR(nsHtml5PendingNotification); |
|
20 } |
|
21 |
|
22 ~nsHtml5PendingNotification() |
|
23 { |
|
24 MOZ_COUNT_DTOR(nsHtml5PendingNotification); |
|
25 } |
|
26 |
|
27 inline void Fire() |
|
28 { |
|
29 nsNodeUtils::ContentAppended(mParent, mParent->GetChildAt(mChildCount), |
|
30 mChildCount); |
|
31 } |
|
32 |
|
33 inline bool Contains(nsIContent* aNode) |
|
34 { |
|
35 return !!(mParent == aNode); |
|
36 } |
|
37 |
|
38 inline bool HaveNotifiedIndex(uint32_t index) |
|
39 { |
|
40 return index < mChildCount; |
|
41 } |
|
42 |
|
43 private: |
|
44 /** |
|
45 * An element |
|
46 */ |
|
47 nsIContent* mParent; |
|
48 |
|
49 /** |
|
50 * Child count at start of notification deferring |
|
51 */ |
|
52 uint32_t mChildCount; |
|
53 }; |
|
54 |
|
55 #endif // nsHtml5PendingNotification_h |