diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
commit | a90a5cba08fdf6c0ceb95101c275108a152a3aed (patch) | |
tree | 532507288f3defd7f4dcf1af49698bcb76034855 /servo/components/selectors | |
parent | Adding debian version 126.0.1-1. (diff) | |
download | firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'servo/components/selectors')
-rw-r--r-- | servo/components/selectors/Cargo.toml | 2 | ||||
-rw-r--r-- | servo/components/selectors/context.rs | 23 | ||||
-rw-r--r-- | servo/components/selectors/kleene_value.rs | 3 | ||||
-rw-r--r-- | servo/components/selectors/matching.rs | 7 |
4 files changed, 28 insertions, 7 deletions
diff --git a/servo/components/selectors/Cargo.toml b/servo/components/selectors/Cargo.toml index 88360d7dd2..eec2ee9a90 100644 --- a/servo/components/selectors/Cargo.toml +++ b/servo/components/selectors/Cargo.toml @@ -19,7 +19,7 @@ bench = [] [dependencies] bitflags = "2" -cssparser = "0.33" +cssparser = "0.34" derive_more = { version = "0.99", default-features = false, features = ["add", "add_assign"] } fxhash = "0.2" log = "0.4" diff --git a/servo/components/selectors/context.rs b/servo/components/selectors/context.rs index 289b081b64..c6870c6c96 100644 --- a/servo/components/selectors/context.rs +++ b/servo/components/selectors/context.rs @@ -70,6 +70,19 @@ impl VisitedHandlingMode { } } +/// The mode to use whether we should matching rules inside @starting-style. +/// https://drafts.csswg.org/css-transitions-2/#starting-style +#[derive(Clone, Copy, Debug, Eq, PartialEq)] +pub enum IncludeStartingStyle { + /// All without rules inside @starting-style. This is for the most common case because the + /// primary/pseudo styles doesn't use rules inside @starting-style. + No, + /// Get the starting style. The starting style for an element as the after-change style with + /// @starting-style rules applied in addition. In other words, this matches all rules, + /// including rules inside @starting-style. + Yes, +} + /// Whether we need to set selector invalidation flags on elements for this /// match request. #[derive(Clone, Copy, Debug, PartialEq)] @@ -191,6 +204,12 @@ where /// Controls how matching for links is handled. visited_handling: VisitedHandlingMode, + /// Controls if we should match rules in @starting-style. + pub include_starting_style: IncludeStartingStyle, + + /// Whether there are any rules inside @starting-style. + pub has_starting_style: bool, + /// The current nesting level of selectors that we're matching. nesting_level: usize, @@ -239,6 +258,7 @@ where bloom_filter, selector_caches, VisitedHandlingMode::AllLinksUnvisited, + IncludeStartingStyle::No, quirks_mode, needs_selector_flags, matching_for_invalidation, @@ -251,6 +271,7 @@ where bloom_filter: Option<&'a BloomFilter>, selector_caches: &'a mut SelectorCaches, visited_handling: VisitedHandlingMode, + include_starting_style: IncludeStartingStyle, quirks_mode: QuirksMode, needs_selector_flags: NeedsSelectorFlags, matching_for_invalidation: MatchingForInvalidation, @@ -259,6 +280,8 @@ where matching_mode, bloom_filter, visited_handling, + include_starting_style, + has_starting_style: false, quirks_mode, classes_and_ids_case_sensitivity: quirks_mode.classes_and_ids_case_sensitivity(), needs_selector_flags, diff --git a/servo/components/selectors/kleene_value.rs b/servo/components/selectors/kleene_value.rs index 58141c1156..96d6457e60 100644 --- a/servo/components/selectors/kleene_value.rs +++ b/servo/components/selectors/kleene_value.rs @@ -38,6 +38,7 @@ impl KleeneValue { /// Return true if any result of f() is true. Otherwise, return the strongest value seen. /// Returns false if empty, like that of `Iterator`. + #[inline(always)] pub fn any<T>( iter: impl Iterator<Item = T>, f: impl FnMut(T) -> Self, @@ -47,6 +48,7 @@ impl KleeneValue { /// Return false if any results of f() is false. Otherwise, return the strongest value seen. /// Returns true if empty, opposite of `Iterator`. + #[inline(always)] pub fn any_false<T>( iter: impl Iterator<Item = T>, f: impl FnMut(T) -> Self, @@ -54,6 +56,7 @@ impl KleeneValue { Self::any_value(iter, Self::False, Self::True, f) } + #[inline(always)] fn any_value<T>( iter: impl Iterator<Item = T>, value: Self, diff --git a/servo/components/selectors/matching.rs b/servo/components/selectors/matching.rs index 282d04064b..6eaafb3038 100644 --- a/servo/components/selectors/matching.rs +++ b/servo/components/selectors/matching.rs @@ -362,12 +362,7 @@ where let iter = selector.iter_from(selector.len() - from_offset); debug_assert!( - iter.clone().next().is_some() || - (from_offset != selector.len() && - matches!( - selector.combinator_at_parse_order(from_offset), - Combinator::SlotAssignment | Combinator::PseudoElement - )), + iter.clone().next().is_some() || from_offset != selector.len(), "Got the math wrong: {:?} | {:?} | {} {}", selector, selector.iter_raw_match_order().as_slice(), |