Bug 479655 part 2. Add element restyle flags. r=dbaron, sr=jst

This commit is contained in:
Boris Zbarsky 2010-06-18 12:23:04 -04:00
Родитель 9d715cdb01
Коммит e59068ace2
4 изменённых файлов: 43 добавлений и 6 удалений

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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

Просмотреть файл

@ -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);
//----------------------------------------------------------------------

Просмотреть файл

@ -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;