<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[173293] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/173293">173293</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-09-04 17:23:05 -0700 (Thu, 04 Sep 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Improve the logic for compositing backing store avoidance
https://bugs.webkit.org/show_bug.cgi?id=136556
Reviewed by Dean Jackson.
Source/WebCore:
Avoid backing store allocation in more cases by improving the logic that detects
whether a RenderLayer has any painted, non-layer descendent renderers.
Rename RenderLayer::hasNonEmptyChildRenderers() to hasPaintingNonLayerDescendants(),
and make it recur 3 levels deep, walking child lists of up to 20 siblings looking
for renderers that paint anything. Any renderer with box decorations paints;
replaced elements paint, and non-whitespace text nodes paint. We can avoid
making backing store when whitespace nodes are present only when user-select is none,
since we have to ensure that there's backing store to paint the selection into.
Tests: compositing/backing/inline-block-no-backing.html
compositing/backing/whitespace-nodes-no-backing.html
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hasNonEmptyChildRenderers): Call the recursive hasPaintingNonLayerDescendants().
(WebCore::RenderLayer::hasBoxDecorationsOrBackground):
(WebCore::RenderLayer::isVisuallyNonEmpty): Do the cheap tests first. Use isRenderReplaced()
rather than isReplaced(), since the latter includes inline-blocks.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration): Don't run the isSimpleContainerCompositingLayer()
logic in the root layer, since it always wants backing store.
(WebCore::RenderLayerBacking::updateAfterDescendents): Ditto.
(WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer): isReplaced() includes
inline-block, so use isRenderReplaced() instead.
LayoutTests:
Tests that dump the layer tree (showing backing store) for various combinations
of child renderers and whitespace.
* compositing/backing/inline-block-no-backing-expected.txt: Added.
* compositing/backing/inline-block-no-backing.html: Added.
* compositing/backing/whitespace-nodes-no-backing-expected.txt: Added.
* compositing/backing/whitespace-nodes-no-backing.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerBackingcpp">trunk/Source/WebCore/rendering/RenderLayerBacking.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscompositingbackinginlineblocknobackingexpectedtxt">trunk/LayoutTests/compositing/backing/inline-block-no-backing-expected.txt</a></li>
<li><a href="#trunkLayoutTestscompositingbackinginlineblocknobackinghtml">trunk/LayoutTests/compositing/backing/inline-block-no-backing.html</a></li>
<li><a href="#trunkLayoutTestscompositingbackingwhitespacenodesnobackingexpectedtxt">trunk/LayoutTests/compositing/backing/whitespace-nodes-no-backing-expected.txt</a></li>
<li><a href="#trunkLayoutTestscompositingbackingwhitespacenodesnobackinghtml">trunk/LayoutTests/compositing/backing/whitespace-nodes-no-backing.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (173292 => 173293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-09-05 00:09:39 UTC (rev 173292)
+++ trunk/LayoutTests/ChangeLog        2014-09-05 00:23:05 UTC (rev 173293)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-09-04 Simon Fraser <simon.fraser@apple.com>
+
+ Improve the logic for compositing backing store avoidance
+ https://bugs.webkit.org/show_bug.cgi?id=136556
+
+ Reviewed by Dean Jackson.
+
+ Tests that dump the layer tree (showing backing store) for various combinations
+ of child renderers and whitespace.
+
+ * compositing/backing/inline-block-no-backing-expected.txt: Added.
+ * compositing/backing/inline-block-no-backing.html: Added.
+ * compositing/backing/whitespace-nodes-no-backing-expected.txt: Added.
+ * compositing/backing/whitespace-nodes-no-backing.html: Added.
+
</ins><span class="cx"> 2014-09-04 Beth Dakin <bdakin@apple.com>
</span><span class="cx">
</span><span class="cx"> Another speculative fix for the bots.
</span></span></pre></div>
<a id="trunkLayoutTestscompositingbackinginlineblocknobackingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/backing/inline-block-no-backing-expected.txt (0 => 173293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/backing/inline-block-no-backing-expected.txt         (rev 0)
+++ trunk/LayoutTests/compositing/backing/inline-block-no-backing-expected.txt        2014-09-05 00:23:05 UTC (rev 173293)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+
+
+ (GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 3
+ (GraphicsLayer
+ (position 18.00 18.00)
+ (bounds 160.00 320.00)
+ (drawsContent 1)
+ (children 2
+ (GraphicsLayer
+ (position 10.00 10.00)
+ (bounds 120.00 120.00)
+ )
+ (GraphicsLayer
+ (position 10.00 154.00)
+ (bounds 120.00 120.00)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 202.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)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 386.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)
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingbackinginlineblocknobackinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/backing/inline-block-no-backing.html (0 => 173293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/backing/inline-block-no-backing.html         (rev 0)
+++ trunk/LayoutTests/compositing/backing/inline-block-no-backing.html        2014-09-05 00:23:05 UTC (rev 173293)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .container {
+ display: inline-block;
+ height: 320px;
+ width: 160px;
+ margin: 10px;
+ }
+
+ .composited {
+ -webkit-transform: translateZ(0);
+ }
+
+ .child {
+ position: relative;
+ height: 120px;
+ width: 120px;
+ margin: 10px;
+ }
+
+ .box {
+ height: 100px;
+ width: 100px;
+ background-color: blue;
+ }
+ </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="composited child" src="../resources/apple.jpg">
+ <img class="composited child" src="../resources/apple.jpg">
+ </div>
+
+ <div class="composited container" style="-webkit-user-select: none;">
+ <img class="composited child" src="../resources/apple.jpg">
+ <img class="composited child" src="../resources/apple.jpg">
+ </div>
+
+ <div class="composited container" style="-webkit-user-select: none;">
+ <img class="composited child" src="../resources/apple.jpg">
+ <div style="inline-block">
+ <img class="composited child" src="../resources/apple.jpg">
+ </div>
+ </div>
+
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingbackingwhitespacenodesnobackingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/backing/whitespace-nodes-no-backing-expected.txt (0 => 173293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/backing/whitespace-nodes-no-backing-expected.txt         (rev 0)
+++ trunk/LayoutTests/compositing/backing/whitespace-nodes-no-backing-expected.txt        2014-09-05 00:23:05 UTC (rev 173293)
</span><span class="lines">@@ -0,0 +1,112 @@
</span><ins>+
+
+
+
+
+
+span
+inner span
+
+ (GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 9
+ (GraphicsLayer
+ (position 10.00 8.00)
+ (bounds 780.00 58.00)
+ (drawsContent 1)
+ (children 2
+ (GraphicsLayer
+ (position 2.00 2.00)
+ (bounds 50.00 50.00)
+ )
+ (GraphicsLayer
+ (position 60.00 2.00)
+ (bounds 50.00 50.00)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 10.00 68.00)
+ (bounds 780.00 58.00)
+ (children 2
+ (GraphicsLayer
+ (position 2.00 2.00)
+ (bounds 50.00 50.00)
+ )
+ (GraphicsLayer
+ (position 60.00 2.00)
+ (bounds 50.00 50.00)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 10.00 128.00)
+ (bounds 780.00 58.00)
+ (children 1
+ (GraphicsLayer
+ (position 2.00 2.00)
+ (bounds 50.00 50.00)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 10.00 188.00)
+ (bounds 780.00 58.00)
+ (children 1
+ (GraphicsLayer
+ (position 2.00 2.00)
+ (bounds 50.00 50.00)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 10.00 248.00)
+ (bounds 780.00 78.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (position 2.00 2.00)
+ (bounds 50.00 50.00)
+ )
+ )
+ )
+ (GraphicsLayer
+ (position 10.00 328.00)
+ (bounds 780.00 54.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 10.00 384.00)
+ (bounds 780.00 18.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 10.00 404.00)
+ (bounds 780.00 18.00)
+ (drawsContent 1)
+ )
+ (GraphicsLayer
+ (position 10.00 424.00)
+ (bounds 780.00 78.00)
+ (children 2
+ (GraphicsLayer
+ (position 2.00 2.00)
+ (bounds 50.00 50.00)
+ )
+ (GraphicsLayer
+ (position 0.00 58.00)
+ (bounds 20.00 20.00)
+ (contentsOpaque 1)
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingbackingwhitespacenodesnobackinghtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/backing/whitespace-nodes-no-backing.html (0 => 173293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/backing/whitespace-nodes-no-backing.html         (rev 0)
+++ trunk/LayoutTests/compositing/backing/whitespace-nodes-no-backing.html        2014-09-05 00:23:05 UTC (rev 173293)
</span><span class="lines">@@ -0,0 +1,82 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .container {
+ margin: 2px;
+ }
+
+ .composited {
+ -webkit-transform: translateZ(0);
+ }
+
+ .child {
+ position: relative;
+ margin: 2px;
+ }
+
+ img {
+ height: 50px;
+ width: 50px;
+ }
+ .box {
+ height: 20px;
+ width: 20px;
+ background-color: blue;
+ }
+ </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="composited child" src="../resources/apple.jpg">
+ <img class="composited child" src="../resources/apple.jpg">
+ </div>
+
+ <div class="composited container" style="-webkit-user-select: none;">
+ <img class="composited child" src="../resources/apple.jpg">
+ <img class="composited child" src="../resources/apple.jpg">
+ </div>
+
+ <div class="composited container"><img class="composited child" src="../resources/apple.jpg"></div>
+
+ <div class="composited container" style="-webkit-user-select: none;">
+ <img class="composited child" src="../resources/apple.jpg">
+ </div>
+
+ <div class="composited container">
+ <img class="composited child" src="../resources/apple.jpg"><div class="box"></div>
+ </div>
+
+ <div class="composited container">
+ <img src="../resources/apple.jpg">
+ </div>
+
+ <div class="composited container">
+ <span>span<span>
+ </div>
+
+ <div class="composited container">
+ <span><span>inner span<span></span>
+ </div>
+
+ <div class="composited container" style="-webkit-user-select: none;">
+ <span><img class="composited child" src="../resources/apple.jpg"><div class="composited box"></div><span>
+ </div>
+
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (173292 => 173293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-05 00:09:39 UTC (rev 173292)
+++ trunk/Source/WebCore/ChangeLog        2014-09-05 00:23:05 UTC (rev 173293)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2014-09-04 Simon Fraser <simon.fraser@apple.com>
+
+ Improve the logic for compositing backing store avoidance
+ https://bugs.webkit.org/show_bug.cgi?id=136556
+
+ Reviewed by Dean Jackson.
+
+ Avoid backing store allocation in more cases by improving the logic that detects
+ whether a RenderLayer has any painted, non-layer descendent renderers.
+
+ Rename RenderLayer::hasNonEmptyChildRenderers() to hasPaintingNonLayerDescendants(),
+ and make it recur 3 levels deep, walking child lists of up to 20 siblings looking
+ for renderers that paint anything. Any renderer with box decorations paints;
+ replaced elements paint, and non-whitespace text nodes paint. We can avoid
+ making backing store when whitespace nodes are present only when user-select is none,
+ since we have to ensure that there's backing store to paint the selection into.
+
+ Tests: compositing/backing/inline-block-no-backing.html
+ compositing/backing/whitespace-nodes-no-backing.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::hasNonEmptyChildRenderers): Call the recursive hasPaintingNonLayerDescendants().
+ (WebCore::RenderLayer::hasBoxDecorationsOrBackground):
+ (WebCore::RenderLayer::isVisuallyNonEmpty): Do the cheap tests first. Use isRenderReplaced()
+ rather than isReplaced(), since the latter includes inline-blocks.
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateConfiguration): Don't run the isSimpleContainerCompositingLayer()
+ logic in the root layer, since it always wants backing store.
+ (WebCore::RenderLayerBacking::updateAfterDescendents): Ditto.
+ (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer): isReplaced() includes
+ inline-block, so use isRenderReplaced() instead.
+
</ins><span class="cx"> 2014-09-04 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS] Fix the iOS build after <http://trac.webkit.org/changeset/173258>
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (173292 => 173293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-09-05 00:09:39 UTC (rev 173292)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-09-05 00:23:05 UTC (rev 173293)
</span><span class="lines">@@ -98,6 +98,7 @@
</span><span class="cx"> #include "RenderScrollbarPart.h"
</span><span class="cx"> #include "RenderTableCell.h"
</span><span class="cx"> #include "RenderTableRow.h"
</span><ins>+#include "RenderText.h"
</ins><span class="cx"> #include "RenderTheme.h"
</span><span class="cx"> #include "RenderTreeAsText.h"
</span><span class="cx"> #include "RenderView.h"
</span><span class="lines">@@ -6245,33 +6246,66 @@
</span><span class="cx"> parent()->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool RenderLayer::hasNonEmptyChildRenderers() const
</del><ins>+// FIXME: use RenderObject::hasBoxDecorations(). And why hasBorderRadius() and filter?
+static bool hasBoxDecorations(const RenderStyle& style)
</ins><span class="cx"> {
</span><del>- // Some HTML can cause whitespace text nodes to have renderers, like:
- // <div>
- // <img src=...>
- // </div>
- // so test for 0x0 RenderTexts here
- for (RenderObject* child = renderer().firstChild(); child; child = child->nextSibling()) {
- if (!child->hasLayer()) {
- if (child->isRenderInline() || !child->isBox())
- return true;
</del><ins>+ return style.hasBorder() || style.hasBorderRadius() || style.hasOutline() || style.hasAppearance() || style.boxShadow() || style.hasFilter();
+}
+
+static bool hasBoxDecorationsOrBackground(const RenderElement& renderer)
+{
+ return hasBoxDecorations(renderer.style()) || renderer.hasBackground();
+}
+
+// Constrain the depth and breadth of the search for performance.
+static const int maxDescendentDepth = 3;
+static const int maxSiblingCount = 20;
+
+static bool hasPaintingNonLayerDescendants(const RenderElement& renderer, int depth)
+{
+ if (depth > maxDescendentDepth)
+ return true;
+
+ int siblingCount = 0;
+ for (const auto& child : childrenOfType<RenderObject>(renderer)) {
+ if (++siblingCount > maxSiblingCount)
+ return true;
</ins><span class="cx">
</span><del>- if (toRenderBox(child)->width() > 0 || toRenderBox(child)->height() > 0)
</del><ins>+ if (child.isText()) {
+ bool isSelectable = renderer.style().userSelect() != SELECT_NONE;
+ if (isSelectable || !toRenderText(child).isAllCollapsibleWhitespace())
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><ins>+
+ if (!child.isRenderElement())
+ continue;
+
+ const RenderElement& renderElementChild = toRenderElement(child);
+
+ if (renderElementChild.isRenderLayerModelObject() && toRenderLayerModelObject(renderElementChild).hasSelfPaintingLayer())
+ continue;
+
+ if (hasBoxDecorationsOrBackground(renderElementChild))
+ return true;
+
+ if (renderElementChild.isRenderReplaced())
+ return true;
+
+ if (hasPaintingNonLayerDescendants(renderElementChild, depth + 1))
+ return true;
</ins><span class="cx"> }
</span><ins>+
</ins><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static bool hasBoxDecorations(const RenderStyle& style)
</del><ins>+bool RenderLayer::hasNonEmptyChildRenderers() const
</ins><span class="cx"> {
</span><del>- return style.hasBorder() || style.hasBorderRadius() || style.hasOutline() || style.hasAppearance() || style.boxShadow() || style.hasFilter();
</del><ins>+ return hasPaintingNonLayerDescendants(renderer(), 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderLayer::hasBoxDecorationsOrBackground() const
</span><span class="cx"> {
</span><del>- return hasBoxDecorations(renderer().style()) || renderer().hasBackground();
</del><ins>+ return WebCore::hasBoxDecorationsOrBackground(renderer());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderLayer::hasVisibleBoxDecorations() const
</span><span class="lines">@@ -6289,13 +6323,13 @@
</span><span class="cx"> if (!hasVisibleContent())
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (hasNonEmptyChildRenderers())
</del><ins>+ if (renderer().isRenderReplaced() || hasOverflowControls())
</ins><span class="cx"> return true;
</span><span class="cx">
</span><del>- if (renderer().isReplaced())
</del><ins>+ if (hasBoxDecorationsOrBackground())
</ins><span class="cx"> return true;
</span><del>-
- if (hasVisibleBoxDecorations())
</del><ins>+
+ if (hasNonEmptyChildRenderers())
</ins><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> return false;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (173292 => 173293)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp        2014-09-05 00:09:39 UTC (rev 173292)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp        2014-09-05 00:23:05 UTC (rev 173293)
</span><span class="lines">@@ -562,11 +562,12 @@
</span><span class="cx"> } else
</span><span class="cx"> m_graphicsLayer->setReplicatedByLayer(0);
</span><span class="cx">
</span><del>- bool isSimpleContainer = isSimpleContainerCompositingLayer();
- bool didUpdateContentsRect = false;
- updateDirectlyCompositedContents(isSimpleContainer, didUpdateContentsRect);
-
- updateRootLayerConfiguration();
</del><ins>+ if (!m_owningLayer.isRootLayer()) {
+ bool isSimpleContainer = isSimpleContainerCompositingLayer();
+ bool didUpdateContentsRect = false;
+ updateDirectlyCompositedContents(isSimpleContainer, didUpdateContentsRect);
+ } else
+ updateRootLayerConfiguration();
</ins><span class="cx">
</span><span class="cx"> if (isDirectlyCompositedImage())
</span><span class="cx"> updateImageContents();
</span><span class="lines">@@ -955,11 +956,15 @@
</span><span class="cx">
</span><span class="cx"> void RenderLayerBacking::updateAfterDescendents()
</span><span class="cx"> {
</span><del>- bool didUpdateContentsRect = false;
- bool isSimpleContainer = isSimpleContainerCompositingLayer();
- updateDirectlyCompositedContents(isSimpleContainer, didUpdateContentsRect);
- if (!didUpdateContentsRect && m_graphicsLayer->usesContentsLayer())
- resetContentsRect();
</del><ins>+ bool isSimpleContainer = false;
+ if (!m_owningLayer.isRootLayer()) {
+ bool didUpdateContentsRect = false;
+ // FIXME: this duplicates work we did in updateConfiguration().
+ isSimpleContainer = isSimpleContainerCompositingLayer();
+ updateDirectlyCompositedContents(isSimpleContainer, didUpdateContentsRect);
+ if (!didUpdateContentsRect && m_graphicsLayer->usesContentsLayer())
+ resetContentsRect();
+ }
</ins><span class="cx">
</span><span class="cx"> updateDrawsContent(isSimpleContainer);
</span><span class="cx">
</span><span class="lines">@@ -1692,7 +1697,7 @@
</span><span class="cx"> // This is a useful optimization, because it allows us to avoid allocating backing store.
</span><span class="cx"> bool RenderLayerBacking::isSimpleContainerCompositingLayer() const
</span><span class="cx"> {
</span><del>- if (renderer().isReplaced() && (!isCompositedPlugin(&renderer()) || isRestartedPlugin(&renderer())))
</del><ins>+ if (renderer().isRenderReplaced() && (!isCompositedPlugin(&renderer()) || isRestartedPlugin(&renderer())))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> if (paintsBoxDecorations() || paintsChildren())
</span></span></pre>
</div>
</div>
</body>
</html>