зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1337305 Part 2: Change GetCSSStyleRules to return RuleNodes for Gecko rules, and nothing otherwise (instead of asserting). r=xidorn
MozReview-Commit-ID: EQWOstveuaU --HG-- extra : rebase_source : 7024f5f251d112cd8922f83490941bcb6781a7c8
This commit is contained in:
Родитель
0dc5a1c5a7
Коммит
cdb1a3d36f
|
@ -242,26 +242,29 @@ inDOMUtils::GetCSSStyleRules(nsIDOMElement *aElement,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRuleNode* ruleNode = styleContext->RuleNode();
|
||||
NonOwningStyleContextSource source = styleContext->StyleSource();
|
||||
if (!source.IsNull() && source.IsGeckoRuleNodeOrNull()) {
|
||||
nsRuleNode* ruleNode = source.AsGeckoRuleNode();
|
||||
|
||||
AutoTArray<nsRuleNode*, 16> ruleNodes;
|
||||
while (!ruleNode->IsRoot()) {
|
||||
ruleNodes.AppendElement(ruleNode);
|
||||
ruleNode = ruleNode->GetParent();
|
||||
}
|
||||
AutoTArray<nsRuleNode*, 16> ruleNodes;
|
||||
while (!ruleNode->IsRoot()) {
|
||||
ruleNodes.AppendElement(ruleNode);
|
||||
ruleNode = ruleNode->GetParent();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIMutableArray> rules = nsArray::Create();
|
||||
for (nsRuleNode* ruleNode : Reversed(ruleNodes)) {
|
||||
RefPtr<Declaration> decl = do_QueryObject(ruleNode->GetRule());
|
||||
if (decl) {
|
||||
css::Rule* owningRule = decl->GetOwningRule();
|
||||
if (owningRule) {
|
||||
rules->AppendElement(owningRule, /*weak =*/ false);
|
||||
nsCOMPtr<nsIMutableArray> rules = nsArray::Create();
|
||||
for (nsRuleNode* ruleNode : Reversed(ruleNodes)) {
|
||||
RefPtr<Declaration> decl = do_QueryObject(ruleNode->GetRule());
|
||||
if (decl) {
|
||||
css::Rule* owningRule = decl->GetOwningRule();
|
||||
if (owningRule) {
|
||||
rules->AppendElement(owningRule, /*weak =*/ false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rules.forget(_retval);
|
||||
rules.forget(_retval);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче