Title: [290942] branches/safari-613-branch
Revision
290942
Author
[email protected]
Date
2022-03-07 14:10:40 -0800 (Mon, 07 Mar 2022)

Log Message

Cherry-pick r290559. rdar://problem/89510628

    Optimize StyleSharingResolver inert checks
    https://bugs.webkit.org/show_bug.cgi?id=237235

    Reviewed by Youenn Fablet.

    Source/WebCore:

    inert is an boolean attribute, the only thing that matters for the StyleAdjuster
    inertness adjustment is the presence of the attribute, not its value. E.g.
    `inert=false` is the same as `inert=inert` or `inert=true`.

    This saves getting and comparing values for those attributes, and also allows
    `inert=inert` and `inert=true` or `inert=false` to start sharing style.

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

    LayoutTests:

    Add small test that style sharing is not wrongly applied.

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

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (290941 => 290942)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-03-07 22:10:35 UTC (rev 290941)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-03-07 22:10:40 UTC (rev 290942)
@@ -1,5 +1,48 @@
 2022-03-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r290559. rdar://problem/89510628
+
+    Optimize StyleSharingResolver inert checks
+    https://bugs.webkit.org/show_bug.cgi?id=237235
+    
+    Reviewed by Youenn Fablet.
+    
+    Source/WebCore:
+    
+    inert is an boolean attribute, the only thing that matters for the StyleAdjuster
+    inertness adjustment is the presence of the attribute, not its value. E.g.
+    `inert=false` is the same as `inert=inert` or `inert=true`.
+    
+    This saves getting and comparing values for those attributes, and also allows
+    `inert=inert` and `inert=true` or `inert=false` to start sharing style.
+    
+    * style/StyleSharingResolver.cpp:
+    (WebCore::Style::SharingResolver::canShareStyleWithElement const):
+    
+    LayoutTests:
+    
+    Add small test that style sharing is not wrongly applied.
+    
+    * fast/css/inert-style-sharing-expected.html: Added.
+    * fast/css/inert-style-sharing.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-27  Tim Nguyen  <[email protected]>
+
+            Optimize StyleSharingResolver inert checks
+            https://bugs.webkit.org/show_bug.cgi?id=237235
+
+            Reviewed by Youenn Fablet.
+
+            Add small test that style sharing is not wrongly applied.
+
+            * fast/css/inert-style-sharing-expected.html: Added.
+            * fast/css/inert-style-sharing.html: Added.
+
+2022-03-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r290554. rdar://problem/83757966
 
     Remove Node::deprecatedIsInert

Added: branches/safari-613-branch/LayoutTests/fast/css/inert-style-sharing-expected.html (0 => 290942)


--- branches/safari-613-branch/LayoutTests/fast/css/inert-style-sharing-expected.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/fast/css/inert-style-sharing-expected.html	2022-03-07 22:10:40 UTC (rev 290942)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<div>node</div>
+<div>inert node</div>
+<div>inert node</div>
+<div>inert node</div>
+<div style="background: blue">inert node</div>
+
+<div id="result">node</div>

Added: branches/safari-613-branch/LayoutTests/fast/css/inert-style-sharing.html (0 => 290942)


--- branches/safari-613-branch/LayoutTests/fast/css/inert-style-sharing.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/fast/css/inert-style-sharing.html	2022-03-07 22:10:40 UTC (rev 290942)
@@ -0,0 +1,21 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ InertAttributeEnabled=true ] -->
+<div>node</div>
+<div inert>inert node</div>
+<div inert>inert node</div>
+<div inert>inert node</div>
+<div inert="foo">inert node</div>
+
+<div id="result"></div>
+
+<style>
+div[inert="foo"] {
+    background: blue;
+}
+</style>
+
+<script>
+// Test that inertness is properly applied, by checking only the non-inert node is selected
+document.execCommand('SelectAll');
+result.textContent = window.getSelection().toString().trim();
+window.getSelection().removeAllRanges();
+</script>

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (290941 => 290942)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-07 22:10:35 UTC (rev 290941)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-07 22:10:40 UTC (rev 290942)
@@ -1,5 +1,53 @@
 2022-03-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r290559. rdar://problem/89510628
+
+    Optimize StyleSharingResolver inert checks
+    https://bugs.webkit.org/show_bug.cgi?id=237235
+    
+    Reviewed by Youenn Fablet.
+    
+    Source/WebCore:
+    
+    inert is an boolean attribute, the only thing that matters for the StyleAdjuster
+    inertness adjustment is the presence of the attribute, not its value. E.g.
+    `inert=false` is the same as `inert=inert` or `inert=true`.
+    
+    This saves getting and comparing values for those attributes, and also allows
+    `inert=inert` and `inert=true` or `inert=false` to start sharing style.
+    
+    * style/StyleSharingResolver.cpp:
+    (WebCore::Style::SharingResolver::canShareStyleWithElement const):
+    
+    LayoutTests:
+    
+    Add small test that style sharing is not wrongly applied.
+    
+    * fast/css/inert-style-sharing-expected.html: Added.
+    * fast/css/inert-style-sharing.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290559 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-02-27  Tim Nguyen  <[email protected]>
+
+            Optimize StyleSharingResolver inert checks
+            https://bugs.webkit.org/show_bug.cgi?id=237235
+
+            Reviewed by Youenn Fablet.
+
+            inert is an boolean attribute, the only thing that matters for the StyleAdjuster
+            inertness adjustment is the presence of the attribute, not its value. E.g.
+            `inert=false` is the same as `inert=inert` or `inert=true`.
+
+            This saves getting and comparing values for those attributes, and also allows
+            `inert=inert` and `inert=true` or `inert=false` to start sharing style.
+
+            * style/StyleSharingResolver.cpp:
+            (WebCore::Style::SharingResolver::canShareStyleWithElement const):
+
+2022-03-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r290554. rdar://problem/83757966
 
     Remove Node::deprecatedIsInert

Modified: branches/safari-613-branch/Source/WebCore/style/StyleSharingResolver.cpp (290941 => 290942)


--- branches/safari-613-branch/Source/WebCore/style/StyleSharingResolver.cpp	2022-03-07 22:10:35 UTC (rev 290941)
+++ branches/safari-613-branch/Source/WebCore/style/StyleSharingResolver.cpp	2022-03-07 22:10:40 UTC (rev 290942)
@@ -281,10 +281,9 @@
         return false;
 
     if (candidateElement.elementData() != element.elementData()) {
+        // Attributes that are optimized as "common attribute selectors".
         if (candidateElement.attributeWithoutSynchronization(HTMLNames::readonlyAttr) != element.attributeWithoutSynchronization(HTMLNames::readonlyAttr))
             return false;
-        if (m_document.settings().inertAttributeEnabled() && candidateElement.attributeWithoutSynchronization(HTMLNames::inertAttr) != element.attributeWithoutSynchronization(HTMLNames::inertAttr))
-            return false;
         if (candidateElement.isSVGElement()) {
             if (candidateElement.getAttribute(HTMLNames::typeAttr) != element.getAttribute(HTMLNames::typeAttr))
                 return false;
@@ -292,6 +291,10 @@
             if (candidateElement.attributeWithoutSynchronization(HTMLNames::typeAttr) != element.attributeWithoutSynchronization(HTMLNames::typeAttr))
                 return false;
         }
+
+        // Elements that may get StyleAdjuster's inert attribute adjustment.
+        if (m_document.settings().inertAttributeEnabled() && candidateElement.hasAttributeWithoutSynchronization(HTMLNames::inertAttr) != element.hasAttributeWithoutSynchronization(HTMLNames::inertAttr))
+            return false;
     }
 
     if (candidateElement.matchesValidPseudoClass() != element.matchesValidPseudoClass())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to