mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Bug 581177 part 7. Make 'may have contenteditable attr' into a boolean flag. r=sicking
This commit is contained in:
parent
0c4dcda0db
commit
a79423143e
@ -151,8 +151,7 @@ enum {
|
||||
NODE_HAS_EDGE_CHILD_SELECTOR |
|
||||
NODE_HAS_SLOW_SELECTOR_LATER_SIBLINGS,
|
||||
|
||||
NODE_MAY_HAVE_CONTENT_EDITABLE_ATTR
|
||||
= 0x00020000U,
|
||||
UNUSED6 = 0x00020000U,
|
||||
|
||||
NODE_ATTACH_BINDING_ON_POSTCREATE
|
||||
= 0x00040000U,
|
||||
@ -1151,6 +1150,8 @@ private:
|
||||
ElementMayHaveStyle,
|
||||
// Set if the element has a name attribute set.
|
||||
ElementHasName,
|
||||
// Set if the element might have a contenteditable attribute set.
|
||||
ElementMayHaveContentEditableAttr,
|
||||
// Guard value
|
||||
BooleanFlagCount
|
||||
};
|
||||
@ -1183,6 +1184,8 @@ public:
|
||||
bool HasID() const { return GetBoolFlag(ElementHasID); }
|
||||
bool MayHaveStyle() const { return GetBoolFlag(ElementMayHaveStyle); }
|
||||
bool HasName() const { return GetBoolFlag(ElementHasName); }
|
||||
bool MayHaveContentEditableAttr() const
|
||||
{ return GetBoolFlag(ElementMayHaveContentEditableAttr); }
|
||||
|
||||
protected:
|
||||
void SetParentIsContent(bool aValue) { SetBoolFlag(ParentIsContent, aValue); }
|
||||
@ -1195,6 +1198,8 @@ protected:
|
||||
void SetMayHaveStyle() { SetBoolFlag(ElementMayHaveStyle); }
|
||||
void SetHasName() { SetBoolFlag(ElementHasName); }
|
||||
void ClearHasName() { ClearBoolFlag(ElementHasName); }
|
||||
void SetMayHaveContentEditableAttr()
|
||||
{ SetBoolFlag(ElementMayHaveContentEditableAttr); }
|
||||
|
||||
public:
|
||||
// Optimized way to get classinfo.
|
||||
|
@ -1188,7 +1188,7 @@ nsGenericHTMLElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
PRInt32 change;
|
||||
if (contentEditable) {
|
||||
change = GetContentEditableValue() == eTrue ? -1 : 0;
|
||||
SetFlags(NODE_MAY_HAVE_CONTENT_EDITABLE_ATTR);
|
||||
SetMayHaveContentEditableAttr();
|
||||
}
|
||||
|
||||
nsresult rv = nsStyledElement::SetAttr(aNameSpaceID, aName, aPrefix, aValue,
|
||||
|
@ -791,7 +791,7 @@ protected:
|
||||
static const nsIContent::AttrValuesArray values[] =
|
||||
{ &nsGkAtoms::_false, &nsGkAtoms::_true, &nsGkAtoms::_empty, nsnull };
|
||||
|
||||
if (!HasFlag(NODE_MAY_HAVE_CONTENT_EDITABLE_ATTR))
|
||||
if (!MayHaveContentEditableAttr())
|
||||
return eInherit;
|
||||
|
||||
PRInt32 value = FindAttrValueIn(kNameSpaceID_None,
|
||||
|
@ -6191,16 +6191,16 @@ nsCSSFrameConstructor::ReframeTextIfNeeded(nsIContent* aParentContent,
|
||||
// to construct frames for those lazily.
|
||||
// The logic for this check is based on
|
||||
// nsGenericHTMLFormElement::UpdateEditableFormControlState and so must be kept
|
||||
// in sync with that. The presence of the NODE_MAY_HAVE_CONTENT_EDITABLE_ATTR
|
||||
// flag only indicates a contenteditable attribute, it doesn't indicate if it
|
||||
// is true or false, so we force eager construction in some cases when the node
|
||||
// is not editable, but that should be rare.
|
||||
// in sync with that. MayHaveContentEditableAttr() being true only indicates
|
||||
// a contenteditable attribute, it doesn't indicate whether it is true or false,
|
||||
// so we force eager construction in some cases when the node is not editable,
|
||||
// but that should be rare.
|
||||
static inline PRBool
|
||||
IsActuallyEditable(nsIContent* aContainer, nsIContent* aChild)
|
||||
{
|
||||
return (aChild->IsEditable() &&
|
||||
(aContainer->IsEditable() ||
|
||||
aChild->HasFlag(NODE_MAY_HAVE_CONTENT_EDITABLE_ATTR)));
|
||||
aChild->MayHaveContentEditableAttr()));
|
||||
}
|
||||
|
||||
// For inserts aChild should be valid, for appends it should be null.
|
||||
|
Loading…
Reference in New Issue
Block a user