diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /servo/components/style/invalidation/element/element_wrapper.rs | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'servo/components/style/invalidation/element/element_wrapper.rs')
-rw-r--r-- | servo/components/style/invalidation/element/element_wrapper.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/servo/components/style/invalidation/element/element_wrapper.rs b/servo/components/style/invalidation/element/element_wrapper.rs index e17afd7774..9a39b7d5a0 100644 --- a/servo/components/style/invalidation/element/element_wrapper.rs +++ b/servo/components/style/invalidation/element/element_wrapper.rs @@ -73,6 +73,18 @@ pub trait ElementSnapshot: Sized { where F: FnMut(&AtomIdent); + + /// If this snapshot contains CustomStateSet information. + fn has_custom_states(&self) -> bool; + + /// A callback that should be called for each CustomState of the snapshot. + fn has_custom_state(&self, state: &AtomIdent) -> bool; + + /// A callback that should be called for each CustomState of the snapshot. + fn each_custom_state<F>(&self, callback: F) + where + F: FnMut(&AtomIdent); + /// The `xml:lang=""` or `lang=""` attribute value per this snapshot. fn lang_attr(&self) -> Option<AttrValue>; } @@ -213,6 +225,11 @@ where .match_element_lang(Some(self.get_lang()), lang_arg); }, + // CustomStateSet should match against the snapshot before element + NonTSPseudoClass::CustomState(ref state) => { + return self.has_custom_state(&state.0) + }, + _ => {}, } @@ -357,6 +374,13 @@ where } } + fn has_custom_state(&self, state: &AtomIdent) -> bool { + match self.snapshot() { + Some(snapshot) if snapshot.has_custom_states() => snapshot.has_custom_state(state), + _ => self.element.has_custom_state(state), + } + } + fn is_empty(&self) -> bool { self.element.is_empty() } |