Title: [286063] trunk
- Revision
- 286063
- Author
- an...@apple.com
- Date
- 2021-11-19 08:53:01 -0800 (Fri, 19 Nov 2021)
Log Message
:hover with descendant selector not invalidated correctly in shadow tree
https://bugs.webkit.org/show_bug.cgi?id=233354
Reviewed by Antoine Quint.
Source/WebCore:
We optimize :hover and :active by only invalidating for descendant selectors with a single tree walk.
This doesn't work correctly for shadow trees as their scoped style may differ and the invalidation
is limited to a single scope anyway.
Fix by doing descendant invalidation for each affected scope.
Test: fast/selectors/hover-descendant-shadow-tree.html
* dom/Document.cpp:
(WebCore::Document::updateHoverActiveState):
We need to perform scoped descendant invalidation for elements that are parented to ShadowRoot.
LayoutTests:
* fast/selectors/hover-descendant-shadow-tree-expected.html: Added.
* fast/selectors/hover-descendant-shadow-tree.html: Added.
* platform/ios/TestExpectations:
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (286062 => 286063)
--- trunk/LayoutTests/ChangeLog 2021-11-19 15:57:39 UTC (rev 286062)
+++ trunk/LayoutTests/ChangeLog 2021-11-19 16:53:01 UTC (rev 286063)
@@ -1,3 +1,14 @@
+2021-11-19 Antti Koivisto <an...@apple.com>
+
+ :hover with descendant selector not invalidated correctly in shadow tree
+ https://bugs.webkit.org/show_bug.cgi?id=233354
+
+ Reviewed by Antoine Quint.
+
+ * fast/selectors/hover-descendant-shadow-tree-expected.html: Added.
+ * fast/selectors/hover-descendant-shadow-tree.html: Added.
+ * platform/ios/TestExpectations:
+
2021-11-19 Arcady Goldmints-Orlov <agoldmi...@igalia.com>
REGRESSION(r285859) [GTK][WPE] a number of accessibility/* tests crash on GTK and WPE
Added: trunk/LayoutTests/fast/selectors/hover-descendant-shadow-tree-expected.html (0 => 286063)
--- trunk/LayoutTests/fast/selectors/hover-descendant-shadow-tree-expected.html (rev 0)
+++ trunk/LayoutTests/fast/selectors/hover-descendant-shadow-tree-expected.html 2021-11-19 16:53:01 UTC (rev 286063)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<body>
+<style>
+.parent {
+ width: 100px;
+ height: 100px;
+ background: blue;
+}
+
+.child {
+ width: 30px;
+ height: 30px;
+ background: green;
+}
+
+</style>
+<div class="parent">
+ <div class="child">
+ </div>
+</div>
+</body>
Added: trunk/LayoutTests/fast/selectors/hover-descendant-shadow-tree.html (0 => 286063)
--- trunk/LayoutTests/fast/selectors/hover-descendant-shadow-tree.html (rev 0)
+++ trunk/LayoutTests/fast/selectors/hover-descendant-shadow-tree.html 2021-11-19 16:53:01 UTC (rev 286063)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<body>
+<template id="template">
+<style>
+.parent {
+ width: 100px;
+ height: 100px;
+ background: blue;
+}
+
+.child {
+ width: 30px;
+ height: 30px;
+}
+
+.parent:hover .child {
+ background: green;
+}
+
+</style>
+<div class="parent">
+ <div class="child">
+ </div>
+</div>
+</template>
+
+<script>
+customElements.define('custom-element', class extends HTMLElement {
+ connectedCallback() {
+ this.attachShadow({mode: 'open'}).append(template.content.cloneNode(true));
+ }
+});
+</script>
+
+<custom-element id=target></custom-element>
+
+<script>
+if (window.eventSender) {
+ var x = target.offsetLeft + target.offsetWidth / 2;
+ var y = target.offsetTop + target.offsetHeight / 2;
+ eventSender.mouseMoveTo(x, y);
+}
+</script>
+</body>
Modified: trunk/LayoutTests/platform/ios/TestExpectations (286062 => 286063)
--- trunk/LayoutTests/platform/ios/TestExpectations 2021-11-19 15:57:39 UTC (rev 286062)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2021-11-19 16:53:01 UTC (rev 286063)
@@ -710,6 +710,7 @@
fast/selectors/active-hover-strict.html [ Skip ]
fast/selectors/active-quirks.html [ Skip ]
fast/selectors/active-strict.html [ Skip ]
+fast/selectors/hover-descendant-shadow-tree.html [ Skip ]
fast/selectors/hover-invalidation-descendant-clear.html [ Skip ]
fast/selectors/hover-invalidation-descendant-dynamic.html [ Skip ]
fast/selectors/hover-quirks.html [ Skip ]
Modified: trunk/Source/WebCore/ChangeLog (286062 => 286063)
--- trunk/Source/WebCore/ChangeLog 2021-11-19 15:57:39 UTC (rev 286062)
+++ trunk/Source/WebCore/ChangeLog 2021-11-19 16:53:01 UTC (rev 286063)
@@ -1,3 +1,23 @@
+2021-11-19 Antti Koivisto <an...@apple.com>
+
+ :hover with descendant selector not invalidated correctly in shadow tree
+ https://bugs.webkit.org/show_bug.cgi?id=233354
+
+ Reviewed by Antoine Quint.
+
+ We optimize :hover and :active by only invalidating for descendant selectors with a single tree walk.
+ This doesn't work correctly for shadow trees as their scoped style may differ and the invalidation
+ is limited to a single scope anyway.
+
+ Fix by doing descendant invalidation for each affected scope.
+
+ Test: fast/selectors/hover-descendant-shadow-tree.html
+
+ * dom/Document.cpp:
+ (WebCore::Document::updateHoverActiveState):
+
+ We need to perform scoped descendant invalidation for elements that are parented to ShadowRoot.
+
2021-11-19 Matt Woodrow <matt.wood...@gmail.com>
Don't modify fragment-only or empty image URLs
Modified: trunk/Source/WebCore/dom/Document.cpp (286062 => 286063)
--- trunk/Source/WebCore/dom/Document.cpp 2021-11-19 15:57:39 UTC (rev 286062)
+++ trunk/Source/WebCore/dom/Document.cpp 2021-11-19 16:53:01 UTC (rev 286063)
@@ -7480,7 +7480,16 @@
auto changeState = [](auto& elements, auto pseudoClassType, auto&& setter) {
if (elements.isEmpty())
return;
+
Style::PseudoClassChangeInvalidation styleInvalidation { *elements.last(), pseudoClassType, Style::InvalidationScope::Descendants };
+
+ // We need to do descendant invalidation for each shadow tree separately as the style is per-scope.
+ Vector<Style::PseudoClassChangeInvalidation> shadowDescendantStyleInvalidations;
+ for (auto& element : elements) {
+ if (hasShadowRootParent(*element))
+ shadowDescendantStyleInvalidations.append({ *element, pseudoClassType, Style::InvalidationScope::Descendants });
+ }
+
for (auto& element : elements)
setter(*element);
};
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes