selectors::Element::parent() shouldn't cross shadow tree boundary#40977
selectors::Element::parent() shouldn't cross shadow tree boundary#40977yezhizhen merged 2 commits intoservo:mainfrom
Conversation
|
🔨 Triggering try run (#19816468662) for Linux (WPT) |
|
Test results for linux-wpt from try job (#19816468662): Flaky unexpected result (42)
Stable unexpected results that are known to be intermittent (16)
|
|
✨ Try run (#19816468662) succeeded. |
e3f66c5 to
15e158f
Compare
|
🔨 Triggering try run (#19818628609) for Linux (WPT) |
|
Test results for linux-wpt from try job (#19818628609): Flaky unexpected result (27)
Stable unexpected results that are known to be intermittent (17)
|
|
✨ Try run (#19818628609) succeeded. |
| } | ||
|
|
||
| fn parent_element(&self) -> Option<Self> { | ||
| ServoLayoutElement::parent_element(self) |
There was a problem hiding this comment.
Let's fix ServoLayoutElement::parent_element instead, it shouldn't use the composed tree. inheritance_parent should tho.
|
So something along these lines: diff --git a/components/script/layout_dom/element.rs b/components/script/layout_dom/element.rs
index 14a6809df14..45179d2cd96 100644
--- a/components/script/layout_dom/element.rs
+++ b/components/script/layout_dom/element.rs
@@ -135,10 +135,7 @@ impl<'dom> ServoLayoutElement<'dom> {
/// Returns the parent element of this element, if it has one.
fn parent_element(&self) -> Option<Self> {
- self.element
- .upcast()
- .composed_parent_node_ref()
- .and_then(|node| node.downcast().map(ServoLayoutElement::from_layout_js))
+ self.as_node().parent_element()
}
fn is_root(&self) -> bool {
@@ -220,9 +217,7 @@ impl<'dom> style::dom::TElement for ServoLayoutElement<'dom> {
return self.pseudo_element_originating_element();
}
- // FIXME: By default the inheritance parent would be the Self::parent_element
- // but probably we should use the flattened tree parent.
- self.parent_element()
+ self.traversal_parent()
}
fn is_html_element(&self) -> bool {
@@ -711,7 +706,7 @@ impl<'dom> ::selectors::Element for ServoLayoutElement<'dom> {
}
fn parent_element(&self) -> Option<Self> {
- ServoLayoutElement::parent_element(self)
+ self.as_node().parent_element()
}
fn parent_node_is_shadow_root(&self) -> bool { |
Signed-off-by: batu_hoang <[email protected]>
15e158f to
f897428
Compare
|
🔨 Triggering try run (#19870931259) for Linux (WPT) |
|
Test results for linux-wpt from try job (#19870931259): Flaky unexpected result (31)
Stable unexpected results that are known to be intermittent (25)
Stable unexpected results (3)
|
|
|
emilio
left a comment
There was a problem hiding this comment.
Seem like mostly more passes, nice.
We can mark it fail now and address it in another issue. |
Signed-off-by: batu_hoang <[email protected]>
|
🔨 Triggering try run (#19906184653) for Linux (WPT) |
|
Test results for linux-wpt from try job (#19906184653): Flaky unexpected result (36)
Stable unexpected results that are known to be intermittent (22)
|
|
✨ Try run (#19906184653) succeeded. |
|
Can you fix the PR body? |
Update this too. More passing and one failing |
@yezhizhen thank you, updated. |
ServoLayoutElement::parent_element() method shouldn't cross shadow tree boundary.
inheritance_parentusestraversal_parentTesting:
tests/wpt/meta/css/css-lists/counter-list-item-slot-order.html.initests/wpt/meta/css/css-nesting/host-nesting-003.html.initests/wpt/meta/css/selectors/is-where-shadow.html.iniand manual test in the below issue
The regression in
tests/wpt/meta/html/rendering/the-details-element/details-blockification.html.inihas 1 more cause #40977 (comment)Fixes: #40896
cc: @xiaochengh