tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 83826da275bff397520cc3d327228c18811ddd06
parent 7dc347fa2d5925314ec949e994733afa3b1f400d
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date:   Tue,  7 Oct 2025 13:52:19 +0000

Bug 1992837 - Don't stash a `None` result from update_rule_at_level into the cascade input for position-try. r=dshin,firefox-style-system-reviewers

update_rule_at_level returns `None` if the rule is already there. If we
stash that `None` in the cascade we'll get no rules rather than what we
want, which is the existing rules.

This blocks David, see discussion in D267650.

Differential Revision: https://phabricator.services.mozilla.com/D267771

Diffstat:
Mservo/components/style/stylist.rs | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/servo/components/style/stylist.rs b/servo/components/style/stylist.rs @@ -1231,7 +1231,7 @@ impl Stylist { inputs.visited_rules = None; let rules = inputs.rules.as_ref().unwrap_or(self.rule_tree.root()); let mut important_rules_changed = false; - inputs.rules = self.rule_tree.update_rule_at_level( + let new_rules = self.rule_tree.update_rule_at_level( CascadeLevel::PositionFallback, LayerOrder::root(), Some(fallback_block.borrow_arc()), @@ -1239,6 +1239,13 @@ impl Stylist { guards, &mut important_rules_changed, ); + if new_rules.is_some() { + inputs.rules = new_rules; + } else { + // This will return an identical style to `style`. We could consider optimizing + // this a bit more but for now just perform the cascade, this can only happen with + // the same position-try name repeated multiple times anyways. + } inputs }; crate::style_resolver::with_default_parent_styles(element, |parent_style, layout_parent_style| {