Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
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/. */
5 #ifndef nsHtml5PendingNotification_h
6 #define nsHtml5PendingNotification_h
8 #include "nsNodeUtils.h"
10 class nsHtml5TreeBuilder;
12 class nsHtml5PendingNotification {
13 public:
15 nsHtml5PendingNotification(nsIContent* aParent)
16 : mParent(aParent),
17 mChildCount(aParent->GetChildCount() - 1)
18 {
19 MOZ_COUNT_CTOR(nsHtml5PendingNotification);
20 }
22 ~nsHtml5PendingNotification()
23 {
24 MOZ_COUNT_DTOR(nsHtml5PendingNotification);
25 }
27 inline void Fire()
28 {
29 nsNodeUtils::ContentAppended(mParent, mParent->GetChildAt(mChildCount),
30 mChildCount);
31 }
33 inline bool Contains(nsIContent* aNode)
34 {
35 return !!(mParent == aNode);
36 }
38 inline bool HaveNotifiedIndex(uint32_t index)
39 {
40 return index < mChildCount;
41 }
43 private:
44 /**
45 * An element
46 */
47 nsIContent* mParent;
49 /**
50 * Child count at start of notification deferring
51 */
52 uint32_t mChildCount;
53 };
55 #endif // nsHtml5PendingNotification_h