mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
Bug 572200, part 1: Make rule nodes know whether they're used directly by a style context. r=bzbarsky
This commit is contained in:
parent
bc5cfc9648
commit
559e6b289a
@ -646,6 +646,18 @@ public:
|
||||
return (mDependentBits & NS_RULE_NODE_IS_IMPORTANT) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Has this rule node at some time in its lifetime been the mRuleNode
|
||||
* of some style context (as opposed to only being the ancestor of
|
||||
* some style context's mRuleNode)?
|
||||
*/
|
||||
void SetUsedDirectly() {
|
||||
mDependentBits |= NS_RULE_NODE_USED_DIRECTLY;
|
||||
}
|
||||
bool IsUsedDirectly() const {
|
||||
return (mDependentBits & NS_RULE_NODE_USED_DIRECTLY) != 0;
|
||||
}
|
||||
|
||||
// NOTE: Does not |AddRef|.
|
||||
nsIStyleRule* GetRule() const { return mRule; }
|
||||
// NOTE: Does not |AddRef|.
|
||||
|
@ -65,14 +65,15 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent,
|
||||
#endif
|
||||
}
|
||||
|
||||
mRuleNode->AddRef();
|
||||
mRuleNode->SetUsedDirectly(); // before ApplyStyleFixups()!
|
||||
|
||||
ApplyStyleFixups();
|
||||
|
||||
#define eStyleStruct_LastItem (nsStyleStructID_Length - 1)
|
||||
NS_ASSERTION(NS_STYLE_INHERIT_MASK & NS_STYLE_INHERIT_BIT(LastItem),
|
||||
"NS_STYLE_INHERIT_MASK must be bigger, and other bits shifted");
|
||||
#undef eStyleStruct_LastItem
|
||||
|
||||
mRuleNode->AddRef();
|
||||
}
|
||||
|
||||
nsStyleContext::~nsStyleContext()
|
||||
|
@ -60,6 +60,7 @@ struct nsCSSValueList;
|
||||
|
||||
// Additional bits for nsRuleNode's mDependentBits:
|
||||
#define NS_RULE_NODE_GC_MARK 0x02000000
|
||||
#define NS_RULE_NODE_USED_DIRECTLY 0x04000000
|
||||
#define NS_RULE_NODE_IS_IMPORTANT 0x08000000
|
||||
#define NS_RULE_NODE_LEVEL_MASK 0xf0000000
|
||||
#define NS_RULE_NODE_LEVEL_SHIFT 28
|
||||
|
Loading…
Reference in New Issue
Block a user