diff options
Diffstat (limited to 'servo/components/style/selector_map.rs')
-rw-r--r-- | servo/components/style/selector_map.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/servo/components/style/selector_map.rs b/servo/components/style/selector_map.rs index 2b8d6add55..439fd414a6 100644 --- a/servo/components/style/selector_map.rs +++ b/servo/components/style/selector_map.rs @@ -330,6 +330,10 @@ impl SelectorMap<Rule> { ) where E: TElement, { + use selectors::matching::IncludeStartingStyle; + + let include_starting_style = + matches!(matching_context.include_starting_style, IncludeStartingStyle::Yes); for rule in rules { if !matches_selector( &rule.selector, @@ -352,6 +356,17 @@ impl SelectorMap<Rule> { } } + if rule.is_starting_style { + // Set this flag if there are any rules inside @starting-style. This flag is for + // optimization to avoid any redundant resolution of starting style if the author + // doesn't specify for this element. + matching_context.has_starting_style = true; + + if !include_starting_style { + continue; + } + } + matching_rules.push(rule.to_applicable_declaration_block(cascade_level, cascade_data)); } } |