mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1075082 patch 1 - Add a helper function for the root of the rule tree. r=birtles
This commit is contained in:
parent
4dbfc05082
commit
b5edb04125
@ -1556,6 +1556,16 @@ nsRuleNode::Transition(nsIStyleRule* aRule, uint8_t aLevel,
|
||||
return next;
|
||||
}
|
||||
|
||||
nsRuleNode*
|
||||
nsRuleNode::RuleTree()
|
||||
{
|
||||
nsRuleNode* n = this;
|
||||
while (n->mParent) {
|
||||
n = n->mParent;
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
void nsRuleNode::SetUsedDirectly()
|
||||
{
|
||||
mDependentBits |= NS_RULE_NODE_USED_DIRECTLY;
|
||||
|
@ -689,6 +689,12 @@ public:
|
||||
nsRuleNode* GetParent() const { return mParent; }
|
||||
bool IsRoot() const { return mParent == nullptr; }
|
||||
|
||||
// Return the root of the rule tree that this rule node is in.
|
||||
nsRuleNode* RuleTree();
|
||||
const nsRuleNode* RuleTree() const {
|
||||
return const_cast<nsRuleNode*>(this)->RuleTree();
|
||||
}
|
||||
|
||||
// These uint8_ts are really nsStyleSet::sheetType values.
|
||||
uint8_t GetLevel() const {
|
||||
NS_ASSERTION(!IsRoot(), "can't call on root");
|
||||
|
@ -233,10 +233,6 @@ nsStyleSet::EndReconstruct()
|
||||
mInReconstruct = false;
|
||||
#ifdef DEBUG
|
||||
for (int32_t i = mRoots.Length() - 1; i >= 0; --i) {
|
||||
nsRuleNode *n = mRoots[i]->RuleNode();
|
||||
while (n->GetParent()) {
|
||||
n = n->GetParent();
|
||||
}
|
||||
// Since nsStyleContext's mParent and mRuleNode are immutable, and
|
||||
// style contexts own their parents, and nsStyleContext asserts in
|
||||
// its constructor that the style context and its parent are in the
|
||||
@ -244,7 +240,8 @@ nsStyleSet::EndReconstruct()
|
||||
// mRoots; we only need to check the rule nodes of mRoots
|
||||
// themselves.
|
||||
|
||||
NS_ASSERTION(n == mRuleTree, "style context has old rule node");
|
||||
NS_ASSERTION(mRoots[i]->RuleNode()->RuleTree() == mRuleTree,
|
||||
"style context has old rule node");
|
||||
}
|
||||
#endif
|
||||
// This *should* destroy the only element of mOldRuleTrees, but in
|
||||
|
Loading…
Reference in New Issue
Block a user