aboutsummaryrefslogtreecommitdiffstats
path: root/components/selectors/parser.rs
diff options
context:
space:
mode:
authorZach Hoffman <zach@zrhoffman.net>2023-03-15 06:56:21 +0000
committerMartin Robinson <mrobinson@igalia.com>2023-11-21 15:36:35 +0100
commit356e886d26b75611224bacb5c13cea23dd7f271e (patch)
treeab7a11f98b70dd77ec1b44f474a10cdb3a0f1496 /components/selectors/parser.rs
parentc7f884566514055ad79c4475955cff4f72306865 (diff)
downloadservo-356e886d26b75611224bacb5c13cea23dd7f271e.tar.gz
servo-356e886d26b75611224bacb5c13cea23dd7f271e.zip
style: Record attribute dependencies within the selector list of :nth-child(... of <selector list>)
There are separate filters for IDs, classes, attribute local names, and element state. Also, we invalidate siblings of elements matched against the selector list of :nth-child(... of <selector list>) by marking matched elements with NODE_HAS_SLOW_SELECTOR_NTH_OF. The only remaining invalidation case invalidation case is `:nth-child(An+B of :has())` (bug 1818155), which should not block shipping `layout.css.nth-child-of.enabled`, because :has(...) is still being implemented (bug 418039). Depends on D172352 Differential Revision: https://phabricator.services.mozilla.com/D171936
Diffstat (limited to 'components/selectors/parser.rs')
-rw-r--r--components/selectors/parser.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/components/selectors/parser.rs b/components/selectors/parser.rs
index 5655eded4b0..8d397e06455 100644
--- a/components/selectors/parser.rs
+++ b/components/selectors/parser.rs
@@ -12,6 +12,7 @@ use crate::builder::{
};
use crate::context::QuirksMode;
use crate::sink::Push;
+use crate::visitor::SelectorListKind;
pub use crate::visitor::SelectorVisitor;
use bitflags::bitflags;
use cssparser::{match_ignore_ascii_case, parse_nth, *};
@@ -1625,14 +1626,15 @@ impl<Impl: SelectorImpl> Component<Impl> {
return false;
}
},
-
Negation(ref list) | Is(ref list) | Where(ref list) => {
- if !visitor.visit_selector_list(&list) {
+ let list_kind = SelectorListKind::from_component(self);
+ debug_assert!(!list_kind.is_empty());
+ if !visitor.visit_selector_list(list_kind, &list) {
return false;
}
},
NthOf(ref nth_of_data) => {
- if !visitor.visit_selector_list(nth_of_data.selectors()) {
+ if !visitor.visit_selector_list(SelectorListKind::NTH_OF, nth_of_data.selectors()) {
return false;
}
},