diff --git a/content/base/public/Element.h b/content/base/public/Element.h index ff71563f9686..16c727128852 100644 --- a/content/base/public/Element.h +++ b/content/base/public/Element.h @@ -42,6 +42,41 @@ #include "nsIContent.h" +// Element-specific flags +enum { + // Set if the element has a pending style change. + ELEMENT_HAS_PENDING_RESTYLE = (1 << NODE_TYPE_SPECIFIC_BITS_OFFSET), + + // Set if the element is a potential restyle root (that is, has a style + // change pending _and_ that style change will attempt to restyle + // descendants). + ELEMENT_IS_POTENTIAL_RESTYLE_ROOT = + (1 << (NODE_TYPE_SPECIFIC_BITS_OFFSET + 1)), + + // Set if the element has a pending animation style change. + ELEMENT_HAS_PENDING_ANIMATION_RESTYLE = + (1 << (NODE_TYPE_SPECIFIC_BITS_OFFSET + 2)), + + // Set if the element is a potential animation restyle root (that is, + // has an animation style change pending _and_ that style change + // will attempt to restyle descendants). + ELEMENT_IS_POTENTIAL_ANIMATION_RESTYLE_ROOT = + (1 << (NODE_TYPE_SPECIFIC_BITS_OFFSET + 3)), + + // All of those bits together, for convenience. + ELEMENT_ALL_RESTYLE_FLAGS = ELEMENT_HAS_PENDING_RESTYLE | + ELEMENT_IS_POTENTIAL_RESTYLE_ROOT | + ELEMENT_HAS_PENDING_ANIMATION_RESTYLE | + ELEMENT_IS_POTENTIAL_ANIMATION_RESTYLE_ROOT, + + // Just the HAS_PENDING bits, for convenience + ELEMENT_PENDING_RESTYLE_FLAGS = ELEMENT_HAS_PENDING_RESTYLE | + ELEMENT_HAS_PENDING_ANIMATION_RESTYLE, + + // Remaining bits are for subclasses + ELEMENT_TYPE_SPECIFIC_BITS_OFFSET = NODE_TYPE_SPECIFIC_BITS_OFFSET + 4 +}; + namespace mozilla { namespace dom { diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index a5de45755025..0345371f1c4d 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -2882,7 +2882,9 @@ nsGenericElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, // Unset this flag since we now really are in a document. UnsetFlags(NODE_FORCE_XBL_BINDINGS | // And clear the lazy frame construction bits. - NODE_NEEDS_FRAME | NODE_DESCENDANTS_NEED_FRAMES); + NODE_NEEDS_FRAME | NODE_DESCENDANTS_NEED_FRAMES | + // And the restyle bits + ELEMENT_ALL_RESTYLE_FLAGS); } // If NODE_FORCE_XBL_BINDINGS was set we might have anonymous children diff --git a/content/html/content/src/nsGenericHTMLElement.h b/content/html/content/src/nsGenericHTMLElement.h index 19c893fecca6..ebee3ee0e18f 100644 --- a/content/html/content/src/nsGenericHTMLElement.h +++ b/content/html/content/src/nsGenericHTMLElement.h @@ -886,19 +886,19 @@ protected: // added ourselves to our mForm. It's possible to have a non-null mForm, but // not have this flag set. That happens when the form is set via the content // sink. -#define ADDED_TO_FORM (1 << NODE_TYPE_SPECIFIC_BITS_OFFSET) +#define ADDED_TO_FORM (1 << ELEMENT_TYPE_SPECIFIC_BITS_OFFSET) // If this flag is set on an nsGenericHTMLFormElement, that means that its form // is in the process of being unbound from the tree, and this form element // hasn't re-found its form in nsGenericHTMLFormElement::UnbindFromTree yet. -#define MAYBE_ORPHAN_FORM_ELEMENT (1 << (NODE_TYPE_SPECIFIC_BITS_OFFSET+1)) +#define MAYBE_ORPHAN_FORM_ELEMENT (1 << (ELEMENT_TYPE_SPECIFIC_BITS_OFFSET+1)) // NOTE: I don't think it's possible to have the above two flags set at the // same time, so if it becomes an issue we can probably merge them into the // same bit. --bz // Make sure we have enough space for those bits -PR_STATIC_ASSERT(NODE_TYPE_SPECIFIC_BITS_OFFSET + 1 < 32); +PR_STATIC_ASSERT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 1 < 32); //---------------------------------------------------------------------- diff --git a/content/xul/content/src/nsXULElement.h b/content/xul/content/src/nsXULElement.h index 676f1479ac0a..77212a0c46c8 100644 --- a/content/xul/content/src/nsXULElement.h +++ b/content/xul/content/src/nsXULElement.h @@ -449,10 +449,10 @@ public: */ -#define XUL_ELEMENT_TEMPLATE_GENERATED (1 << NODE_TYPE_SPECIFIC_BITS_OFFSET) +#define XUL_ELEMENT_TEMPLATE_GENERATED (1 << ELEMENT_TYPE_SPECIFIC_BITS_OFFSET) // Make sure we have space for our bit -PR_STATIC_ASSERT(NODE_TYPE_SPECIFIC_BITS_OFFSET < 32); +PR_STATIC_ASSERT(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET < 32); class nsScriptEventHandlerOwnerTearoff;