michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsHtml5PendingNotification_h michael@0: #define nsHtml5PendingNotification_h michael@0: michael@0: #include "nsNodeUtils.h" michael@0: michael@0: class nsHtml5TreeBuilder; michael@0: michael@0: class nsHtml5PendingNotification { michael@0: public: michael@0: michael@0: nsHtml5PendingNotification(nsIContent* aParent) michael@0: : mParent(aParent), michael@0: mChildCount(aParent->GetChildCount() - 1) michael@0: { michael@0: MOZ_COUNT_CTOR(nsHtml5PendingNotification); michael@0: } michael@0: michael@0: ~nsHtml5PendingNotification() michael@0: { michael@0: MOZ_COUNT_DTOR(nsHtml5PendingNotification); michael@0: } michael@0: michael@0: inline void Fire() michael@0: { michael@0: nsNodeUtils::ContentAppended(mParent, mParent->GetChildAt(mChildCount), michael@0: mChildCount); michael@0: } michael@0: michael@0: inline bool Contains(nsIContent* aNode) michael@0: { michael@0: return !!(mParent == aNode); michael@0: } michael@0: michael@0: inline bool HaveNotifiedIndex(uint32_t index) michael@0: { michael@0: return index < mChildCount; michael@0: } michael@0: michael@0: private: michael@0: /** michael@0: * An element michael@0: */ michael@0: nsIContent* mParent; michael@0: michael@0: /** michael@0: * Child count at start of notification deferring michael@0: */ michael@0: uint32_t mChildCount; michael@0: }; michael@0: michael@0: #endif // nsHtml5PendingNotification_h