Bug 1277298 - Store the 'scrollgrab' property in a NODE_FLAG_BIT rather than a new field of nsGenericHTMLElement. r=smaug

MozReview-Commit-ID: 7DV33kG2KNt

--HG--
extra : source : 3f7ad60ae16bce8cac317aee8d3ec6445354733c
This commit is contained in:
Botond Ballo 2016-06-06 17:45:46 -04:00
parent d774944355
commit 4cd8a55cfc
2 changed files with 11 additions and 7 deletions

View File

@ -112,8 +112,11 @@ enum {
ELEMENT_POTENTIAL_RESTYLE_ROOT_FLAGS |
ELEMENT_IS_CONDITIONAL_RESTYLE_ANCESTOR,
// Set if this element is marked as 'scrollgrab' (see bug 912666)
ELEMENT_HAS_SCROLLGRAB = ELEMENT_FLAG_BIT(5),
// Remaining bits are for subclasses
ELEMENT_TYPE_SPECIFIC_BITS_OFFSET = NODE_TYPE_SPECIFIC_BITS_OFFSET + 5
ELEMENT_TYPE_SPECIFIC_BITS_OFFSET = NODE_TYPE_SPECIFIC_BITS_OFFSET + 6
};
#undef ELEMENT_FLAG_BIT

View File

@ -52,8 +52,7 @@ class nsGenericHTMLElement : public nsGenericHTMLElementBase,
{
public:
explicit nsGenericHTMLElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsGenericHTMLElementBase(aNodeInfo),
mScrollgrab(false)
: nsGenericHTMLElementBase(aNodeInfo)
{
NS_ASSERTION(mNodeInfo->NamespaceID() == kNameSpaceID_XHTML,
"Unexpected namespace");
@ -194,11 +193,15 @@ public:
}
bool Scrollgrab() const
{
return mScrollgrab;
return HasFlag(ELEMENT_HAS_SCROLLGRAB);
}
void SetScrollgrab(bool aValue)
{
mScrollgrab = aValue;
if (aValue) {
SetFlags(ELEMENT_HAS_SCROLLGRAB);
} else {
UnsetFlags(ELEMENT_HAS_SCROLLGRAB);
}
}
void GetInnerText(mozilla::dom::DOMString& aValue, mozilla::ErrorResult& aError);
@ -1167,8 +1170,6 @@ protected:
private:
void ChangeEditableState(int32_t aChange);
bool mScrollgrab;
};
namespace mozilla {