mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +00:00
LibWeb: Make the specificity sort comparator a bit more readable
This commit is contained in:
parent
9ad3e6cd8a
commit
246e0e47ec
1 changed files with 6 additions and 9 deletions
|
@ -497,15 +497,12 @@ NonnullRefPtr<StyleProperties> StyleResolver::resolve_style(const Element& eleme
|
||||||
quick_sort(matching_rules, [&](MatchingRule& a, MatchingRule& b) {
|
quick_sort(matching_rules, [&](MatchingRule& a, MatchingRule& b) {
|
||||||
auto& a_selector = a.rule->selectors()[a.selector_index];
|
auto& a_selector = a.rule->selectors()[a.selector_index];
|
||||||
auto& b_selector = b.rule->selectors()[b.selector_index];
|
auto& b_selector = b.rule->selectors()[b.selector_index];
|
||||||
if (a_selector.specificity() < b_selector.specificity())
|
if (a_selector.specificity() == b_selector.specificity()) {
|
||||||
return true;
|
if (a.style_sheet_index == b.style_sheet_index)
|
||||||
if (!(a_selector.specificity() == b_selector.specificity()))
|
return a.rule_index < b.rule_index;
|
||||||
return false;
|
return a.style_sheet_index < b.style_sheet_index;
|
||||||
if (a.style_sheet_index < b.style_sheet_index)
|
}
|
||||||
return true;
|
return a_selector.specificity() < b_selector.specificity();
|
||||||
if (a.style_sheet_index > b.style_sheet_index)
|
|
||||||
return false;
|
|
||||||
return a.rule_index < b.rule_index;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
for (auto& match : matching_rules) {
|
for (auto& match : matching_rules) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue