diff options
author | Simon Wülker <simon.wuelker@arcor.de> | 2025-06-09 12:17:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-09 10:17:28 +0000 |
commit | 0fa3de3937b96eb6f61a52b6498d6bc772410899 (patch) | |
tree | 3db30fd0ce648e6d4e5461eb8d1a2738aced6b28 /components/script/dom/node.rs | |
parent | 73ee36be006eee79dcb1e656ea4f946e41a9b81a (diff) | |
download | servo-0fa3de3937b96eb6f61a52b6498d6bc772410899.tar.gz servo-0fa3de3937b96eb6f61a52b6498d6bc772410899.zip |
Support `::part` selector (#37307)
This is pretty much just wiring up the necessary stylo methods. Note
that the `exportparts` attribute is not yet supported, I'll do that in a
followup change
Testing: Covered by existing web platform tests.
This is the first half of https://github.com/servo/servo/issues/35349
Fixes https://github.com/servo/servo/issues/37325
---------
Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r-- | components/script/dom/node.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index bf36242572f..6d4a0d2529e 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -1583,6 +1583,7 @@ pub(crate) unsafe fn from_untrusted_node_address(candidate: UntrustedNodeAddress pub(crate) trait LayoutNodeHelpers<'dom> { fn type_id_for_layout(self) -> NodeTypeId; + fn parent_node_ref(self) -> Option<LayoutDom<'dom, Node>>; fn composed_parent_node_ref(self) -> Option<LayoutDom<'dom, Node>>; fn first_child_ref(self) -> Option<LayoutDom<'dom, Node>>; fn last_child_ref(self) -> Option<LayoutDom<'dom, Node>>; @@ -1645,7 +1646,7 @@ pub(crate) trait LayoutNodeHelpers<'dom> { impl<'dom> LayoutDom<'dom, Node> { #[inline] #[allow(unsafe_code)] - fn parent_node_ref(self) -> Option<LayoutDom<'dom, Node>> { + pub(crate) fn parent_node_ref(self) -> Option<LayoutDom<'dom, Node>> { unsafe { self.unsafe_get().parent_node.get_inner_as_layout() } } } @@ -1662,6 +1663,12 @@ impl<'dom> LayoutNodeHelpers<'dom> for LayoutDom<'dom, Node> { } #[inline] + #[allow(unsafe_code)] + fn parent_node_ref(self) -> Option<LayoutDom<'dom, Node>> { + unsafe { self.unsafe_get().parent_node.get_inner_as_layout() } + } + + #[inline] fn composed_parent_node_ref(self) -> Option<LayoutDom<'dom, Node>> { let parent = self.parent_node_ref(); if let Some(parent) = parent { |