<!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>[183775] 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/183775">183775</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2015-05-04 15:53:10 -0700 (Mon, 04 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fix updating of tiled backing opaquenss when the page background color changes
https://bugs.webkit.org/show_bug.cgi?id=144600
rdar://problem/20723035

Reviewed by Tim Horton.

Source/WebCore:

RenderLayerCompositor makes the page tiles opaque or not based on the result of
viewHasTransparentBackground(), which consults the view transparency, and
FrameView::documentBackgroundColor(). documentBackgroundColor() in turn is based
on the root and/or body background colors.

We thus need to re-evaluate whether page tiles are opaque when any of these inputs
change, but were failing to do so for the FrameView's baseBackgroundColor, and
the page root background color.

Fix by having FrameView::setBaseBackgroundColor(), and RenderBox::styleDidChange()
(for the root) trigger a compositing update when necessary.

Added setViewBaseBackgroundColor() on Internals for testing.

Test: platform/mac-wk2/tiled-drawing/background-transparency-toggle.html

* page/FrameView.cpp:
(WebCore::FrameView::setTransparent): Use the isViewForDocumentInFrame() helper.
(WebCore::FrameView::setBaseBackgroundColor): Bail if we're not the view for the
frame's document, and trigger a compositing update check if the alpha changed.
(WebCore::FrameView::isViewForDocumentInFrame): Helper that checks to see if
this FrameView is associated with the Document being displayed in the FrameView's
Frame. This returns false when we're setting up a new FrameView (its Frame still
points to the old document, so renderView() returns the RenderView for the Frame's
existing Document).
* page/FrameView.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::styleDidChange): Have the compositor check to see if it needs
to do an update.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged): If the result
of documentBackgroundColor() changed in alpha since the last time, trigger a compositing
update.
* rendering/RenderLayerCompositor.h:
* testing/Internals.cpp:
(WebCore::Internals::setViewBaseBackgroundColor):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

Test that dumps layers with various baseBackgroundColor and body background color
combinations.

* platform/mac-wk2/tiled-drawing/background-transparency-toggle-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/background-transparency-toggle.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="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewh">trunk/Source/WebCore/page/FrameView.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorcpp">trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorh">trunk/Source/WebCore/rendering/RenderLayerCompositor.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalscpp">trunk/Source/WebCore/testing/Internals.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsh">trunk/Source/WebCore/testing/Internals.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalsidl">trunk/Source/WebCore/testing/Internals.idl</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingbackgroundtransparencytoggleexpectedtxt">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/background-transparency-toggle-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingbackgroundtransparencytogglehtml">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/background-transparency-toggle.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (183774 => 183775)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-05-04 22:14:33 UTC (rev 183774)
+++ trunk/LayoutTests/ChangeLog        2015-05-04 22:53:10 UTC (rev 183775)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-05-04  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Fix updating of tiled backing opaquenss when the page background color changes
+        https://bugs.webkit.org/show_bug.cgi?id=144600
+        rdar://problem/20723035
+
+        Reviewed by Tim Horton.
+
+        Test that dumps layers with various baseBackgroundColor and body background color
+        combinations.
+
+        * platform/mac-wk2/tiled-drawing/background-transparency-toggle-expected.txt: Added.
+        * platform/mac-wk2/tiled-drawing/background-transparency-toggle.html: Added.
+
</ins><span class="cx"> 2015-05-04  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix the test after r183758 since shouldNotBe is not supported in the standalone testing.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingbackgroundtransparencytoggleexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/background-transparency-toggle-expected.txt (0 => 183775)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/background-transparency-toggle-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/background-transparency-toggle-expected.txt        2015-05-04 22:53:10 UTC (rev 183775)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+Page tiles should be transparent if the body's background has alpha.
+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 512 x 512)
+      (top left tile 0, 0 tiles grid 2 x 2)
+    )
+  )
+)
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (backgroundColor #00000033)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 512 x 512)
+      (top left tile 0, 0 tiles grid 2 x 2)
+    )
+  )
+)
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 512 x 512)
+      (top left tile 0, 0 tiles grid 2 x 2)
+    )
+  )
+)
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 785.00 648.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 648.00)
+      (contentsOpaque 1)
+      (backgroundColor #CCCCCC)
+      (tile cache coverage 0, 0 785 x 648)
+      (tile size 512 x 512)
+      (top left tile 0, 0 tiles grid 2 x 2)
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingbackgroundtransparencytogglehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/background-transparency-toggle.html (0 => 183775)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/background-transparency-toggle.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/background-transparency-toggle.html        2015-05-04 22:53:10 UTC (rev 183775)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        body {
+            background-color: white;
+        }
+        
+        body.transparent {
+            background-color: rgba(0, 0, 0, 0.2);
+        }
+    &lt;/style&gt;
+    &lt;script&gt;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function documentLoaded()
+        {
+            window.setTimeout(doTest, 0);
+        }
+        
+        function appendLayerDump()
+        {
+            if (window.internals)
+                document.getElementById('output').textContent += window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+        }
+
+        function doTest()
+        {
+            if (window.internals)
+                internals.setViewBaseBackgroundColor('transparent');
+            appendLayerDump();
+
+            document.body.classList.add('transparent');
+            appendLayerDump();
+
+            document.body.classList.remove('transparent');
+            appendLayerDump();
+
+            if (window.internals)
+                internals.setViewBaseBackgroundColor('white');
+
+            document.body.classList.add('transparent');
+            appendLayerDump();
+
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+
+        window.addEventListener('load', documentLoaded, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;Page tiles should be transparent if the body's background has alpha.&lt;/p&gt;
+&lt;div id=&quot;test&quot;&gt;&lt;/div&gt;
+&lt;pre id=&quot;output&quot;&gt;&lt;/pre&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (183774 => 183775)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-04 22:14:33 UTC (rev 183774)
+++ trunk/Source/WebCore/ChangeLog        2015-05-04 22:53:10 UTC (rev 183775)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2015-05-04  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Fix updating of tiled backing opaquenss when the page background color changes
+        https://bugs.webkit.org/show_bug.cgi?id=144600
+        rdar://problem/20723035
+
+        Reviewed by Tim Horton.
+
+        RenderLayerCompositor makes the page tiles opaque or not based on the result of
+        viewHasTransparentBackground(), which consults the view transparency, and
+        FrameView::documentBackgroundColor(). documentBackgroundColor() in turn is based
+        on the root and/or body background colors.
+
+        We thus need to re-evaluate whether page tiles are opaque when any of these inputs
+        change, but were failing to do so for the FrameView's baseBackgroundColor, and
+        the page root background color.
+        
+        Fix by having FrameView::setBaseBackgroundColor(), and RenderBox::styleDidChange()
+        (for the root) trigger a compositing update when necessary.
+
+        Added setViewBaseBackgroundColor() on Internals for testing.
+
+        Test: platform/mac-wk2/tiled-drawing/background-transparency-toggle.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::setTransparent): Use the isViewForDocumentInFrame() helper.
+        (WebCore::FrameView::setBaseBackgroundColor): Bail if we're not the view for the 
+        frame's document, and trigger a compositing update check if the alpha changed.
+        (WebCore::FrameView::isViewForDocumentInFrame): Helper that checks to see if
+        this FrameView is associated with the Document being displayed in the FrameView's
+        Frame. This returns false when we're setting up a new FrameView (its Frame still
+        points to the old document, so renderView() returns the RenderView for the Frame's
+        existing Document).
+        * page/FrameView.h:
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::styleDidChange): Have the compositor check to see if it needs
+        to do an update.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged): If the result
+        of documentBackgroundColor() changed in alpha since the last time, trigger a compositing
+        update.
+        * rendering/RenderLayerCompositor.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::setViewBaseBackgroundColor):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
</ins><span class="cx"> 2015-05-04  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Crash in -[WebCALayerHostWrapper resolveBounds]
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (183774 => 183775)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2015-05-04 22:14:33 UTC (rev 183774)
+++ trunk/Source/WebCore/page/FrameView.cpp        2015-05-04 22:53:10 UTC (rev 183775)
</span><span class="lines">@@ -2678,20 +2678,14 @@
</span><span class="cx"> 
</span><span class="cx">     m_isTransparent = isTransparent;
</span><span class="cx"> 
</span><del>-    RenderView* renderView = this-&gt;renderView();
-    if (!renderView)
-        return;
-
</del><span class="cx">     // setTransparent can be called in the window between FrameView initialization
</span><span class="cx">     // and switching in the new Document; this means that the RenderView that we
</span><span class="cx">     // retrieve is actually attached to the previous Document, which is going away,
</span><span class="cx">     // and must not update compositing layers.
</span><del>-    if (&amp;renderView-&gt;frameView() != this)
</del><ins>+    if (!isViewForDocumentInFrame())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    RenderLayerCompositor&amp; compositor = renderView-&gt;compositor();
-    compositor.setCompositingLayersNeedRebuild();
-    compositor.scheduleCompositingLayerUpdate();
</del><ins>+    renderView()-&gt;compositor().rootBackgroundTransparencyChanged();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool FrameView::hasOpaqueBackground() const
</span><span class="lines">@@ -2706,12 +2700,20 @@
</span><span class="cx"> 
</span><span class="cx"> void FrameView::setBaseBackgroundColor(const Color&amp; backgroundColor)
</span><span class="cx"> {
</span><ins>+    bool hadAlpha = m_baseBackgroundColor.hasAlpha();
+    
</ins><span class="cx">     if (!backgroundColor.isValid())
</span><span class="cx">         m_baseBackgroundColor = Color::white;
</span><span class="cx">     else
</span><span class="cx">         m_baseBackgroundColor = backgroundColor;
</span><span class="cx"> 
</span><ins>+    if (!isViewForDocumentInFrame())
+        return;
+
</ins><span class="cx">     recalculateScrollbarOverlayStyle();
</span><ins>+
+    if (m_baseBackgroundColor.hasAlpha() != hadAlpha)
+        renderView()-&gt;compositor().rootBackgroundTransparencyChanged();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FrameView::updateBackgroundRecursively(const Color&amp; backgroundColor, bool transparent)
</span><span class="lines">@@ -4110,6 +4112,15 @@
</span><span class="cx">     adjustTiledBackingCoverage();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool FrameView::isViewForDocumentInFrame() const
+{
+    RenderView* renderView = this-&gt;renderView();
+    if (!renderView)
+        return false;
+
+    return &amp;renderView-&gt;frameView() == this;
+}
+
</ins><span class="cx"> void FrameView::enableAutoSizeMode(bool enable, const IntSize&amp; minSize, const IntSize&amp; maxSize)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!enable || !minSize.isEmpty());
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.h (183774 => 183775)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.h        2015-05-04 22:14:33 UTC (rev 183774)
+++ trunk/Source/WebCore/page/FrameView.h        2015-05-04 22:53:10 UTC (rev 183775)
</span><span class="lines">@@ -648,6 +648,7 @@
</span><span class="cx">     bool isFrameFlatteningValidForThisFrame() const;
</span><span class="cx"> 
</span><span class="cx">     bool qualifiesAsVisuallyNonEmpty() const;
</span><ins>+    bool isViewForDocumentInFrame() const;
</ins><span class="cx"> 
</span><span class="cx">     AXObjectCache* axObjectCache() const;
</span><span class="cx">     void notifyWidgetsInAllFrames(WidgetNotification);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (183774 => 183775)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2015-05-04 22:14:33 UTC (rev 183774)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2015-05-04 22:53:10 UTC (rev 183775)
</span><span class="lines">@@ -425,6 +425,9 @@
</span><span class="cx">         
</span><span class="cx">         if (rootStyleChanged &amp;&amp; is&lt;RenderBlockFlow&gt;(rootRenderer) &amp;&amp; downcast&lt;RenderBlockFlow&gt;(*rootRenderer).multiColumnFlowThread())
</span><span class="cx">             downcast&lt;RenderBlockFlow&gt;(*rootRenderer).updateStylesForColumnChildren();
</span><ins>+
+        if (diff != StyleDifferenceEqual)
+            view().compositor().rootBackgroundTransparencyChanged();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_SHAPES)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (183774 => 183775)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2015-05-04 22:14:33 UTC (rev 183774)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2015-05-04 22:53:10 UTC (rev 183775)
</span><span class="lines">@@ -3214,6 +3214,17 @@
</span><span class="cx">     return documentBackgroundColor.hasAlpha();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void RenderLayerCompositor::rootBackgroundTransparencyChanged()
+{
+    Color documentBackgroundColor = m_renderView.frameView().documentBackgroundColor();
+    if (m_lastDocumentBackgroundColor.isValid() &amp;&amp; documentBackgroundColor.hasAlpha() == m_lastDocumentBackgroundColor.hasAlpha())
+        return;
+
+    // FIXME: We should do something less expensive than a full layer rebuild.
+    setCompositingLayersNeedRebuild();
+    scheduleCompositingLayerUpdate();
+}
+
</ins><span class="cx"> void RenderLayerCompositor::setRootExtendedBackgroundColor(const Color&amp; color)
</span><span class="cx"> {
</span><span class="cx">     if (color == m_rootExtendedBackgroundColor)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (183774 => 183775)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h        2015-05-04 22:14:33 UTC (rev 183774)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h        2015-05-04 22:53:10 UTC (rev 183775)
</span><span class="lines">@@ -165,6 +165,9 @@
</span><span class="cx">     bool needsFixedRootBackgroundLayer(const RenderLayer&amp;) const;
</span><span class="cx">     GraphicsLayer* fixedRootBackgroundLayer() const;
</span><span class="cx">     
</span><ins>+    // Called after the view transparency, or the document or base background color change.
+    void rootBackgroundTransparencyChanged();
+    
</ins><span class="cx">     // Repaint the appropriate layers when the given RenderLayer starts or stops being composited.
</span><span class="cx">     void repaintOnCompositingChange(RenderLayer&amp;);
</span><span class="cx">     
</span><span class="lines">@@ -554,6 +557,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     Color m_rootExtendedBackgroundColor;
</span><ins>+    Color m_lastDocumentBackgroundColor;
</ins><span class="cx"> 
</span><span class="cx">     HashMap&lt;ScrollingNodeID, RenderLayer*&gt; m_scrollingNodeToLayerMap;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.cpp (183774 => 183775)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.cpp        2015-05-04 22:14:33 UTC (rev 183774)
+++ trunk/Source/WebCore/testing/Internals.cpp        2015-05-04 22:53:10 UTC (rev 183775)
</span><span class="lines">@@ -987,6 +987,17 @@
</span><span class="cx">     frameView-&gt;setConstrainsScrollingToContentEdge(constrainsScrollingToContentEdgeOldValue);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Internals::setViewBaseBackgroundColor(const String&amp; colorValue, ExceptionCode&amp; ec)
+{
+    Document* document = contextDocument();
+    if (!document || !document-&gt;view()) {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+
+    document-&gt;view()-&gt;setBaseBackgroundColor(Color(colorValue));
+}
+
</ins><span class="cx"> void Internals::setPagination(const String&amp; mode, int gap, int pageLength, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     Document* document = contextDocument();
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.h (183774 => 183775)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.h        2015-05-04 22:14:33 UTC (rev 183774)
+++ trunk/Source/WebCore/testing/Internals.h        2015-05-04 22:53:10 UTC (rev 183775)
</span><span class="lines">@@ -157,6 +157,8 @@
</span><span class="cx">     void invalidateFontCache();
</span><span class="cx"> 
</span><span class="cx">     void setScrollViewPosition(long x, long y, ExceptionCode&amp;);
</span><ins>+    void setViewBaseBackgroundColor(const String&amp; colorValue, ExceptionCode&amp;);
+
</ins><span class="cx">     void setPagination(const String&amp; mode, int gap, ExceptionCode&amp; ec) { setPagination(mode, gap, 0, ec); }
</span><span class="cx">     void setPagination(const String&amp; mode, int gap, int pageLength, ExceptionCode&amp;);
</span><span class="cx">     String configurationForViewport(float devicePixelRatio, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight, ExceptionCode&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/Internals.idl (183774 => 183775)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/Internals.idl        2015-05-04 22:14:33 UTC (rev 183774)
+++ trunk/Source/WebCore/testing/Internals.idl        2015-05-04 22:53:10 UTC (rev 183775)
</span><span class="lines">@@ -122,6 +122,8 @@
</span><span class="cx"> 
</span><span class="cx">     [RaisesException] void setScrollViewPosition(long x, long y);
</span><span class="cx"> 
</span><ins>+    [RaisesException] void setViewBaseBackgroundColor(DOMString colorValue);
+
</ins><span class="cx">     [RaisesException] void setPagination(DOMString mode, long gap, optional long pageLength);
</span><span class="cx"> 
</span><span class="cx">     [RaisesException] DOMString configurationForViewport(unrestricted float devicePixelRatio,
</span></span></pre>
</div>
</div>

</body>
</html>