<!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>[201040] trunk/Source/WebCore</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/201040">201040</a></dd>
<dt>Author</dt> <dd>hyatt@apple.com</dd>
<dt>Date</dt> <dd>2016-05-17 14:02:01 -0700 (Tue, 17 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Optimize layer repaint rect computation and painting.
https://bugs.webkit.org/show_bug.cgi?id=157631

Reviewed by Zalan Bujtas.

This patch changes the computation of repaint rects to be for self-painting layers
only. In addition, hasBoxDecorations() has been changed to hasVisibleBoxDecorations(),
and it will no longer be set for transparent borders.

For scrolling layer position updating, visually empty layers have their repaint rects
cleared, and we don't compute repaint rects during the scroll. We would like to do this
all the time, but computeRepaintRects can be called at times when the visually empty
state is stale/unknown. For now we limit it to scrolling, since we know that the layer's
visually empty state is correct.

* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::paintBoxDecorations):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintObject):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlockFlow::layoutRunsAndFloats):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::updateFromStyle):
(WebCore::RenderBox::paintBoxDecorations):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::willBeDestroyed):
(WebCore::RenderBoxModelObject::hasVisibleBoxDecorationStyle):
(WebCore::RenderBoxModelObject::updateFromStyle):
(WebCore::RenderBoxModelObject::hasBoxDecorationStyle): Deleted.
* rendering/RenderBoxModelObject.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::styleWillChange):
(WebCore::mustRepaintBackgroundOrBorder):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::imageChanged):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::styleDidChange):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::RenderLayer):
(WebCore::RenderLayer::updateLayerPositions):
(WebCore::RenderLayer::repaintRectIncludingNonCompositingDescendants):
(WebCore::RenderLayer::computeRepaintRects):
(WebCore::RenderLayer::clearRepaintRects):
(WebCore::RenderLayer::updateLayerPositionsAfterScroll):
(WebCore::RenderLayer::scrollTo):
(WebCore::RenderLayer::calculateClipRects):
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateDrawsContent):
(WebCore::RenderLayerBacking::compositingOpacity):
(WebCore::hasVisibleBoxDecorations):
(WebCore::canCreateTiledImage):
(WebCore::hasVisibleBoxDecorationsOrBackgroundImage):
(WebCore::supportsDirectBoxDecorationsComposition):
(WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
(WebCore::RenderLayerBacking::containsPaintedContent):
(WebCore::RenderLayerBacking::isDirectlyCompositedImage):
(WebCore::hasBoxDecorations): Deleted.
(WebCore::hasBoxDecorationsOrBackgroundImage): Deleted.
* rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::styleDidChange):
* rendering/RenderNamedFlowFragment.cpp:
(WebCore::RenderNamedFlowFragment::setObjectStyleInRegion):
* rendering/RenderObject.h:
(WebCore::RenderObject::hasVisibleBoxDecorations):
(WebCore::RenderObject::setFloating):
(WebCore::RenderObject::setInline):
(WebCore::RenderObject::computeBackgroundIsKnownToBeObscured):
(WebCore::RenderObject::setSelectionStateIfNeeded):
(WebCore::RenderObject::setHasVisibleBoxDecorations):
(WebCore::RenderObject::invalidateBackgroundObscurationStatus):
(WebCore::RenderObject::hasBoxDecorations): Deleted.
(WebCore::RenderObject::setHasBoxDecorations): Deleted.
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::paint):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::paintObject):
(WebCore::RenderTable::paintBoxDecorations):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::styleDidChange):
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::paint):
* rendering/style/BorderData.h:
(WebCore::BorderData::hasBorder):
(WebCore::BorderData::hasVisibleBorder):
(WebCore::BorderData::hasFill):
(WebCore::BorderData::hasBorderRadius):
* rendering/style/RenderStyle.h:
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::layout):
(WebCore::RenderSVGRoot::styleDidChange):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingInlineFlowBoxcpp">trunk/Source/WebCore/rendering/InlineFlowBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockcpp">trunk/Source/WebCore/rendering/RenderBlock.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBlockLineLayoutcpp">trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjectcpp">trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxModelObjecth">trunk/Source/WebCore/rendering/RenderBoxModelObject.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderElementcpp">trunk/Source/WebCore/rendering/RenderElement.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderImagecpp">trunk/Source/WebCore/rendering/RenderImage.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderInlinecpp">trunk/Source/WebCore/rendering/RenderInline.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerh">trunk/Source/WebCore/rendering/RenderLayer.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerBackingcpp">trunk/Source/WebCore/rendering/RenderLayerBacking.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerModelObjectcpp">trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderNamedFlowFragmentcpp">trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderObjecth">trunk/Source/WebCore/rendering/RenderObject.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderReplacedcpp">trunk/Source/WebCore/rendering/RenderReplaced.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTablecpp">trunk/Source/WebCore/rendering/RenderTable.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderTableCellcpp">trunk/Source/WebCore/rendering/RenderTableCell.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderWidgetcpp">trunk/Source/WebCore/rendering/RenderWidget.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleBorderDatah">trunk/Source/WebCore/rendering/style/BorderData.h</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleRenderStyleh">trunk/Source/WebCore/rendering/style/RenderStyle.h</a></li>
<li><a href="#trunkSourceWebCorerenderingsvgRenderSVGRootcpp">trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/ChangeLog        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -1,3 +1,97 @@
</span><ins>+2016-05-17  Dave Hyatt  &lt;hyatt@apple.com&gt;
+
+        Optimize layer repaint rect computation and painting.
+        https://bugs.webkit.org/show_bug.cgi?id=157631
+
+        Reviewed by Zalan Bujtas.
+
+        This patch changes the computation of repaint rects to be for self-painting layers
+        only. In addition, hasBoxDecorations() has been changed to hasVisibleBoxDecorations(),
+        and it will no longer be set for transparent borders.
+
+        For scrolling layer position updating, visually empty layers have their repaint rects
+        cleared, and we don't compute repaint rects during the scroll. We would like to do this
+        all the time, but computeRepaintRects can be called at times when the visually empty
+        state is stale/unknown. For now we limit it to scrolling, since we know that the layer's
+        visually empty state is correct.
+
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::paintBoxDecorations):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paintObject):
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::RenderBlockFlow::layoutRunsAndFloats):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::updateFromStyle):
+        (WebCore::RenderBox::paintBoxDecorations):
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::willBeDestroyed):
+        (WebCore::RenderBoxModelObject::hasVisibleBoxDecorationStyle):
+        (WebCore::RenderBoxModelObject::updateFromStyle):
+        (WebCore::RenderBoxModelObject::hasBoxDecorationStyle): Deleted.
+        * rendering/RenderBoxModelObject.h:
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::styleWillChange):
+        (WebCore::mustRepaintBackgroundOrBorder):
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::imageChanged):
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::styleDidChange):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::RenderLayer):
+        (WebCore::RenderLayer::updateLayerPositions):
+        (WebCore::RenderLayer::repaintRectIncludingNonCompositingDescendants):
+        (WebCore::RenderLayer::computeRepaintRects):
+        (WebCore::RenderLayer::clearRepaintRects):
+        (WebCore::RenderLayer::updateLayerPositionsAfterScroll):
+        (WebCore::RenderLayer::scrollTo):
+        (WebCore::RenderLayer::calculateClipRects):
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateDrawsContent):
+        (WebCore::RenderLayerBacking::compositingOpacity):
+        (WebCore::hasVisibleBoxDecorations):
+        (WebCore::canCreateTiledImage):
+        (WebCore::hasVisibleBoxDecorationsOrBackgroundImage):
+        (WebCore::supportsDirectBoxDecorationsComposition):
+        (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer):
+        (WebCore::RenderLayerBacking::containsPaintedContent):
+        (WebCore::RenderLayerBacking::isDirectlyCompositedImage):
+        (WebCore::hasBoxDecorations): Deleted.
+        (WebCore::hasBoxDecorationsOrBackgroundImage): Deleted.
+        * rendering/RenderLayerModelObject.cpp:
+        (WebCore::RenderLayerModelObject::styleDidChange):
+        * rendering/RenderNamedFlowFragment.cpp:
+        (WebCore::RenderNamedFlowFragment::setObjectStyleInRegion):
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::hasVisibleBoxDecorations):
+        (WebCore::RenderObject::setFloating):
+        (WebCore::RenderObject::setInline):
+        (WebCore::RenderObject::computeBackgroundIsKnownToBeObscured):
+        (WebCore::RenderObject::setSelectionStateIfNeeded):
+        (WebCore::RenderObject::setHasVisibleBoxDecorations):
+        (WebCore::RenderObject::invalidateBackgroundObscurationStatus):
+        (WebCore::RenderObject::hasBoxDecorations): Deleted.
+        (WebCore::RenderObject::setHasBoxDecorations): Deleted.
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::paint):
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::paintObject):
+        (WebCore::RenderTable::paintBoxDecorations):
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::styleDidChange):
+        * rendering/RenderWidget.cpp:
+        (WebCore::RenderWidget::paint):
+        * rendering/style/BorderData.h:
+        (WebCore::BorderData::hasBorder):
+        (WebCore::BorderData::hasVisibleBorder):
+        (WebCore::BorderData::hasFill):
+        (WebCore::BorderData::hasBorderRadius):
+        * rendering/style/RenderStyle.h:
+        * rendering/svg/RenderSVGRoot.cpp:
+        (WebCore::RenderSVGRoot::layout):
+        (WebCore::RenderSVGRoot::styleDidChange):
+
</ins><span class="cx"> 2016-05-17  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WTF should know about Language
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingInlineFlowBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -1366,7 +1366,7 @@
</span><span class="cx"> 
</span><span class="cx">     // You can use p::first-line to specify a background. If so, the root line boxes for
</span><span class="cx">     // a line may actually have to paint a background.
</span><del>-    if (parent() &amp;&amp; !renderer().hasBoxDecorations())
</del><ins>+    if (parent() &amp;&amp; !renderer().hasVisibleBoxDecorations())
</ins><span class="cx">         return;
</span><span class="cx">     const RenderStyle&amp; lineStyle = this-&gt;lineStyle();
</span><span class="cx">     if (!parent() &amp;&amp; (!isFirstLine() || &amp;lineStyle == &amp;renderer().style()))
</span><span class="lines">@@ -1385,7 +1385,7 @@
</span><span class="cx"> 
</span><span class="cx">     // :first-line cannot be used to put borders on a line. Always paint borders with our
</span><span class="cx">     // non-first-line style.
</span><del>-    if (!parent() || !renderer().style().hasBorderDecoration())
</del><ins>+    if (!parent() || !renderer().style().hasVisibleBorderDecoration())
</ins><span class="cx">         return;
</span><span class="cx">     const NinePieceImage&amp; borderImage = renderer().style().borderImage();
</span><span class="cx">     StyleImage* borderImageSource = borderImage.image();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlock.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -1539,7 +1539,7 @@
</span><span class="cx"> 
</span><span class="cx">     // 1. paint background, borders etc
</span><span class="cx">     if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) &amp;&amp; style().visibility() == VISIBLE) {
</span><del>-        if (hasBoxDecorations()) {
</del><ins>+        if (hasVisibleBoxDecorations()) {
</ins><span class="cx">             bool didClipToRegion = false;
</span><span class="cx">             
</span><span class="cx">             RenderNamedFlowFragment* namedFlowFragment = currentRenderNamedFlowFragment();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBlockLineLayoutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -1259,7 +1259,7 @@
</span><span class="cx">     // determineStartPosition first will break fast/repaint/line-flow-with-floats-9.html.
</span><span class="cx">     if (layoutState.isFullLayout() &amp;&amp; hasInlineChild &amp;&amp; !selfNeedsLayout()) {
</span><span class="cx">         setNeedsLayout(MarkOnlyThis); // Mark as needing a full layout to force us to repaint.
</span><del>-        if (!view().doingFullRepaint() &amp;&amp; hasLayer()) {
</del><ins>+        if (!view().doingFullRepaint() &amp;&amp; hasSelfPaintingLayer() &amp;&amp; layer()-&gt;hasComputedRepaintRect()) {
</ins><span class="cx">             // Because we waited until we were already inside layout to discover
</span><span class="cx">             // that the block really needed a full layout, we missed our chance to repaint the layer
</span><span class="cx">             // before layout started.  Luckily the layer has cached the repaint rect for its original
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -494,7 +494,7 @@
</span><span class="cx"> 
</span><span class="cx">     // The root and the RenderView always paint their backgrounds/borders.
</span><span class="cx">     if (isDocElementRenderer || isViewObject)
</span><del>-        setHasBoxDecorations(true);
</del><ins>+        setHasVisibleBoxDecorations(true);
</ins><span class="cx"> 
</span><span class="cx">     setFloating(!isOutOfFlowPositioned() &amp;&amp; styleToUse.isFloating());
</span><span class="cx"> 
</span><span class="lines">@@ -1369,7 +1369,7 @@
</span><span class="cx">     paintBoxShadow(paintInfo, paintRect, style(), Inset);
</span><span class="cx"> 
</span><span class="cx">     // The theme will tell us whether or not we should also paint the CSS border.
</span><del>-    if (bleedAvoidance != BackgroundBleedBackgroundOverBorder &amp;&amp; (!style().hasAppearance() || (borderOrBackgroundPaintingIsNeeded &amp;&amp; theme().paintBorderOnly(*this, paintInfo, paintRect))) &amp;&amp; style().hasBorderDecoration())
</del><ins>+    if (bleedAvoidance != BackgroundBleedBackgroundOverBorder &amp;&amp; (!style().hasAppearance() || (borderOrBackgroundPaintingIsNeeded &amp;&amp; theme().paintBorderOnly(*this, paintInfo, paintRect))) &amp;&amp; style().hasVisibleBorderDecoration())
</ins><span class="cx">         paintBorder(paintInfo, paintRect, style(), bleedAvoidance);
</span><span class="cx"> 
</span><span class="cx">     if (bleedAvoidance == BackgroundBleedUseTransparencyLayer)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -193,9 +193,9 @@
</span><span class="cx">     RenderLayerModelObject::willBeDestroyed();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool RenderBoxModelObject::hasBoxDecorationStyle() const
</del><ins>+bool RenderBoxModelObject::hasVisibleBoxDecorationStyle() const
</ins><span class="cx"> {
</span><del>-    return hasBackground() || style().hasBorderDecoration() || style().hasAppearance() || style().boxShadow();
</del><ins>+    return hasBackground() || style().hasVisibleBorderDecoration() || style().hasAppearance() || style().boxShadow();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void RenderBoxModelObject::updateFromStyle()
</span><span class="lines">@@ -205,7 +205,7 @@
</span><span class="cx">     // Set the appropriate bits for a box model object.  Since all bits are cleared in styleWillChange,
</span><span class="cx">     // we only check for bits that could possibly be set to true.
</span><span class="cx">     const RenderStyle&amp; styleToUse = style();
</span><del>-    setHasBoxDecorations(hasBoxDecorationStyle());
</del><ins>+    setHasVisibleBoxDecorations(hasVisibleBoxDecorationStyle());
</ins><span class="cx">     setInline(styleToUse.isDisplayInlineType());
</span><span class="cx">     setPositionState(styleToUse.position());
</span><span class="cx">     setHorizontalWritingMode(styleToUse.isHorizontalWritingMode());
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxModelObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -245,7 +245,7 @@
</span><span class="cx"> 
</span><span class="cx">     LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&amp;) const;
</span><span class="cx"> 
</span><del>-    bool hasBoxDecorationStyle() const;
</del><ins>+    bool hasVisibleBoxDecorationStyle() const;
</ins><span class="cx">     BackgroundImageGeometry calculateBackgroundImageGeometry(const RenderLayerModelObject* paintContainer, const FillLayer&amp;, const LayoutPoint&amp; paintOffset,
</span><span class="cx">         const LayoutRect&amp; paintRect, RenderElement* = nullptr) const;
</span><span class="cx">     bool borderObscuresBackgroundEdge(const FloatSize&amp; contextScale) const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderElement.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -860,7 +860,7 @@
</span><span class="cx">             clearPositionedState();
</span><span class="cx">         }
</span><span class="cx">         setHorizontalWritingMode(true);
</span><del>-        setHasBoxDecorations(false);
</del><ins>+        setHasVisibleBoxDecorations(false);
</ins><span class="cx">         setHasOverflowClip(false);
</span><span class="cx">         setHasTransformRelatedProperty(false);
</span><span class="cx">         setHasReflection(false);
</span><span class="lines">@@ -1257,7 +1257,7 @@
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     // If we don't have a background/border/mask, then nothing to do.
</span><del>-    if (!renderer.hasBoxDecorations())
</del><ins>+    if (!renderer.hasVisibleBoxDecorations())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     if (mustRepaintFillLayers(renderer, renderer.style().backgroundLayers()))
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderImagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderImage.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderImage.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderImage.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -225,7 +225,7 @@
</span><span class="cx">     if (documentBeingDestroyed() || document().inPageCache())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (hasBoxDecorations() || hasMask() || hasShapeOutside())
</del><ins>+    if (hasVisibleBoxDecorations() || hasMask() || hasShapeOutside())
</ins><span class="cx">         RenderReplaced::imageChanged(newImage, rect);
</span><span class="cx"> 
</span><span class="cx">     if (newImage != imageResource().imagePtr() || !newImage)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderInlinecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderInline.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -204,7 +204,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!alwaysCreateLineBoxes()) {
</span><del>-        bool alwaysCreateLineBoxes = hasSelfPaintingLayer() || hasBoxDecorations() || newStyle.hasPadding() || newStyle.hasMargin() || hasOutline();
</del><ins>+        bool alwaysCreateLineBoxes = hasSelfPaintingLayer() || hasVisibleBoxDecorations() || newStyle.hasBorder() || newStyle.hasPadding() || newStyle.hasMargin() || hasOutline();
</ins><span class="cx">         if (oldStyle &amp;&amp; alwaysCreateLineBoxes) {
</span><span class="cx">             dirtyLineBoxes(false);
</span><span class="cx">             setNeedsLayout();
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -305,6 +305,7 @@
</span><span class="cx">     , m_layerListMutationAllowed(true)
</span><span class="cx"> #endif
</span><span class="cx">     , m_hasFilterInfo(false)
</span><ins>+    , m_hasComputedRepaintRect(false)
</ins><span class="cx"> #if ENABLE(CSS_COMPOSITING)
</span><span class="cx">     , m_blendMode(BlendModeNormal)
</span><span class="cx">     , m_hasNotIsolatedCompositedBlendingDescendants(false)
</span><span class="lines">@@ -509,7 +510,7 @@
</span><span class="cx"> 
</span><span class="cx">         // FIXME: Should ASSERT that value calculated for m_outlineBox using the cached offset is the same
</span><span class="cx">         // as the value not using the cached offset, but we can't due to https://bugs.webkit.org/show_bug.cgi?id=37048
</span><del>-        if (flags &amp; CheckForRepaint) {
</del><ins>+        if ((flags &amp; CheckForRepaint) &amp;&amp; m_hasComputedRepaintRect) {
</ins><span class="cx">             if (!renderer().view().printing()) {
</span><span class="cx">                 bool didRepaint = false;
</span><span class="cx">                 if (m_repaintStatus &amp; NeedsFullRepaint) {
</span><span class="lines">@@ -594,7 +595,7 @@
</span><span class="cx">         if (child-&gt;isComposited())
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        repaintRect.unite(child-&gt;repaintRectIncludingNonCompositingDescendants());
</del><ins>+        repaintRect.uniteIfNonZero(child-&gt;repaintRectIncludingNonCompositingDescendants());
</ins><span class="cx">     }
</span><span class="cx">     return repaintRect;
</span><span class="cx"> }
</span><span class="lines">@@ -785,6 +786,12 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_visibleContentStatusDirty);
</span><span class="cx"> 
</span><ins>+    if (!isSelfPaintingLayer()) {
+        clearRepaintRects();
+        return;
+    }
+    
+    m_hasComputedRepaintRect = true;
</ins><span class="cx">     m_repaintRect = renderer().clippedOverflowRectForRepaint(repaintContainer);
</span><span class="cx">     m_outlineBox = renderer().outlineBoundsForRepaint(repaintContainer, geometryMap);
</span><span class="cx"> }
</span><span class="lines">@@ -803,9 +810,9 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderLayer::clearRepaintRects()
</span><span class="cx"> {
</span><del>-    ASSERT(!m_hasVisibleContent);
</del><span class="cx">     ASSERT(!m_visibleContentStatusDirty);
</span><span class="cx"> 
</span><ins>+    m_hasComputedRepaintRect = false;
</ins><span class="cx">     m_repaintRect = LayoutRect();
</span><span class="cx">     m_outlineBox = LayoutRect();
</span><span class="cx"> }
</span><span class="lines">@@ -845,9 +852,6 @@
</span><span class="cx">     if (positionChanged)
</span><span class="cx">         flags |= HasChangedAncestor;
</span><span class="cx"> 
</span><del>-    if (geometryMap)
-        geometryMap-&gt;pushMappingsToAncestor(this, parent());
-
</del><span class="cx">     if (flags &amp; HasChangedAncestor || flags &amp; HasSeenViewportConstrainedAncestor || flags &amp; IsOverflowScroll)
</span><span class="cx">         clearClipRects();
</span><span class="cx"> 
</span><span class="lines">@@ -856,15 +860,23 @@
</span><span class="cx"> 
</span><span class="cx">     if (renderer().hasOverflowClip())
</span><span class="cx">         flags |= HasSeenAncestorWithOverflowClip;
</span><ins>+    
+    bool shouldComputeRepaintRects = (flags &amp; HasSeenViewportConstrainedAncestor || (flags &amp; IsOverflowScroll &amp;&amp; flags &amp; HasSeenAncestorWithOverflowClip)) &amp;&amp; isSelfPaintingLayer();
+    bool isVisuallyEmpty = !isVisuallyNonEmpty();
+    bool shouldPushAndPopMappings = geometryMap &amp;&amp; ((shouldComputeRepaintRects &amp;&amp; !isVisuallyEmpty) || firstChild());
+    if (shouldPushAndPopMappings)
+        geometryMap-&gt;pushMappingsToAncestor(this, parent());
</ins><span class="cx"> 
</span><del>-    if (flags &amp; HasSeenViewportConstrainedAncestor
-        || (flags &amp; IsOverflowScroll &amp;&amp; flags &amp; HasSeenAncestorWithOverflowClip)) {
-        // FIXME: We could track the repaint container as we walk down the tree.
-        computeRepaintRects(renderer().containerForRepaint(), geometryMap);
</del><ins>+    if (shouldComputeRepaintRects) {
+        // When scrolling, we don't compute repaint rects for visually non-empty layers.
+        if (isVisuallyEmpty)
+            clearRepaintRects();
+        else // FIXME: We could track the repaint container as we walk down the tree.
+            computeRepaintRects(renderer().containerForRepaint(), geometryMap);
</ins><span class="cx">     } else {
</span><span class="cx">         // Check that our cached rects are correct.
</span><del>-        ASSERT(m_repaintRect == renderer().clippedOverflowRectForRepaint(renderer().containerForRepaint()));
-        ASSERT(m_outlineBox == renderer().outlineBoundsForRepaint(renderer().containerForRepaint(), geometryMap));
</del><ins>+        ASSERT(!m_hasComputedRepaintRect || (m_repaintRect == renderer().clippedOverflowRectForRepaint(renderer().containerForRepaint())));
+        ASSERT(!m_hasComputedRepaintRect || m_outlineBox == renderer().outlineBoundsForRepaint(renderer().containerForRepaint()));
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     for (RenderLayer* child = firstChild(); child; child = child-&gt;nextSibling())
</span><span class="lines">@@ -881,7 +893,7 @@
</span><span class="cx">         m_updatingMarqueePosition = oldUpdatingMarqueePosition;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (geometryMap)
</del><ins>+    if (shouldPushAndPopMappings)
</ins><span class="cx">         geometryMap-&gt;popMappingsToAncestor(parent());
</span><span class="cx"> 
</span><span class="cx">     renderer().document().markers().invalidateRectsForAllMarkers();
</span><span class="lines">@@ -2411,8 +2423,10 @@
</span><span class="cx">     RenderLayerModelObject* repaintContainer = renderer().containerForRepaint();
</span><span class="cx">     // The caret rect needs to be invalidated after scrolling
</span><span class="cx">     frame.selection().setCaretRectNeedsUpdate();
</span><ins>+    
+    LayoutRect rectForRepaint = m_hasComputedRepaintRect ? m_repaintRect : renderer().clippedOverflowRectForRepaint(repaintContainer);
</ins><span class="cx"> 
</span><del>-    FloatQuad quadForFakeMouseMoveEvent = FloatQuad(m_repaintRect);
</del><ins>+    FloatQuad quadForFakeMouseMoveEvent = FloatQuad(rectForRepaint);
</ins><span class="cx">     if (repaintContainer)
</span><span class="cx">         quadForFakeMouseMoveEvent = repaintContainer-&gt;localToAbsoluteQuad(quadForFakeMouseMoveEvent);
</span><span class="cx">     frame.eventHandler().dispatchFakeMouseMoveEventSoonInQuad(quadForFakeMouseMoveEvent);
</span><span class="lines">@@ -2423,7 +2437,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Just schedule a full repaint of our object.
</span><span class="cx">     if (requiresRepaint)
</span><del>-        renderer().repaintUsingContainer(repaintContainer, m_repaintRect);
</del><ins>+        renderer().repaintUsingContainer(repaintContainer, rectForRepaint);
</ins><span class="cx"> 
</span><span class="cx">     // Schedule the scroll and scroll-related DOM events.
</span><span class="cx">     if (Element* element = renderer().element()) {
</span><span class="lines">@@ -6500,9 +6514,9 @@
</span><span class="cx">         parent()-&gt;dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool hasBoxDecorationsOrBackground(const RenderElement&amp; renderer)
</del><ins>+static bool hasVisibleBoxDecorationsOrBackground(const RenderElement&amp; renderer)
</ins><span class="cx"> {
</span><del>-    return renderer.hasBoxDecorations() || renderer.style().hasOutline();
</del><ins>+    return renderer.hasVisibleBoxDecorations() || renderer.style().hasOutline();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Constrain the depth and breadth of the search for performance.
</span><span class="lines">@@ -6533,7 +6547,7 @@
</span><span class="cx">         if (is&lt;RenderLayerModelObject&gt;(renderElementChild) &amp;&amp; downcast&lt;RenderLayerModelObject&gt;(renderElementChild).hasSelfPaintingLayer())
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        if (hasBoxDecorationsOrBackground(renderElementChild))
</del><ins>+        if (hasVisibleBoxDecorationsOrBackground(renderElementChild))
</ins><span class="cx">             return true;
</span><span class="cx">         
</span><span class="cx">         if (is&lt;RenderReplaced&gt;(renderElementChild))
</span><span class="lines">@@ -6551,9 +6565,9 @@
</span><span class="cx">     return hasPaintingNonLayerDescendants(renderer(), 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool RenderLayer::hasBoxDecorationsOrBackground() const
</del><ins>+bool RenderLayer::hasVisibleBoxDecorationsOrBackground() const
</ins><span class="cx"> {
</span><del>-    return WebCore::hasBoxDecorationsOrBackground(renderer());
</del><ins>+    return WebCore::hasVisibleBoxDecorationsOrBackground(renderer());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderLayer::hasVisibleBoxDecorations() const
</span><span class="lines">@@ -6561,7 +6575,7 @@
</span><span class="cx">     if (!hasVisibleContent())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    return hasBoxDecorationsOrBackground() || hasOverflowControls();
</del><ins>+    return hasVisibleBoxDecorationsOrBackground() || hasOverflowControls();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderLayer::isVisuallyNonEmpty() const
</span><span class="lines">@@ -6574,7 +6588,7 @@
</span><span class="cx">     if (renderer().isRenderReplaced() || hasOverflowControls())
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    if (hasBoxDecorationsOrBackground())
</del><ins>+    if (hasVisibleBoxDecorationsOrBackground())
</ins><span class="cx">         return true;
</span><span class="cx">     
</span><span class="cx">     if (hasNonEmptyChildRenderers())
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.h (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.h        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderLayer.h        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -386,7 +386,7 @@
</span><span class="cx">     void setHasVisibleContent();
</span><span class="cx">     void dirtyVisibleContentStatus();
</span><span class="cx"> 
</span><del>-    bool hasBoxDecorationsOrBackground() const;
</del><ins>+    bool hasVisibleBoxDecorationsOrBackground() const;
</ins><span class="cx">     bool hasVisibleBoxDecorations() const;
</span><span class="cx">     // Returns true if this layer has visible content (ignoring any child layers).
</span><span class="cx">     bool isVisuallyNonEmpty() const;
</span><span class="lines">@@ -538,7 +538,8 @@
</span><span class="cx">     LayoutRect calculateLayerBounds(const RenderLayer* ancestorLayer, const LayoutSize&amp; offsetFromRoot, CalculateLayerBoundsFlags = DefaultCalculateLayerBoundsFlags) const;
</span><span class="cx">     
</span><span class="cx">     // Return a cached repaint rect, computed relative to the layer renderer's containerForRepaint.
</span><del>-    LayoutRect repaintRect() const { return m_repaintRect; }
</del><ins>+    bool hasComputedRepaintRect() const { return m_hasComputedRepaintRect; }
+    LayoutRect repaintRect() const { ASSERT(hasComputedRepaintRect()); return m_repaintRect; }
</ins><span class="cx">     LayoutRect repaintRectIncludingNonCompositingDescendants() const;
</span><span class="cx"> 
</span><span class="cx">     void setRepaintStatus(RepaintStatus status) { m_repaintStatus = status; }
</span><span class="lines">@@ -1068,6 +1069,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     bool m_hasFilterInfo : 1;
</span><ins>+    
+    bool m_hasComputedRepaintRect : 1;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_COMPOSITING)
</span><span class="cx">     unsigned m_blendMode : 5;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -1229,7 +1229,7 @@
</span><span class="cx">         // m_graphicsLayer only needs backing store if the non-scrolling parts (background, outlines, borders, shadows etc) need to paint.
</span><span class="cx">         // m_scrollingLayer never has backing store.
</span><span class="cx">         // m_scrollingContentsLayer only needs backing store if the scrolled contents need to paint.
</span><del>-        bool hasNonScrollingPaintedContent = m_owningLayer.hasVisibleContent() &amp;&amp; m_owningLayer.hasBoxDecorationsOrBackground();
</del><ins>+        bool hasNonScrollingPaintedContent = m_owningLayer.hasVisibleContent() &amp;&amp; m_owningLayer.hasVisibleBoxDecorationsOrBackground();
</ins><span class="cx">         m_graphicsLayer-&gt;setDrawsContent(hasNonScrollingPaintedContent);
</span><span class="cx"> 
</span><span class="cx">         bool hasScrollingPaintedContent = m_owningLayer.hasVisibleContent() &amp;&amp; (renderer().hasBackground() || paintsChildren());
</span><span class="lines">@@ -1675,9 +1675,9 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // FIXME: Code is duplicated in RenderLayer. Also, we should probably not consider filters a box decoration here.
</span><del>-static inline bool hasBoxDecorations(const RenderStyle&amp; style)
</del><ins>+static inline bool hasVisibleBoxDecorations(const RenderStyle&amp; style)
</ins><span class="cx"> {
</span><del>-    return style.hasBorder() || style.hasBorderRadius() || style.hasOutline() || style.hasAppearance() || style.boxShadow() || style.hasFilter();
</del><ins>+    return style.hasVisibleBorder() || style.hasBorderRadius() || style.hasOutline() || style.hasAppearance() || style.boxShadow() || style.hasFilter();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool canCreateTiledImage(const RenderStyle&amp; style)
</span><span class="lines">@@ -1712,9 +1712,9 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle&amp; style)
</del><ins>+static bool hasVisibleBoxDecorationsOrBackgroundImage(const RenderStyle&amp; style)
</ins><span class="cx"> {
</span><del>-    if (hasBoxDecorations(style))
</del><ins>+    if (hasVisibleBoxDecorations(style))
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     if (!style.hasBackgroundImage())
</span><span class="lines">@@ -1810,7 +1810,7 @@
</span><span class="cx">     if (renderer.hasClip())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (hasBoxDecorationsOrBackgroundImage(style))
</del><ins>+    if (hasVisibleBoxDecorationsOrBackgroundImage(style))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     // FIXME: We can't create a directly composited background if this
</span><span class="lines">@@ -1895,7 +1895,7 @@
</span><span class="cx">         
</span><span class="cx">         // Reject anything that has a border, a border-radius or outline,
</span><span class="cx">         // or is not a simple background (no background, or solid color).
</span><del>-        if (hasBoxDecorationsOrBackgroundImage(rootObject-&gt;style()))
</del><ins>+        if (hasVisibleBoxDecorationsOrBackgroundImage(rootObject-&gt;style()))
</ins><span class="cx">             return false;
</span><span class="cx">         
</span><span class="cx">         // Now look at the body's renderer.
</span><span class="lines">@@ -1906,7 +1906,7 @@
</span><span class="cx">         if (!bodyRenderer)
</span><span class="cx">             return false;
</span><span class="cx">         
</span><del>-        if (hasBoxDecorationsOrBackgroundImage(bodyRenderer-&gt;style()))
</del><ins>+        if (hasVisibleBoxDecorationsOrBackgroundImage(bodyRenderer-&gt;style()))
</ins><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1979,12 +1979,12 @@
</span><span class="cx">     // and set background color on the layer in that case, instead of allocating backing store and painting.
</span><span class="cx"> #if ENABLE(VIDEO)
</span><span class="cx">     if (is&lt;RenderVideo&gt;(renderer()) &amp;&amp; downcast&lt;RenderVideo&gt;(renderer()).shouldDisplayVideo())
</span><del>-        return m_owningLayer.hasBoxDecorationsOrBackground() || (!(downcast&lt;RenderVideo&gt;(renderer()).supportsAcceleratedRendering()) &amp;&amp; m_requiresOwnBackingStore);
</del><ins>+        return m_owningLayer.hasVisibleBoxDecorationsOrBackground() || (!(downcast&lt;RenderVideo&gt;(renderer()).supportsAcceleratedRendering()) &amp;&amp; m_requiresOwnBackingStore);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(WEBGL) || ENABLE(ACCELERATED_2D_CANVAS)
</span><span class="cx">     if (is&lt;RenderHTMLCanvas&gt;(renderer()) &amp;&amp; canvasCompositingStrategy(renderer()) == CanvasAsLayerContents)
</span><del>-        return m_owningLayer.hasBoxDecorationsOrBackground();
</del><ins>+        return m_owningLayer.hasVisibleBoxDecorationsOrBackground();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="lines">@@ -1994,7 +1994,7 @@
</span><span class="cx"> // that require painting. Direct compositing saves backing store.
</span><span class="cx"> bool RenderLayerBacking::isDirectlyCompositedImage() const
</span><span class="cx"> {
</span><del>-    if (!is&lt;RenderImage&gt;(renderer()) || m_owningLayer.hasBoxDecorationsOrBackground() || m_owningLayer.paintsWithFilters() || renderer().hasClip())
</del><ins>+    if (!is&lt;RenderImage&gt;(renderer()) || m_owningLayer.hasVisibleBoxDecorationsOrBackground() || m_owningLayer.paintsWithFilters() || renderer().hasClip())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerModelObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderLayerModelObject.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -161,7 +161,7 @@
</span><span class="cx">         setHasTransformRelatedProperty(false); // All transform-related propeties force layers, so we know we don't have one or the object doesn't support them.
</span><span class="cx">         setHasReflection(false);
</span><span class="cx">         // Repaint the about to be destroyed self-painting layer when style change also triggers repaint.
</span><del>-        if (layer()-&gt;isSelfPaintingLayer() &amp;&amp; layer()-&gt;repaintStatus() == NeedsFullRepaint)
</del><ins>+        if (layer()-&gt;isSelfPaintingLayer() &amp;&amp; layer()-&gt;repaintStatus() == NeedsFullRepaint &amp;&amp; layer()-&gt;hasComputedRepaintRect())
</ins><span class="cx">             repaintUsingContainer(containerForRepaint(), layer()-&gt;repaintRect());
</span><span class="cx">         layer()-&gt;removeOnlyThisLayer(); // calls destroyLayer() which clears m_layer
</span><span class="cx">         if (s_wasFloating &amp;&amp; isFloating())
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderNamedFlowFragmentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -392,13 +392,13 @@
</span><span class="cx">     if (is&lt;RenderElement&gt;(*object))
</span><span class="cx">         downcast&lt;RenderElement&gt;(*object).setStyleInternal(WTFMove(*styleInRegion));
</span><span class="cx"> 
</span><del>-    if (is&lt;RenderBoxModelObject&gt;(*object) &amp;&amp; !object-&gt;hasBoxDecorations()) {
-        bool hasBoxDecorations = is&lt;RenderTableCell&gt;(*object)
</del><ins>+    if (is&lt;RenderBoxModelObject&gt;(*object) &amp;&amp; !object-&gt;hasVisibleBoxDecorations()) {
+        bool hasVisibleBoxDecorations = is&lt;RenderTableCell&gt;(*object)
</ins><span class="cx">         || object-&gt;style().hasBackground()
</span><del>-        || object-&gt;style().hasBorder()
</del><ins>+        || object-&gt;style().hasVisibleBorder()
</ins><span class="cx">         || object-&gt;style().hasAppearance()
</span><span class="cx">         || object-&gt;style().boxShadow();
</span><del>-        object-&gt;setHasBoxDecorations(hasBoxDecorations);
</del><ins>+        object-&gt;setHasVisibleBoxDecorations(hasVisibleBoxDecorations);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     ObjectRegionStyleInfo styleInfo;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderObject.h (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderObject.h        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderObject.h        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -518,7 +518,7 @@
</span><span class="cx">         HasBoxDecorationsAndBackgroundIsKnownToBeObscured,
</span><span class="cx">         HasBoxDecorationsAndBackgroundMayBeVisible,
</span><span class="cx">     };
</span><del>-    bool hasBoxDecorations() const { return m_bitfields.boxDecorationState() != NoBoxDecorations; }
</del><ins>+    bool hasVisibleBoxDecorations() const { return m_bitfields.boxDecorationState() != NoBoxDecorations; }
</ins><span class="cx">     bool backgroundIsKnownToBeObscured(const LayoutPoint&amp; paintOffset);
</span><span class="cx">     bool hasEntirelyFixedBackground() const;
</span><span class="cx"> 
</span><span class="lines">@@ -601,7 +601,7 @@
</span><span class="cx">     void setFloating(bool b = true) { m_bitfields.setFloating(b); }
</span><span class="cx">     void setInline(bool b = true) { m_bitfields.setIsInline(b); }
</span><span class="cx"> 
</span><del>-    void setHasBoxDecorations(bool = true);
</del><ins>+    void setHasVisibleBoxDecorations(bool = true);
</ins><span class="cx">     void invalidateBackgroundObscurationStatus();
</span><span class="cx">     virtual bool computeBackgroundIsKnownToBeObscured(const LayoutPoint&amp;) { return false; }
</span><span class="cx"> 
</span><span class="lines">@@ -1125,20 +1125,20 @@
</span><span class="cx">     setSelectionState(state);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline void RenderObject::setHasBoxDecorations(bool b)
</del><ins>+inline void RenderObject::setHasVisibleBoxDecorations(bool b)
</ins><span class="cx"> {
</span><span class="cx">     if (!b) {
</span><span class="cx">         m_bitfields.setBoxDecorationState(NoBoxDecorations);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    if (hasBoxDecorations())
</del><ins>+    if (hasVisibleBoxDecorations())
</ins><span class="cx">         return;
</span><span class="cx">     m_bitfields.setBoxDecorationState(HasBoxDecorationsAndBackgroundObscurationStatusInvalid);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline void RenderObject::invalidateBackgroundObscurationStatus()
</span><span class="cx"> {
</span><del>-    if (!hasBoxDecorations())
</del><ins>+    if (!hasVisibleBoxDecorations())
</ins><span class="cx">         return;
</span><span class="cx">     m_bitfields.setBoxDecorationState(HasBoxDecorationsAndBackgroundObscurationStatusInvalid);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderReplacedcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderReplaced.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -145,7 +145,7 @@
</span><span class="cx"> #endif
</span><span class="cx">     LayoutPoint adjustedPaintOffset = paintOffset + location();
</span><span class="cx">     
</span><del>-    if (hasBoxDecorations() &amp;&amp; paintInfo.phase == PaintPhaseForeground)
</del><ins>+    if (hasVisibleBoxDecorations() &amp;&amp; paintInfo.phase == PaintPhaseForeground)
</ins><span class="cx">         paintBoxDecorations(paintInfo, adjustedPaintOffset);
</span><span class="cx">     
</span><span class="cx">     if (paintInfo.phase == PaintPhaseMask) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTable.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -689,7 +689,7 @@
</span><span class="cx"> void RenderTable::paintObject(PaintInfo&amp; paintInfo, const LayoutPoint&amp; paintOffset)
</span><span class="cx"> {
</span><span class="cx">     PaintPhase paintPhase = paintInfo.phase;
</span><del>-    if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) &amp;&amp; hasBoxDecorations() &amp;&amp; style().visibility() == VISIBLE)
</del><ins>+    if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) &amp;&amp; hasVisibleBoxDecorations() &amp;&amp; style().visibility() == VISIBLE)
</ins><span class="cx">         paintBoxDecorations(paintInfo, paintOffset);
</span><span class="cx"> 
</span><span class="cx">     if (paintPhase == PaintPhaseMask) {
</span><span class="lines">@@ -768,7 +768,7 @@
</span><span class="cx">     paintBackground(paintInfo, rect, bleedAvoidance);
</span><span class="cx">     paintBoxShadow(paintInfo, rect, style(), Inset);
</span><span class="cx"> 
</span><del>-    if (style().hasBorderDecoration() &amp;&amp; !collapseBorders())
</del><ins>+    if (style().hasVisibleBorderDecoration() &amp;&amp; !collapseBorders())
</ins><span class="cx">         paintBorder(paintInfo, rect, style());
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderTableCellcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTableCell.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -410,7 +410,7 @@
</span><span class="cx">     ASSERT(!row() || row()-&gt;rowIndexWasSet());
</span><span class="cx"> 
</span><span class="cx">     RenderBlockFlow::styleDidChange(diff, oldStyle);
</span><del>-    setHasBoxDecorations(true);
</del><ins>+    setHasVisibleBoxDecorations(true); // FIXME: Optimize this to only set to true if necessary.
</ins><span class="cx"> 
</span><span class="cx">     if (parent() &amp;&amp; section() &amp;&amp; oldStyle &amp;&amp; style().height() != oldStyle-&gt;height())
</span><span class="cx">         section()-&gt;rowLogicalHeightChanged(rowIndex());
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderWidgetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderWidget.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderWidget.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/RenderWidget.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -254,7 +254,7 @@
</span><span class="cx"> 
</span><span class="cx">     LayoutPoint adjustedPaintOffset = paintOffset + location();
</span><span class="cx"> 
</span><del>-    if (hasBoxDecorations() &amp;&amp; (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
</del><ins>+    if (hasVisibleBoxDecorations() &amp;&amp; (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
</ins><span class="cx">         paintBoxDecorations(paintInfo, adjustedPaintOffset);
</span><span class="cx"> 
</span><span class="cx">     if (paintInfo.phase == PaintPhaseMask) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleBorderDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/BorderData.h (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/BorderData.h        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/style/BorderData.h        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -46,12 +46,18 @@
</span><span class="cx">         bool haveImage = m_image.hasImage();
</span><span class="cx">         return m_left.nonZero(!haveImage) || m_right.nonZero(!haveImage) || m_top.nonZero(!haveImage) || m_bottom.nonZero(!haveImage);
</span><span class="cx">     }
</span><ins>+    
+    bool hasVisibleBorder() const
+    {
+        bool haveImage = m_image.hasImage();
+        return m_left.isVisible(!haveImage) || m_right.isVisible(!haveImage) || m_top.isVisible(!haveImage) || m_bottom.isVisible(!haveImage);
+    }
</ins><span class="cx"> 
</span><span class="cx">     bool hasFill() const
</span><span class="cx">     {
</span><span class="cx">         return m_image.hasImage() &amp;&amp; m_image.fill();
</span><span class="cx">     }
</span><del>-
</del><ins>+    
</ins><span class="cx">     bool hasBorderRadius() const
</span><span class="cx">     {
</span><span class="cx">         if (!m_topLeft.width().isZero())
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleRenderStyleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/RenderStyle.h        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -554,7 +554,8 @@
</span><span class="cx">     bool hasMargin() const { return !surround-&gt;margin.isZero(); }
</span><span class="cx">     bool hasBorder() const { return surround-&gt;border.hasBorder(); }
</span><span class="cx">     bool hasBorderFill() const { return surround-&gt;border.hasFill(); }
</span><del>-    bool hasBorderDecoration() const { return hasBorder() || hasBorderFill(); }
</del><ins>+    bool hasVisibleBorderDecoration() const { return hasVisibleBorder() || hasBorderFill(); }
+    bool hasVisibleBorder() const { return surround-&gt;border.hasVisibleBorder(); }
</ins><span class="cx">     bool hasPadding() const { return !surround-&gt;padding.isZero(); }
</span><span class="cx">     bool hasOffset() const { return !surround-&gt;offset.isZero(); }
</span><span class="cx">     bool hasMarginBeforeQuirk() const { return marginBefore().hasQuirk(); }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingsvgRenderSVGRootcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp (201039 => 201040)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp        2016-05-17 20:38:36 UTC (rev 201039)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp        2016-05-17 21:02:01 UTC (rev 201040)
</span><span class="lines">@@ -204,7 +204,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     updateLayerTransform();
</span><del>-    m_hasBoxDecorations = isDocumentElementRenderer() ? hasBoxDecorationStyle() : hasBoxDecorations();
</del><ins>+    m_hasBoxDecorations = isDocumentElementRenderer() ? hasVisibleBoxDecorationStyle() : hasVisibleBoxDecorations();
</ins><span class="cx">     invalidateBackgroundObscurationStatus();
</span><span class="cx"> 
</span><span class="cx">     repainter.repaintAfterLayout();
</span><span class="lines">@@ -305,7 +305,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Box decorations may have appeared/disappeared - recompute status.
</span><span class="cx">     if (diff == StyleDifferenceRepaint)
</span><del>-        m_hasBoxDecorations = hasBoxDecorationStyle();
</del><ins>+        m_hasBoxDecorations = hasVisibleBoxDecorationStyle();
</ins><span class="cx"> 
</span><span class="cx">     RenderReplaced::styleDidChange(diff, oldStyle);
</span><span class="cx">     SVGResourcesCache::clientStyleChanged(*this, diff, style());
</span></span></pre>
</div>
</div>

</body>
</html>