aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/gecko/wrapper.rs
diff options
context:
space:
mode:
authorDavid Shin <dshin@mozilla.com>2023-05-25 14:35:18 +0000
committerMartin Robinson <mrobinson@igalia.com>2023-11-24 08:57:14 +0100
commitff8100d3963ac88fa0001bec40472134dbb4394b (patch)
tree7f6485012d046f07afd2cc7eda7f8b44b8a214c6 /components/style/gecko/wrapper.rs
parent5c0897c8eb6ef789dd14918b9b427935a244a847 (diff)
downloadservo-ff8100d3963ac88fa0001bec40472134dbb4394b.tar.gz
servo-ff8100d3963ac88fa0001bec40472134dbb4394b.zip
style: Correct style sharing handling for any element that considered `:has()` in selector matching
For any element that anchors a `:has()` selector (i.e. Matches a selector that contains a `:has()` on its rightmost side), we prevent style sharing altogether, as evaluation of the `:has()` selector is required in the first place to determine style sharing. On the other hand, any element matching a rule containing `:has()` without anchoring it can do style sharing for siblings, but not cousins. Differential Revision: https://phabricator.services.mozilla.com/D176836
Diffstat (limited to 'components/style/gecko/wrapper.rs')
-rw-r--r--components/style/gecko/wrapper.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs
index ac4f113c93e..eb3ab03c73c 100644
--- a/components/style/gecko/wrapper.rs
+++ b/components/style/gecko/wrapper.rs
@@ -895,6 +895,9 @@ fn selector_flags_to_node_flags(flags: ElementSelectorFlags) -> u32 {
if flags.contains(ElementSelectorFlags::HAS_EMPTY_SELECTOR) {
gecko_flags |= NODE_HAS_EMPTY_SELECTOR;
}
+ if flags.contains(ElementSelectorFlags::ANCHORS_RELATIVE_SELECTOR) {
+ gecko_flags |= NODE_ANCHORS_RELATIVE_SELECTOR;
+ }
gecko_flags
}
@@ -1729,6 +1732,11 @@ impl<'le> TElement for GeckoElement<'le> {
}
}
}
+
+ fn anchors_relative_selector(&self) -> bool {
+ use crate::gecko_bindings::structs::NODE_ANCHORS_RELATIVE_SELECTOR;
+ self.flags() & NODE_ANCHORS_RELATIVE_SELECTOR != 0
+ }
}
impl<'le> PartialEq for GeckoElement<'le> {