Title: [271816] branches/safari-611-branch
Revision
271816
Author
alanc...@apple.com
Date
2021-01-25 14:10:32 -0800 (Mon, 25 Jan 2021)

Log Message

Cherry-pick r271367. rdar://problem/73469641

    REGRESSION (r258321): CSS rules using :first-of-type are applied to any/all siblings in a group under certain circumstances
    https://bugs.webkit.org/show_bug.cgi?id=218256
    <rdar://problem/70749584>

    Reviewed by Simon Fraser.

    Source/WebCore:

    More accurate invalidation for :hover resulted in smaller style updates that revealed a bug in the way we
    mark style non-shareable. We reset style relation bits when resolving the parent but may fail to set them again if we
    don't re-resolve all children.

    Test case by Eben Packwood.

    Test: fast/css/positional-selector-style-sharing.html

    * style/StyleRelations.cpp:
    (WebCore::Style::commitRelationsToRenderStyle):

    Just mark all styles affected by relations non-shareable. This is achieved via various bit tests but there
    is no reason not to set the simplest no-sharing bit. Since this forces real style resolution the parent
    bits will also get properly reset.

    LayoutTests:

    * fast/css/positional-selector-style-sharing-expected.html: Added.
    * fast/css/positional-selector-style-sharing.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271367 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-611-branch/LayoutTests/ChangeLog (271815 => 271816)


--- branches/safari-611-branch/LayoutTests/ChangeLog	2021-01-25 22:09:52 UTC (rev 271815)
+++ branches/safari-611-branch/LayoutTests/ChangeLog	2021-01-25 22:10:32 UTC (rev 271816)
@@ -1,3 +1,49 @@
+2021-01-25  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r271367. rdar://problem/73469641
+
+    REGRESSION (r258321): CSS rules using :first-of-type are applied to any/all siblings in a group under certain circumstances
+    https://bugs.webkit.org/show_bug.cgi?id=218256
+    <rdar://problem/70749584>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    More accurate invalidation for :hover resulted in smaller style updates that revealed a bug in the way we
+    mark style non-shareable. We reset style relation bits when resolving the parent but may fail to set them again if we
+    don't re-resolve all children.
+    
+    Test case by Eben Packwood.
+    
+    Test: fast/css/positional-selector-style-sharing.html
+    
+    * style/StyleRelations.cpp:
+    (WebCore::Style::commitRelationsToRenderStyle):
+    
+    Just mark all styles affected by relations non-shareable. This is achieved via various bit tests but there
+    is no reason not to set the simplest no-sharing bit. Since this forces real style resolution the parent
+    bits will also get properly reset.
+    
+    LayoutTests:
+    
+    * fast/css/positional-selector-style-sharing-expected.html: Added.
+    * fast/css/positional-selector-style-sharing.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271367 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-11  Antti Koivisto  <an...@apple.com>
+
+            REGRESSION (r258321): CSS rules using :first-of-type are applied to any/all siblings in a group under certain circumstances
+            https://bugs.webkit.org/show_bug.cgi?id=218256
+            <rdar://problem/70749584>
+
+            Reviewed by Simon Fraser.
+
+            * fast/css/positional-selector-style-sharing-expected.html: Added.
+            * fast/css/positional-selector-style-sharing.html: Added.
+
 2021-01-10  Antti Koivisto  <an...@apple.com>
 
         [LFC][Integration] Factor marked text style collection code out of InlineTextBox

Added: branches/safari-611-branch/LayoutTests/fast/css/positional-selector-style-sharing-expected.html (0 => 271816)


--- branches/safari-611-branch/LayoutTests/fast/css/positional-selector-style-sharing-expected.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/css/positional-selector-style-sharing-expected.html	2021-01-25 22:10:32 UTC (rev 271816)
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+td {
+    vertical-align: baseline;
+}
+td:first-child {
+    color: red;
+}
+</style>
+</head>
+<body>
+<table>
+<tr>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+</tr>
+<tr>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+</tr>
+<tr>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+</tr>
+<tr>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+</tr>
+</table>
+</body>
+</html>

Added: branches/safari-611-branch/LayoutTests/fast/css/positional-selector-style-sharing.html (0 => 271816)


--- branches/safari-611-branch/LayoutTests/fast/css/positional-selector-style-sharing.html	                        (rev 0)
+++ branches/safari-611-branch/LayoutTests/fast/css/positional-selector-style-sharing.html	2021-01-25 22:10:32 UTC (rev 271816)
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+<style>
+*:hover {
+    transition: all 0s ease;
+}
+td {
+    vertical-align: baseline;
+}
+.nth-child td:nth-child(3n+1) {
+    color: red;
+}
+.first-of-type td:first-of-type {
+    color: red;
+}
+.nth-of-type td:nth-of-type(1) {
+    color: red;
+}
+.first-child td:first-child {
+    color: red;
+}
+</style>
+</head>
+<body>
+<table>
+<tr class="nth-child">
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td class="hover-target">Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+</tr>
+<tr class="first-of-type">
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td class="hover-target">Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+</tr>
+<tr class="nth-of-type">
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td class="hover-target">Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+</tr>
+<tr class="first-child">
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td class="hover-target">Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+<td>Lorem ipsum dolor sit, amet consectetur adipisicing elit</td>
+</tr>
+</table>
+<script>
+
+async function test() {
+    if (!window.testRunner)
+        return;
+
+    await new Promise(requestAnimationFrame);
+
+    for (hoverTarget of document.querySelectorAll(".hover-target")) {
+        eventSender.mouseMoveTo(hoverTarget.offsetLeft + 10, hoverTarget.offsetTop + 10);
+        await new Promise(requestAnimationFrame);
+    }
+}
+test();
+</script>
+</body>
+</html>

Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (271815 => 271816)


--- branches/safari-611-branch/Source/WebCore/ChangeLog	2021-01-25 22:09:52 UTC (rev 271815)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog	2021-01-25 22:10:32 UTC (rev 271816)
@@ -1,3 +1,61 @@
+2021-01-25  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r271367. rdar://problem/73469641
+
+    REGRESSION (r258321): CSS rules using :first-of-type are applied to any/all siblings in a group under certain circumstances
+    https://bugs.webkit.org/show_bug.cgi?id=218256
+    <rdar://problem/70749584>
+    
+    Reviewed by Simon Fraser.
+    
+    Source/WebCore:
+    
+    More accurate invalidation for :hover resulted in smaller style updates that revealed a bug in the way we
+    mark style non-shareable. We reset style relation bits when resolving the parent but may fail to set them again if we
+    don't re-resolve all children.
+    
+    Test case by Eben Packwood.
+    
+    Test: fast/css/positional-selector-style-sharing.html
+    
+    * style/StyleRelations.cpp:
+    (WebCore::Style::commitRelationsToRenderStyle):
+    
+    Just mark all styles affected by relations non-shareable. This is achieved via various bit tests but there
+    is no reason not to set the simplest no-sharing bit. Since this forces real style resolution the parent
+    bits will also get properly reset.
+    
+    LayoutTests:
+    
+    * fast/css/positional-selector-style-sharing-expected.html: Added.
+    * fast/css/positional-selector-style-sharing.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271367 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-11  Antti Koivisto  <an...@apple.com>
+
+            REGRESSION (r258321): CSS rules using :first-of-type are applied to any/all siblings in a group under certain circumstances
+            https://bugs.webkit.org/show_bug.cgi?id=218256
+            <rdar://problem/70749584>
+
+            Reviewed by Simon Fraser.
+
+            More accurate invalidation for :hover resulted in smaller style updates that revealed a bug in the way we
+            mark style non-shareable. We reset style relation bits when resolving the parent but may fail to set them again if we
+            don't re-resolve all children.
+
+            Test case by Eben Packwood.
+
+            Test: fast/css/positional-selector-style-sharing.html
+
+            * style/StyleRelations.cpp:
+            (WebCore::Style::commitRelationsToRenderStyle):
+
+            Just mark all styles affected by relations non-shareable. This is achieved via various bit tests but there
+            is no reason not to set the simplest no-sharing bit. Since this forces real style resolution the parent
+            bits will also get properly reset.
+
 2021-01-11  Russell Epstein  <repst...@apple.com>
 
         Cherry-pick r271364. rdar://problem/73001152

Modified: branches/safari-611-branch/Source/WebCore/style/StyleRelations.cpp (271815 => 271816)


--- branches/safari-611-branch/Source/WebCore/style/StyleRelations.cpp	2021-01-25 22:09:52 UTC (rev 271815)
+++ branches/safari-611-branch/Source/WebCore/style/StyleRelations.cpp	2021-01-25 22:10:32 UTC (rev 271816)
@@ -36,6 +36,9 @@
 
 std::unique_ptr<Relations> commitRelationsToRenderStyle(RenderStyle& style, const Element& element, const Relations& relations)
 {
+    if (!relations.isEmpty())
+        style.setUnique();
+
     std::unique_ptr<Relations> remainingRelations;
 
     auto appendStyleRelation = [&remainingRelations] (const Relation& relation) {
@@ -61,7 +64,6 @@
             style.setLastChildState();
             break;
         case Relation::Unique:
-            style.setUnique();
             break;
         case Relation::AffectedByPreviousSibling:
         case Relation::DescendantsAffectedByPreviousSibling:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to