Title: [261513] branches/safari-609-branch
Revision
261513
Author
[email protected]
Date
2020-05-11 17:21:34 -0700 (Mon, 11 May 2020)

Log Message

Cherry-pick r259877. rdar://problem/62978910

    [CSS Shadow Parts] Bad style sharing between sibling elements with different part attributes
    https://bugs.webkit.org/show_bug.cgi?id=210249
    <rdar://problem/61547528>

    Reviewed by Daniel Bates.

    Source/WebCore:

    Style sharing optimization was unconditionally allowed for elements that were styled with part pseudo element.
    This could lead to miscomputed style.

    Test case by Justin Fagnani.

    Test: fast/css/shadow-parts/shadow-part-style-sharing.html

    * style/StyleSharingResolver.cpp:
    (WebCore::Style::SharingResolver::canShareStyleWithElement):

    Only allow style sharing if parts match.

    LayoutTests:

    * fast/css/shadow-parts/shadow-part-style-sharing-expected.html: Added.
    * fast/css/shadow-parts/shadow-part-style-sharing.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-609-branch/LayoutTests/ChangeLog (261512 => 261513)


--- branches/safari-609-branch/LayoutTests/ChangeLog	2020-05-12 00:21:30 UTC (rev 261512)
+++ branches/safari-609-branch/LayoutTests/ChangeLog	2020-05-12 00:21:34 UTC (rev 261513)
@@ -1,5 +1,48 @@
 2020-05-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r259877. rdar://problem/62978910
+
+    [CSS Shadow Parts] Bad style sharing between sibling elements with different part attributes
+    https://bugs.webkit.org/show_bug.cgi?id=210249
+    <rdar://problem/61547528>
+    
+    Reviewed by Daniel Bates.
+    
+    Source/WebCore:
+    
+    Style sharing optimization was unconditionally allowed for elements that were styled with part pseudo element.
+    This could lead to miscomputed style.
+    
+    Test case by Justin Fagnani.
+    
+    Test: fast/css/shadow-parts/shadow-part-style-sharing.html
+    
+    * style/StyleSharingResolver.cpp:
+    (WebCore::Style::SharingResolver::canShareStyleWithElement):
+    
+    Only allow style sharing if parts match.
+    
+    LayoutTests:
+    
+    * fast/css/shadow-parts/shadow-part-style-sharing-expected.html: Added.
+    * fast/css/shadow-parts/shadow-part-style-sharing.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-10  Antti Koivisto  <[email protected]>
+
+            [CSS Shadow Parts] Bad style sharing between sibling elements with different part attributes
+            https://bugs.webkit.org/show_bug.cgi?id=210249
+            <rdar://problem/61547528>
+
+            Reviewed by Daniel Bates.
+
+            * fast/css/shadow-parts/shadow-part-style-sharing-expected.html: Added.
+            * fast/css/shadow-parts/shadow-part-style-sharing.html: Added.
+
+2020-05-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r259141. rdar://problem/62978919
 
     Web Inspector: should also escape the method when Copy as cURL

Added: branches/safari-609-branch/LayoutTests/fast/css/shadow-parts/shadow-part-style-sharing-expected.html (0 => 261513)


--- branches/safari-609-branch/LayoutTests/fast/css/shadow-parts/shadow-part-style-sharing-expected.html	                        (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/css/shadow-parts/shadow-part-style-sharing-expected.html	2020-05-12 00:21:34 UTC (rev 261513)
@@ -0,0 +1,20 @@
+<!doctype html>
+<html>
+  <head>
+    <style>
+      [part=one] {
+        color: blue;
+      }
+      [part=two] {
+        color: red;
+      }
+    </style>
+
+  </head>
+  <body>
+    <div>
+      <span part="one">Should be Blue</span> |
+      <span part="two">Should be Red</span>
+    </div>
+  </body>
+</html>

Added: branches/safari-609-branch/LayoutTests/fast/css/shadow-parts/shadow-part-style-sharing.html (0 => 261513)


--- branches/safari-609-branch/LayoutTests/fast/css/shadow-parts/shadow-part-style-sharing.html	                        (rev 0)
+++ branches/safari-609-branch/LayoutTests/fast/css/shadow-parts/shadow-part-style-sharing.html	2020-05-12 00:21:34 UTC (rev 261513)
@@ -0,0 +1,31 @@
+<!doctype html>
+<html>
+  <head>
+    <style>
+      my-element::part(one) {
+        color: blue;
+      }
+      my-element::part(two) {
+        color: red;
+      }
+    </style>
+    <script>
+      class MyElement extends HTMLElement {
+        constructor() {
+          super();
+          this.attachShadow({mode: 'open'}).innerHTML = `
+            <!-- This div is neccessary to trigger the bug -->
+            <div>
+              <span part="one">Should be Blue</span> |
+              <span part="two">Should be Red</span>
+            </div>
+          `;
+        }
+      }
+      customElements.define('my-element', MyElement);
+    </script>
+  </head>
+  <body>
+    <my-element></my-elemetnt>
+  </body>
+</html>

Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (261512 => 261513)


--- branches/safari-609-branch/Source/WebCore/ChangeLog	2020-05-12 00:21:30 UTC (rev 261512)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog	2020-05-12 00:21:34 UTC (rev 261513)
@@ -1,5 +1,57 @@
 2020-05-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r259877. rdar://problem/62978910
+
+    [CSS Shadow Parts] Bad style sharing between sibling elements with different part attributes
+    https://bugs.webkit.org/show_bug.cgi?id=210249
+    <rdar://problem/61547528>
+    
+    Reviewed by Daniel Bates.
+    
+    Source/WebCore:
+    
+    Style sharing optimization was unconditionally allowed for elements that were styled with part pseudo element.
+    This could lead to miscomputed style.
+    
+    Test case by Justin Fagnani.
+    
+    Test: fast/css/shadow-parts/shadow-part-style-sharing.html
+    
+    * style/StyleSharingResolver.cpp:
+    (WebCore::Style::SharingResolver::canShareStyleWithElement):
+    
+    Only allow style sharing if parts match.
+    
+    LayoutTests:
+    
+    * fast/css/shadow-parts/shadow-part-style-sharing-expected.html: Added.
+    * fast/css/shadow-parts/shadow-part-style-sharing.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@259877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-04-10  Antti Koivisto  <[email protected]>
+
+            [CSS Shadow Parts] Bad style sharing between sibling elements with different part attributes
+            https://bugs.webkit.org/show_bug.cgi?id=210249
+            <rdar://problem/61547528>
+
+            Reviewed by Daniel Bates.
+
+            Style sharing optimization was unconditionally allowed for elements that were styled with part pseudo element.
+            This could lead to miscomputed style.
+
+            Test case by Justin Fagnani.
+
+            Test: fast/css/shadow-parts/shadow-part-style-sharing.html
+
+            * style/StyleSharingResolver.cpp:
+            (WebCore::Style::SharingResolver::canShareStyleWithElement):
+
+            Only allow style sharing if parts match.
+
+2020-05-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r259611. rdar://problem/62978871
 
     Delete line boxes when moving text renderers between block flows

Modified: branches/safari-609-branch/Source/WebCore/style/StyleSharingResolver.cpp (261512 => 261513)


--- branches/safari-609-branch/Source/WebCore/style/StyleSharingResolver.cpp	2020-05-12 00:21:30 UTC (rev 261512)
+++ branches/safari-609-branch/Source/WebCore/style/StyleSharingResolver.cpp	2020-05-12 00:21:34 UTC (rev 261513)
@@ -225,6 +225,8 @@
         return false;
     if (candidateElement.shadowPseudoId() != element.shadowPseudoId())
         return false;
+    if (element.isInShadowTree() && candidateElement.partNames() != element.partNames())
+        return false;
     if (&candidateElement == m_document.cssTarget())
         return false;
     if (!sharingCandidateHasIdenticalStyleAffectingAttributes(context, candidateElement))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to