parser/html/nsHtml5PendingNotification.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/parser/html/nsHtml5PendingNotification.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef nsHtml5PendingNotification_h
     1.9 +#define nsHtml5PendingNotification_h
    1.10 +
    1.11 +#include "nsNodeUtils.h"
    1.12 +
    1.13 +class nsHtml5TreeBuilder;
    1.14 +
    1.15 +class nsHtml5PendingNotification {
    1.16 +  public:
    1.17 +
    1.18 +    nsHtml5PendingNotification(nsIContent* aParent)
    1.19 +     : mParent(aParent),
    1.20 +       mChildCount(aParent->GetChildCount() - 1)
    1.21 +    {
    1.22 +      MOZ_COUNT_CTOR(nsHtml5PendingNotification);
    1.23 +    }
    1.24 +
    1.25 +    ~nsHtml5PendingNotification()
    1.26 +    {
    1.27 +      MOZ_COUNT_DTOR(nsHtml5PendingNotification);
    1.28 +    }
    1.29 +
    1.30 +    inline void Fire()
    1.31 +    {
    1.32 +      nsNodeUtils::ContentAppended(mParent, mParent->GetChildAt(mChildCount),
    1.33 +                                   mChildCount);
    1.34 +    }
    1.35 +
    1.36 +    inline bool Contains(nsIContent* aNode)
    1.37 +    {
    1.38 +      return !!(mParent == aNode);
    1.39 +    }
    1.40 +    
    1.41 +    inline bool HaveNotifiedIndex(uint32_t index)
    1.42 +    {
    1.43 +      return index < mChildCount;
    1.44 +    }
    1.45 +
    1.46 +  private:
    1.47 +    /**
    1.48 +     * An element
    1.49 +     */
    1.50 +    nsIContent* mParent;
    1.51 +
    1.52 +    /**
    1.53 +     * Child count at start of notification deferring
    1.54 +     */
    1.55 +    uint32_t    mChildCount;
    1.56 +};
    1.57 +
    1.58 +#endif // nsHtml5PendingNotification_h

mercurial