Diff
Modified: branches/safari-600.3-branch/LayoutTests/ChangeLog (175273 => 175274)
--- branches/safari-600.3-branch/LayoutTests/ChangeLog 2014-10-28 22:00:39 UTC (rev 175273)
+++ branches/safari-600.3-branch/LayoutTests/ChangeLog 2014-10-28 22:14:45 UTC (rev 175274)
@@ -1,5 +1,21 @@
2014-10-28 Dana Burkart <[email protected]>
+ Merge r173184. <rdar://problem/18428699>
+
+ 2014-09-02 Simon Fraser <[email protected]>
+
+ Avoid backing store allocation with some combinations of replaced elements, masking and visibility:hidden
+ https://bugs.webkit.org/show_bug.cgi?id=136400
+
+ Reviewed by Tim Horton.
+
+ * compositing/backing/masked-child-no-backing-expected.txt: Added.
+ * compositing/backing/masked-child-no-backing.html: Added.
+ * compositing/backing/replaced-child-no-backing-expected.txt: Added.
+ * compositing/backing/replaced-child-no-backing.html: Added.
+
+2014-10-28 Dana Burkart <[email protected]>
+
Merge r173181
2014-09-02 Simon Fraser <[email protected]>
Copied: branches/safari-600.3-branch/LayoutTests/compositing/backing/masked-child-no-backing-expected.txt (from rev 173184, trunk/LayoutTests/compositing/backing/masked-child-no-backing-expected.txt) (0 => 175274)
--- branches/safari-600.3-branch/LayoutTests/compositing/backing/masked-child-no-backing-expected.txt (rev 0)
+++ branches/safari-600.3-branch/LayoutTests/compositing/backing/masked-child-no-backing-expected.txt 2014-10-28 22:14:45 UTC (rev 175274)
@@ -0,0 +1,22 @@
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 2
+ (GraphicsLayer
+ (position 18.00 10.00)
+ (bounds 200.00 200.00)
+ )
+ (GraphicsLayer
+ (position 18.00 220.00)
+ (bounds 200.00 200.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+)
+
Copied: branches/safari-600.3-branch/LayoutTests/compositing/backing/masked-child-no-backing.html (from rev 173184, trunk/LayoutTests/compositing/backing/masked-child-no-backing.html) (0 => 175274)
--- branches/safari-600.3-branch/LayoutTests/compositing/backing/masked-child-no-backing.html (rev 0)
+++ branches/safari-600.3-branch/LayoutTests/compositing/backing/masked-child-no-backing.html 2014-10-28 22:14:45 UTC (rev 175274)
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .container {
+ position: relative;
+ height: 200px;
+ width: 200px;
+ margin: 10px;
+ }
+
+ .composited {
+ -webkit-transform: translateZ(0);
+ }
+
+ .child {
+ position: absolute;
+ height: 180px;
+ width: 180px;
+ margin: 10px;
+ }
+
+ .masked {
+ -webkit-mask: linear-gradient(black, transparent);
+ }
+
+ .grandchild {
+ position: absolute;
+ top: 10px;
+ left: 10px;
+ width: 150px;
+ height: 150px;
+ background-color: silver;
+ }
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ function dumpLayers()
+ {
+ var layersResult = document.getElementById('layers');
+ if (window.testRunner)
+ layersResult.innerText = window.internals.layerTreeAsText(document);
+ }
+
+ window.addEventListener('load', dumpLayers, false)
+ </script>
+</head>
+<body>
+ <div class="composited container"><div class="masked child"></div></div>
+ <div class="composited container"><div class="masked child"><div class="grandchild"></div></div></div>
+
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+</html>
Copied: branches/safari-600.3-branch/LayoutTests/compositing/backing/replaced-child-no-backing-expected.txt (from rev 173184, trunk/LayoutTests/compositing/backing/replaced-child-no-backing-expected.txt) (0 => 175274)
--- branches/safari-600.3-branch/LayoutTests/compositing/backing/replaced-child-no-backing-expected.txt (rev 0)
+++ branches/safari-600.3-branch/LayoutTests/compositing/backing/replaced-child-no-backing-expected.txt 2014-10-28 22:14:45 UTC (rev 175274)
@@ -0,0 +1,25 @@
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 2
+ (GraphicsLayer
+ (position 18.00 10.00)
+ (anchor 0.50 0.49)
+ (bounds 200.00 204.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 18.00 220.00)
+ (anchor 0.50 0.49)
+ (bounds 200.00 204.00)
+ )
+ )
+ )
+ )
+)
+
Copied: branches/safari-600.3-branch/LayoutTests/compositing/backing/replaced-child-no-backing.html (from rev 173184, trunk/LayoutTests/compositing/backing/replaced-child-no-backing.html) (0 => 175274)
--- branches/safari-600.3-branch/LayoutTests/compositing/backing/replaced-child-no-backing.html (rev 0)
+++ branches/safari-600.3-branch/LayoutTests/compositing/backing/replaced-child-no-backing.html 2014-10-28 22:14:45 UTC (rev 175274)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .container {
+ height: 200px;
+ width: 200px;
+ margin: 10px;
+ }
+
+ .composited {
+ -webkit-transform: translateZ(0);
+ }
+
+ .child {
+ position: relative;
+ height: 100%;
+ width: 100%;
+ }
+
+ .grandchild {
+ position: absolute;
+ top: 10px;
+ left: 10px;
+ width: 150px;
+ height: 150px;
+ background-color: silver;
+ }
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ function dumpLayers()
+ {
+ var layersResult = document.getElementById('layers');
+ if (window.testRunner)
+ layersResult.innerText = window.internals.layerTreeAsText(document);
+ }
+
+ window.addEventListener('load', dumpLayers, false)
+ </script>
+</head>
+<body>
+ <div class="composited container"><img class="child" src=""
+ <div class="composited container"><img class="child" src="" style="visibility:hidden"></div>
+
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+</html>
Modified: branches/safari-600.3-branch/Source/WebCore/ChangeLog (175273 => 175274)
--- branches/safari-600.3-branch/Source/WebCore/ChangeLog 2014-10-28 22:00:39 UTC (rev 175273)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog 2014-10-28 22:14:45 UTC (rev 175274)
@@ -1,5 +1,31 @@
2014-10-28 Dana Burkart <[email protected]>
+ Merge r173184. <rdar://problem/18428699>
+
+ 2014-09-02 Simon Fraser <[email protected]>
+
+ Avoid backing store allocation with some combinations of replaced elements, masking and visibility:hidden
+ https://bugs.webkit.org/show_bug.cgi?id=136400
+
+ Reviewed by Tim Horton.
+
+ RenderLayer::isVisuallyNonEmpty() would return true for replaced elements (e.g. images)
+ with visibility:hidden, and for layers with a mask, and both would cause additional
+ backing store in some cases.
+
+ We can move the hasVisibleContent() to the top of the function, since visibility:hidden
+ will always hide any content of this layer. The hasMask() check can also be removed;
+ a mask can only mask content that is already visible; it never contributes additional
+ pixels.
+
+ Tests: compositing/backing/masked-child-no-backing.html
+ compositing/backing/replaced-child-no-backing.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::calculateClipRects):
+
+2014-10-28 Dana Burkart <[email protected]>
+
Merge r173181
2014-09-02 Simon Fraser <[email protected]>
Modified: branches/safari-600.3-branch/Source/WebCore/rendering/RenderLayer.cpp (175273 => 175274)
--- branches/safari-600.3-branch/Source/WebCore/rendering/RenderLayer.cpp 2014-10-28 22:00:39 UTC (rev 175273)
+++ branches/safari-600.3-branch/Source/WebCore/rendering/RenderLayer.cpp 2014-10-28 22:14:45 UTC (rev 175274)
@@ -6242,11 +6242,13 @@
{
ASSERT(!m_visibleDescendantStatusDirty);
- if (hasVisibleContent() && hasNonEmptyChildRenderers())
+ if (!hasVisibleContent())
+ return false;
+
+ if (hasNonEmptyChildRenderers())
return true;
- // FIXME: a visibility:hidden replaced element should return false here.
- if (renderer().isReplaced() || renderer().hasMask())
+ if (renderer().isReplaced())
return true;
if (hasVisibleBoxDecorations())