Title: [184371] trunk
- Revision
- 184371
- Author
- simon.fra...@apple.com
- Date
- 2015-05-14 21:43:05 -0700 (Thu, 14 May 2015)
Log Message
REGRESSION (r183794): Garbage tiles when body background switches to fixed
https://bugs.webkit.org/show_bug.cgi?id=145032
rdar://problem/20963679
Reviewed by Dean Jackson.
Source/WebCore:
After r183794 (or possibly an earlier commit), we failed to dynamically update
the configuration of layers that handled fixed background attachment on the root.
This would result in unpainted tiles, and non-fixed-background behavior.
Fix by calling RenderLayerCompositor::rootOrBodyStyleChanged() whenever the
style changes on the root or body renderers, and triggering a compositing update
if the fixedness of the background changes. It calls the existing rootBackgroundTransparencyChanged()
if the color changes.
Test: platform/mac-wk2/tiled-drawing/toggle-to-fixed-background.html
* rendering/RenderBox.cpp:
(WebCore::RenderBox::styleDidChange):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
(WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged):
* rendering/RenderLayerCompositor.h:
LayoutTests:
Test that toggles the attachment of the body background to fixed, then dumps layers.
* platform/mac-wk2/tiled-drawing/toggle-to-fixed-background-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/toggle-to-fixed-background.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (184370 => 184371)
--- trunk/LayoutTests/ChangeLog 2015-05-15 04:39:51 UTC (rev 184370)
+++ trunk/LayoutTests/ChangeLog 2015-05-15 04:43:05 UTC (rev 184371)
@@ -1,3 +1,16 @@
+2015-05-14 Simon Fraser <simon.fra...@apple.com>
+
+ REGRESSION (r183794): Garbage tiles when body background switches to fixed
+ https://bugs.webkit.org/show_bug.cgi?id=145032
+ rdar://problem/20963679
+
+ Reviewed by Dean Jackson.
+
+ Test that toggles the attachment of the body background to fixed, then dumps layers.
+
+ * platform/mac-wk2/tiled-drawing/toggle-to-fixed-background-expected.txt: Added.
+ * platform/mac-wk2/tiled-drawing/toggle-to-fixed-background.html: Added.
+
2015-05-13 Ryosuke Niwa <rn...@webkit.org>
Crash in ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline
Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/toggle-to-fixed-background-expected.txt (0 => 184371)
--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/toggle-to-fixed-background-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/toggle-to-fixed-background-expected.txt 2015-05-15 04:43:05 UTC (rev 184371)
@@ -0,0 +1,31 @@
+Toggling to a fixed background on the body should make a layer for the background.
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 785.00 5024.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 785.00 5024.00)
+ (children 2
+ (GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 785.00 600.00)
+ (contentsOpaque 1)
+ (drawsContent 1)
+ (backgroundColor #FFFFFF)
+ )
+ (GraphicsLayer
+ (bounds 785.00 5024.00)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 50.00)
+ (bounds 100.00 100.00)
+ (contentsOpaque 1)
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/toggle-to-fixed-background.html (0 => 184371)
--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/toggle-to-fixed-background.html (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/toggle-to-fixed-background.html 2015-05-15 04:43:05 UTC (rev 184371)
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ body {
+ background-image: linear-gradient(to top, blue, white);
+ height: 5000px;
+ }
+
+ body.fixed {
+ background-attachment: fixed;
+ }
+
+ #layers {
+ margin: 100px;
+ background-color: silver;
+ }
+
+ .box {
+ height: 100px;
+ width: 100px;
+ background-color: blue;
+ }
+ .composited {
+ -webkit-transform: translateZ(0);
+ }
+ </style>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function documentLoaded()
+ {
+ window.setTimeout(doTest, 0);
+ }
+
+ function doTest()
+ {
+ document.body.classList.add('fixed');
+
+ if (window.internals)
+ document.getElementById('layers').textContent = window.internals.layerTreeAsText(document);
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+ window.addEventListener('load', documentLoaded, false);
+ </script>
+</head>
+<body>
+
+<p>Toggling to a fixed background on the body should make a layer for the background.</p>
+<div class="composited box">
+
+</div>
+<pre id="layers"></pre>
+
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (184370 => 184371)
--- trunk/Source/WebCore/ChangeLog 2015-05-15 04:39:51 UTC (rev 184370)
+++ trunk/Source/WebCore/ChangeLog 2015-05-15 04:43:05 UTC (rev 184371)
@@ -1,3 +1,30 @@
+2015-05-14 Simon Fraser <simon.fra...@apple.com>
+
+ REGRESSION (r183794): Garbage tiles when body background switches to fixed
+ https://bugs.webkit.org/show_bug.cgi?id=145032
+ rdar://problem/20963679
+
+ Reviewed by Dean Jackson.
+
+ After r183794 (or possibly an earlier commit), we failed to dynamically update
+ the configuration of layers that handled fixed background attachment on the root.
+
+ This would result in unpainted tiles, and non-fixed-background behavior.
+
+ Fix by calling RenderLayerCompositor::rootOrBodyStyleChanged() whenever the
+ style changes on the root or body renderers, and triggering a compositing update
+ if the fixedness of the background changes. It calls the existing rootBackgroundTransparencyChanged()
+ if the color changes.
+
+ Test: platform/mac-wk2/tiled-drawing/toggle-to-fixed-background.html
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::styleDidChange):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
+ (WebCore::RenderLayerCompositor::rootBackgroundTransparencyChanged):
+ * rendering/RenderLayerCompositor.h:
+
2015-05-14 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r184359 and r184362.
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (184370 => 184371)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2015-05-15 04:39:51 UTC (rev 184370)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2015-05-15 04:43:05 UTC (rev 184371)
@@ -427,7 +427,7 @@
downcast<RenderBlockFlow>(*rootRenderer).updateStylesForColumnChildren();
if (diff != StyleDifferenceEqual)
- view().compositor().rootBackgroundTransparencyChanged();
+ view().compositor().rootOrBodyStyleChanged(*this, oldStyle);
}
#if ENABLE(CSS_SHAPES)
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (184370 => 184371)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2015-05-15 04:39:51 UTC (rev 184370)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2015-05-15 04:43:05 UTC (rev 184371)
@@ -3166,17 +3166,38 @@
return documentBackgroundColor.hasAlpha();
}
+// We can't rely on getting layerStyleChanged() for a style change that affects the root background, because the style change may
+// be on the body which has no RenderLayer.
+void RenderLayerCompositor::rootOrBodyStyleChanged(RenderElement& renderer, const RenderStyle* oldStyle)
+{
+ if (!inCompositingMode())
+ return;
+
+ Color oldBackgroundColor;
+ if (oldStyle)
+ oldBackgroundColor = oldStyle->visitedDependentColor(CSSPropertyBackgroundColor);
+
+ if (oldBackgroundColor != renderer.style().visitedDependentColor(CSSPropertyBackgroundColor))
+ rootBackgroundTransparencyChanged();
+
+ bool hadFixedBackground = oldStyle && oldStyle->hasEntirelyFixedBackground();
+ if (hadFixedBackground != renderer.hasEntirelyFixedBackground()) {
+ setCompositingLayersNeedRebuild();
+ scheduleCompositingLayerUpdate();
+ }
+}
+
void RenderLayerCompositor::rootBackgroundTransparencyChanged()
{
if (!inCompositingMode())
return;
Color documentBackgroundColor = m_renderView.frameView().documentBackgroundColor();
- if (m_lastDocumentBackgroundColor.isValid() && documentBackgroundColor.hasAlpha() == m_lastDocumentBackgroundColor.hasAlpha())
+ Color lastDocumentBackgroundColor = m_lastDocumentBackgroundColor;
+ m_lastDocumentBackgroundColor = documentBackgroundColor;
+ if (lastDocumentBackgroundColor.isValid() && lastDocumentBackgroundColor.hasAlpha() == documentBackgroundColor.hasAlpha())
return;
- m_lastDocumentBackgroundColor = documentBackgroundColor;
-
// FIXME: We should do something less expensive than a full layer rebuild.
setCompositingLayersNeedRebuild();
scheduleCompositingLayerUpdate();
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (184370 => 184371)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2015-05-15 04:39:51 UTC (rev 184370)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2015-05-15 04:43:05 UTC (rev 184371)
@@ -164,7 +164,9 @@
bool supportsFixedRootBackgroundCompositing() const;
bool needsFixedRootBackgroundLayer(const RenderLayer&) const;
GraphicsLayer* fixedRootBackgroundLayer() const;
-
+
+ void rootOrBodyStyleChanged(RenderElement&, const RenderStyle* oldStyle);
+
// Called after the view transparency, or the document or base background color change.
void rootBackgroundTransparencyChanged();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes