Title: [213440] trunk
Revision
213440
Author
simon.fra...@apple.com
Date
2017-03-05 18:48:20 -0800 (Sun, 05 Mar 2017)

Log Message

Avoid backing store for layers with empty text nodes in a few more cases
https://bugs.webkit.org/show_bug.cgi?id=169185

Reviewed by Dan Bernstein.

Source/WebCore:

In hasPaintingNonLayerDescendants() we can check whether the RenderText's linesBoundingBox()
is empty to avoid backing store in a few more cases. Also use containsOnlyWhitespace() rather
than isAllCollapsibleWhitespace(), because there's no need for backing store for non-selectable
whitespace text.

Covered by existing tests.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects):

LayoutTests:

inline-block-no-backing.html enhanced to have a layer with non-collapsible whitespace (an  ).

Rebaselined other tests.

* compositing/backing/inline-block-no-backing-expected.txt:
* compositing/backing/inline-block-no-backing.html:
* compositing/iframes/page-cache-layer-tree-expected.txt:
* css3/blending/blend-mode-clip-accelerated-blending-canvas-expected.txt:
* platform/ios-simulator-wk2/compositing/backing/inline-block-no-backing-expected.txt:
* platform/ios-simulator-wk2/compositing/iframes/page-cache-layer-tree-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (213439 => 213440)


--- trunk/LayoutTests/ChangeLog	2017-03-06 01:37:53 UTC (rev 213439)
+++ trunk/LayoutTests/ChangeLog	2017-03-06 02:48:20 UTC (rev 213440)
@@ -1,3 +1,21 @@
+2017-03-05  Simon Fraser  <simon.fra...@apple.com>
+
+        Avoid backing store for layers with empty text nodes in a few more cases
+        https://bugs.webkit.org/show_bug.cgi?id=169185
+
+        Reviewed by Dan Bernstein.
+
+        inline-block-no-backing.html enhanced to have a layer with non-collapsible whitespace (an &nbsp;).
+
+        Rebaselined other tests.
+
+        * compositing/backing/inline-block-no-backing-expected.txt:
+        * compositing/backing/inline-block-no-backing.html:
+        * compositing/iframes/page-cache-layer-tree-expected.txt:
+        * css3/blending/blend-mode-clip-accelerated-blending-canvas-expected.txt:
+        * platform/ios-simulator-wk2/compositing/backing/inline-block-no-backing-expected.txt:
+        * platform/ios-simulator-wk2/compositing/iframes/page-cache-layer-tree-expected.txt:
+
 2017-03-05  Chris Dumez  <cdu...@apple.com>
 
         Using <form> in <template> causes following <form> to get swallowed

Modified: trunk/LayoutTests/compositing/backing/inline-block-no-backing-expected.txt (213439 => 213440)


--- trunk/LayoutTests/compositing/backing/inline-block-no-backing-expected.txt	2017-03-06 01:37:53 UTC (rev 213439)
+++ trunk/LayoutTests/compositing/backing/inline-block-no-backing-expected.txt	2017-03-06 02:48:20 UTC (rev 213440)
@@ -1,4 +1,4 @@
-      
 
  (GraphicsLayer
   (anchor 0.00 0.00)
@@ -7,7 +7,7 @@
     (GraphicsLayer
       (bounds 800.00 600.00)
       (contentsOpaque 1)
-      (children 3
+      (children 4
         (GraphicsLayer
           (position 18.00 18.00)
           (bounds 160.00 320.00)
@@ -14,7 +14,7 @@
           (drawsContent 1)
           (children 2
             (GraphicsLayer
-              (position 10.00 10.00)
+              (position 18.00 10.00)
               (bounds 120.00 120.00)
             )
             (GraphicsLayer
@@ -51,6 +51,20 @@
             )
           )
         )
+        (GraphicsLayer
+          (position 570.00 18.00)
+          (bounds 160.00 320.00)
+          (children 2
+            (GraphicsLayer
+              (position 10.00 10.00)
+              (bounds 120.00 120.00)
+            )
+            (GraphicsLayer
+              (position 10.00 154.00)
+              (bounds 120.00 120.00)
+            )
+          )
+        )
       )
     )
   )

Modified: trunk/LayoutTests/compositing/backing/inline-block-no-backing.html (213439 => 213440)


--- trunk/LayoutTests/compositing/backing/inline-block-no-backing.html	2017-03-06 01:37:53 UTC (rev 213439)
+++ trunk/LayoutTests/compositing/backing/inline-block-no-backing.html	2017-03-06 02:48:20 UTC (rev 213440)
@@ -42,6 +42,10 @@
     </script>
 </head>
 <body>
+    <div class="composited container">&nbsp;
+        <img class="composited child" src=""
+        <img class="composited child" src=""
+    </div>
     <div class="composited container">
         <img class="composited child" src=""
         <img class="composited child" src=""

Modified: trunk/LayoutTests/compositing/iframes/page-cache-layer-tree-expected.txt (213439 => 213440)


--- trunk/LayoutTests/compositing/iframes/page-cache-layer-tree-expected.txt	2017-03-06 01:37:53 UTC (rev 213439)
+++ trunk/LayoutTests/compositing/iframes/page-cache-layer-tree-expected.txt	2017-03-06 02:48:20 UTC (rev 213440)
@@ -61,7 +61,6 @@
         (GraphicsLayer
           (position 8.00 274.00)
           (bounds 784.00 224.00)
-          (drawsContent 1)
           (children 1
             (GraphicsLayer
               (position -8.00 -8.00)

Modified: trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-blending-canvas-expected.txt (213439 => 213440)


--- trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-blending-canvas-expected.txt	2017-03-06 01:37:53 UTC (rev 213439)
+++ trunk/LayoutTests/css3/blending/blend-mode-clip-accelerated-blending-canvas-expected.txt	2017-03-06 02:48:20 UTC (rev 213440)
@@ -10,7 +10,6 @@
           (position 8.00 8.00)
           (bounds 100.00 100.00)
           (contentsOpaque 1)
-          (drawsContent 1)
           (children 1
             (GraphicsLayer
               (bounds 100.00 100.00)

Modified: trunk/LayoutTests/platform/ios-simulator-wk2/compositing/backing/inline-block-no-backing-expected.txt (213439 => 213440)


--- trunk/LayoutTests/platform/ios-simulator-wk2/compositing/backing/inline-block-no-backing-expected.txt	2017-03-06 01:37:53 UTC (rev 213439)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/compositing/backing/inline-block-no-backing-expected.txt	2017-03-06 02:48:20 UTC (rev 213440)
@@ -1,4 +1,4 @@
-      
 
  (GraphicsLayer
   (anchor 0.00 0.00)
@@ -7,7 +7,7 @@
     (GraphicsLayer
       (bounds 800.00 600.00)
       (contentsOpaque 1)
-      (children 3
+      (children 4
         (GraphicsLayer
           (position 18.00 18.00)
           (bounds 160.00 320.00)
@@ -14,7 +14,7 @@
           (drawsContent 1)
           (children 2
             (GraphicsLayer
-              (position 10.00 10.00)
+              (position 18.00 10.00)
               (bounds 120.00 120.00)
               (drawsContent 1)
             )
@@ -57,6 +57,22 @@
             )
           )
         )
+        (GraphicsLayer
+          (position 570.00 18.00)
+          (bounds 160.00 320.00)
+          (children 2
+            (GraphicsLayer
+              (position 10.00 10.00)
+              (bounds 120.00 120.00)
+              (drawsContent 1)
+            )
+            (GraphicsLayer
+              (position 10.00 155.00)
+              (bounds 120.00 120.00)
+              (drawsContent 1)
+            )
+          )
+        )
       )
     )
   )

Modified: trunk/LayoutTests/platform/ios-simulator-wk2/compositing/iframes/page-cache-layer-tree-expected.txt (213439 => 213440)


--- trunk/LayoutTests/platform/ios-simulator-wk2/compositing/iframes/page-cache-layer-tree-expected.txt	2017-03-06 01:37:53 UTC (rev 213439)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/compositing/iframes/page-cache-layer-tree-expected.txt	2017-03-06 02:48:20 UTC (rev 213440)
@@ -61,7 +61,6 @@
         (GraphicsLayer
           (position 8.00 277.00)
           (bounds 784.00 225.00)
-          (drawsContent 1)
           (children 1
             (GraphicsLayer
               (position -8.00 -8.00)

Modified: trunk/Source/WebCore/ChangeLog (213439 => 213440)


--- trunk/Source/WebCore/ChangeLog	2017-03-06 01:37:53 UTC (rev 213439)
+++ trunk/Source/WebCore/ChangeLog	2017-03-06 02:48:20 UTC (rev 213440)
@@ -1,3 +1,20 @@
+2017-03-05  Simon Fraser  <simon.fra...@apple.com>
+
+        Avoid backing store for layers with empty text nodes in a few more cases
+        https://bugs.webkit.org/show_bug.cgi?id=169185
+
+        Reviewed by Dan Bernstein.
+
+        In hasPaintingNonLayerDescendants() we can check whether the RenderText's linesBoundingBox()
+        is empty to avoid backing store in a few more cases. Also use containsOnlyWhitespace() rather
+        than isAllCollapsibleWhitespace(), because there's no need for backing store for non-selectable
+        whitespace text.
+
+        Covered by existing tests.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::calculateClipRects):
+
 2017-03-05  Chris Dumez  <cdu...@apple.com>
 
         Drop unnecessary backslash in ResourceResponse::sanitizeSuggestedFilename()

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (213439 => 213440)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2017-03-06 01:37:53 UTC (rev 213439)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2017-03-06 02:48:20 UTC (rev 213440)
@@ -6592,11 +6592,17 @@
     for (const auto& child : childrenOfType<RenderObject>(renderer)) {
         if (++siblingCount > maxSiblingCount)
             return true;
-        
+
         if (is<RenderText>(child)) {
-            bool isSelectable = renderer.style().userSelect() != SELECT_NONE;
-            if (isSelectable || !downcast<RenderText>(child).isAllCollapsibleWhitespace())
+            const auto& renderText = downcast<RenderText>(child);
+            if (renderText.linesBoundingBox().isEmpty())
+                continue;
+
+            if (renderer.style().userSelect() != SELECT_NONE)
                 return true;
+
+            if (!renderText.text()->containsOnlyWhitespace())
+                return true;
         }
         
         if (!is<RenderElement>(child))
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to