Bug 1331322 - Move MAY_HAVE_CLASS to mBoolFlags. r=bholley

This fits a bit better with the other stuff, and allows us to add our new NAC
bit with the other NAC related bits, which also happens to be a field that
Servo already has easy access to.

--HG--
extra : rebase_source : 52ef902eb3b23dc44cefec899b02c9180b76160c
This commit is contained in:
Bobby Holley 2017-01-20 18:24:41 -08:00
Родитель cb5c414092
Коммит b5ec1b1aa2
5 изменённых файлов: 13 добавлений и 11 удалений

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

@ -166,8 +166,7 @@ nsIContent::DoGetID() const
const nsAttrValue*
Element::DoGetClasses() const
{
MOZ_ASSERT(HasFlag(NODE_MAY_HAVE_CLASS), "Unexpected call");
MOZ_ASSERT(MayHaveClass(), "Unexpected call");
if (IsSVGElement()) {
const nsAttrValue* animClass =
static_cast<const nsSVGElement*>(this)->GetAnimatedClassName();
@ -2549,7 +2548,7 @@ Element::ParseAttribute(int32_t aNamespaceID,
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::_class) {
SetFlags(NODE_MAY_HAVE_CLASS);
SetMayHaveClass();
// Result should have been preparsed above.
return true;
}

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

@ -623,7 +623,7 @@ public:
* guaranteed (e.g. we could have class="").
*/
const nsAttrValue* GetClasses() const {
if (HasFlag(NODE_MAY_HAVE_CLASS)) {
if (MayHaveClass()) {
return DoGetClasses();
}
return nullptr;

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

@ -127,9 +127,8 @@ enum {
NODE_IS_EDITABLE = NODE_FLAG_BIT(7),
// For all Element nodes, NODE_MAY_HAVE_CLASS is guaranteed to be set if the
// node in fact has a class, but may be set even if it doesn't.
NODE_MAY_HAVE_CLASS = NODE_FLAG_BIT(8),
// Bit that will soon be used for other things.
THIS_BIT_BELONGS_TO_BHOLLEY = NODE_FLAG_BIT(8),
// Whether the node participates in a shadow tree.
NODE_IS_IN_SHADOW_TREE = NODE_FLAG_BIT(9),
@ -1497,6 +1496,8 @@ private:
// cases lie for nsXMLElement, such as when the node has been moved between
// documents with different id mappings.
ElementHasID,
// Set if the element might have a class.
ElementMayHaveClass,
// Set if the element might have inline style.
ElementMayHaveStyle,
// Set if the element has a name attribute set.
@ -1591,6 +1592,8 @@ public:
{ SetBoolFlag(NodeHasRenderingObservers, aValue); }
bool IsContent() const { return GetBoolFlag(NodeIsContent); }
bool HasID() const { return GetBoolFlag(ElementHasID); }
bool MayHaveClass() const { return GetBoolFlag(ElementMayHaveClass); }
void SetMayHaveClass() { SetBoolFlag(ElementMayHaveClass); }
bool MayHaveStyle() const { return GetBoolFlag(ElementMayHaveStyle); }
bool HasName() const { return GetBoolFlag(ElementHasName); }
bool MayHaveContentEditableAttr() const

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

@ -70,7 +70,7 @@ nsSVGClass::SetBaseValue(const nsAString& aValue,
{
NS_ASSERTION(aSVGElement, "Null element passed to SetBaseValue");
aSVGElement->SetFlags(NODE_MAY_HAVE_CLASS);
aSVGElement->SetMayHaveClass();
if (aDoSetAttr) {
aSVGElement->SetAttr(kNameSpaceID_None, nsGkAtoms::_class, aValue, true);
}
@ -106,7 +106,7 @@ nsSVGClass::SetAnimValue(const nsAString& aValue, nsSVGElement *aSVGElement)
mAnimVal = new nsString();
}
*mAnimVal = aValue;
aSVGElement->SetFlags(NODE_MAY_HAVE_CLASS);
aSVGElement->SetMayHaveClass();
aSVGElement->DidAnimateClass();
}

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

@ -231,7 +231,7 @@ nsXULElement::Create(nsXULPrototypeElement* aPrototype, mozilla::dom::NodeInfo *
element->SetHasID();
}
if (aPrototype->mHasClassAttribute) {
element->SetFlags(NODE_MAY_HAVE_CLASS);
element->SetMayHaveClass();
}
if (aPrototype->mHasStyleAttribute) {
element->SetMayHaveStyle();
@ -405,7 +405,7 @@ nsXULElement::Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const
element->SetHasID();
}
if (originalName->Equals(nsGkAtoms::_class)) {
element->SetFlags(NODE_MAY_HAVE_CLASS);
element->SetMayHaveClass();
}
if (originalName->Equals(nsGkAtoms::style)) {
element->SetMayHaveStyle();