mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Bug 1391198 - Make the order of rules in DevTools be the specificity order.
We insert rules with any important declaration into rule tree twice, one for normal level and another for important level. And when we fetch them from rule tree, we skip the important one to make the order be MozReview-Commit-ID: HewZG6jYVvv
This commit is contained in:
parent
19cbea23a8
commit
1bacd01a78
2 changed files with 27 additions and 24 deletions
|
@ -1916,9 +1916,6 @@ pub extern "C" fn Servo_ComputedValues_GetStyleRuleList(values: ServoStyleContex
|
|||
None => return,
|
||||
};
|
||||
|
||||
let global_style_data = &*GLOBAL_STYLE_DATA;
|
||||
let guard = global_style_data.shared_lock.read();
|
||||
|
||||
// TODO(emilio): Will benefit from SmallVec.
|
||||
let mut result = vec![];
|
||||
for node in rule_node.self_and_ancestors() {
|
||||
|
@ -1927,13 +1924,12 @@ pub extern "C" fn Servo_ComputedValues_GetStyleRuleList(values: ServoStyleContex
|
|||
_ => continue,
|
||||
};
|
||||
|
||||
// For the rules with any important declaration, we insert them into
|
||||
// rule tree twice, one for normal level and another for important
|
||||
// level. So, we skip the important one to keep the specificity order of
|
||||
// rules.
|
||||
if node.importance().important() {
|
||||
let block = style_rule.read_with(&guard).block.read_with(&guard);
|
||||
if block.any_normal() {
|
||||
// We'll append it when we find the normal rules in our
|
||||
// parent chain.
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
result.push(style_rule);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue