- Revision
- 167529
- Author
- [email protected]
- Date
- 2014-04-18 22:31:39 -0700 (Fri, 18 Apr 2014)
Log Message
Contents of directly composited image layers are sometimes missing
https://bugs.webkit.org/show_bug.cgi?id=131880
Reviewed by Tim Horton.
Source/WebCore:
RenderLayerBacking::updateGraphicsLayerGeometry() tested whether a
GraphicsLayer had a contents layer to determine whether to call code
that updates the contents rect. However, on Mac, we don't make a contents
layer until later at layer flush time. That would result in an empty
contentsRect being set.
Fix by renaming GraphicsLayer::hasContentsLayer() to usesContentsLayer(),
and on Mac consulting the m_contentsLayerPurpose flag, which is set
at the appropriate time.
Test: compositing/images/update-content-rect.html
* platform/ScrollView.cpp:
(WebCore::positionScrollbarLayer):
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::getDebugBorderInfo):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::usesContentsLayer):
(WebCore::GraphicsLayer::hasContentsLayer): Deleted.
* platform/graphics/ca/GraphicsLayerCA.h:
(WebCore::GraphicsLayerCA::hasContentsLayer): Deleted.
* platform/graphics/texmap/GraphicsLayerTextureMapper.h:
(WebCore::GraphicsLayerTextureMapper::usesContentsLayer):
(WebCore::GraphicsLayerTextureMapper::hasContentsLayer): Deleted.
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
(WebCore::RenderLayerBacking::positionOverflowControlsLayers):
(WebCore::RenderLayerBacking::compositingLayerType):
LayoutTests:
Test that that shows the issue in Safari, but not in the test
runner because of timing issues, but maybe it will some day.
* compositing/images/update-content-rect-expected.html: Added.
* compositing/images/update-content-rect.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (167528 => 167529)
--- trunk/LayoutTests/ChangeLog 2014-04-19 05:19:30 UTC (rev 167528)
+++ trunk/LayoutTests/ChangeLog 2014-04-19 05:31:39 UTC (rev 167529)
@@ -1,3 +1,16 @@
+2014-04-18 Simon Fraser <[email protected]>
+
+ Contents of directly composited image layers are sometimes missing
+ https://bugs.webkit.org/show_bug.cgi?id=131880
+
+ Reviewed by Tim Horton.
+
+ Test that that shows the issue in Safari, but not in the test
+ runner because of timing issues, but maybe it will some day.
+
+ * compositing/images/update-content-rect-expected.html: Added.
+ * compositing/images/update-content-rect.html: Added.
+
2014-04-18 Commit Queue <[email protected]>
Unreviewed, rolling out r167527.
Added: trunk/LayoutTests/compositing/images/update-content-rect-expected.html (0 => 167529)
--- trunk/LayoutTests/compositing/images/update-content-rect-expected.html (rev 0)
+++ trunk/LayoutTests/compositing/images/update-content-rect-expected.html 2014-04-19 05:31:39 UTC (rev 167529)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ img {
+ width: 200px;
+ height: 180px;
+ }
+
+ .composited {
+ -webkit-transform: translateZ(0);
+ }
+ </style>
+</head>
+<body>
+ <img id="image" class="composited" src=""
+</body>
+</html>
Added: trunk/LayoutTests/compositing/images/update-content-rect.html (0 => 167529)
--- trunk/LayoutTests/compositing/images/update-content-rect.html (rev 0)
+++ trunk/LayoutTests/compositing/images/update-content-rect.html 2014-04-19 05:31:39 UTC (rev 167529)
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ .composited {
+ -webkit-transform: translateZ(0);
+ }
+ </style>
+</head>
+<body>
+ <img id="image" class="composited" src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (167528 => 167529)
--- trunk/Source/WebCore/ChangeLog 2014-04-19 05:19:30 UTC (rev 167528)
+++ trunk/Source/WebCore/ChangeLog 2014-04-19 05:31:39 UTC (rev 167529)
@@ -1,3 +1,40 @@
+2014-04-18 Simon Fraser <[email protected]>
+
+ Contents of directly composited image layers are sometimes missing
+ https://bugs.webkit.org/show_bug.cgi?id=131880
+
+ Reviewed by Tim Horton.
+
+ RenderLayerBacking::updateGraphicsLayerGeometry() tested whether a
+ GraphicsLayer had a contents layer to determine whether to call code
+ that updates the contents rect. However, on Mac, we don't make a contents
+ layer until later at layer flush time. That would result in an empty
+ contentsRect being set.
+
+ Fix by renaming GraphicsLayer::hasContentsLayer() to usesContentsLayer(),
+ and on Mac consulting the m_contentsLayerPurpose flag, which is set
+ at the appropriate time.
+
+ Test: compositing/images/update-content-rect.html
+
+ * platform/ScrollView.cpp:
+ (WebCore::positionScrollbarLayer):
+ * platform/graphics/GraphicsLayer.cpp:
+ (WebCore::GraphicsLayer::getDebugBorderInfo):
+ * platform/graphics/GraphicsLayer.h:
+ (WebCore::GraphicsLayer::usesContentsLayer):
+ (WebCore::GraphicsLayer::hasContentsLayer): Deleted.
+ * platform/graphics/ca/GraphicsLayerCA.h:
+ (WebCore::GraphicsLayerCA::hasContentsLayer): Deleted.
+ * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
+ (WebCore::GraphicsLayerTextureMapper::usesContentsLayer):
+ (WebCore::GraphicsLayerTextureMapper::hasContentsLayer): Deleted.
+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+ (WebCore::RenderLayerBacking::positionOverflowControlsLayers):
+ (WebCore::RenderLayerBacking::compositingLayerType):
+
2014-04-18 Commit Queue <[email protected]>
Unreviewed, rolling out r167527.
Modified: trunk/Source/WebCore/platform/ScrollView.cpp (167528 => 167529)
--- trunk/Source/WebCore/platform/ScrollView.cpp 2014-04-19 05:19:30 UTC (rev 167528)
+++ trunk/Source/WebCore/platform/ScrollView.cpp 2014-04-19 05:31:39 UTC (rev 167529)
@@ -1049,7 +1049,7 @@
graphicsLayer->setSize(scrollbarRect.size());
- if (graphicsLayer->hasContentsLayer()) {
+ if (graphicsLayer->usesContentsLayer()) {
graphicsLayer->setContentsRect(IntRect(0, 0, scrollbarRect.width(), scrollbarRect.height()));
return;
}
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (167528 => 167529)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2014-04-19 05:19:30 UTC (rev 167528)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2014-04-19 05:31:39 UTC (rev 167529)
@@ -370,7 +370,7 @@
return;
}
- if (hasContentsLayer()) {
+ if (usesContentsLayer()) {
color = Color(255, 150, 255, 200); // non-painting layer with contents: pink
width = 2;
return;
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (167528 => 167529)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2014-04-19 05:19:30 UTC (rev 167528)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2014-04-19 05:31:39 UTC (rev 167529)
@@ -408,7 +408,7 @@
// FIXME: webkit.org/b/109658
// Should unify setContentsToMedia and setContentsToCanvas
virtual void setContentsToPlatformLayer(PlatformLayer* layer) { setContentsToMedia(layer); }
- virtual bool hasContentsLayer() const { return false; }
+ virtual bool usesContentsLayer() const { return false; }
// Callback from the underlying graphics system to draw layer contents.
void paintGraphicsLayerContents(GraphicsContext&, const FloatRect& clip);
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (167528 => 167529)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2014-04-19 05:19:30 UTC (rev 167528)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2014-04-19 05:31:39 UTC (rev 167529)
@@ -133,7 +133,7 @@
virtual void setContentsToCanvas(PlatformLayer*);
virtual void setContentsToSolidColor(const Color&);
- virtual bool hasContentsLayer() const { return m_contentsLayer; }
+ virtual bool usesContentsLayer() const override { return m_contentsLayerPurpose != NoContentsLayer; }
virtual void setShowDebugBorder(bool) override;
virtual void setShowRepaintCounter(bool) override;
Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h (167528 => 167529)
--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h 2014-04-19 05:19:30 UTC (rev 167528)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h 2014-04-19 05:31:39 UTC (rev 167529)
@@ -76,7 +76,7 @@
virtual void flushCompositingState(const FloatRect&);
virtual void flushCompositingStateForThisLayerOnly();
virtual void setName(const String& name);
- virtual bool hasContentsLayer() const { return m_contentsLayer; }
+ virtual bool usesContentsLayer() const { return m_contentsLayer; }
virtual PlatformLayer* platformLayer() const { return m_contentsLayer; }
inline int changeMask() const { return m_changeMask; }
Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h (167528 => 167529)
--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h 2014-04-19 05:19:30 UTC (rev 167528)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h 2014-04-19 05:31:39 UTC (rev 167529)
@@ -109,7 +109,7 @@
virtual void removeAnimation(const String&) override;
virtual void suspendAnimations(double time) override;
virtual void resumeAnimations() override;
- virtual bool hasContentsLayer() const override { return m_canvasPlatformLayer || m_compositedImage; }
+ virtual bool usesContentsLayer() const override { return m_canvasPlatformLayer || m_compositedImage; }
void syncPendingStateChangesIncludingSubLayers();
void updateContentBuffersIncludingSubLayers();
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (167528 => 167529)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2014-04-19 05:19:30 UTC (rev 167528)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2014-04-19 05:31:39 UTC (rev 167529)
@@ -987,7 +987,7 @@
bool didUpdateContentsRect = false;
updateDirectlyCompositedContents(isSimpleContainer, didUpdateContentsRect);
- if (!didUpdateContentsRect && m_graphicsLayer->hasContentsLayer())
+ if (!didUpdateContentsRect && m_graphicsLayer->usesContentsLayer())
resetContentsRect();
updateDrawsContent(isSimpleContainer);
@@ -1275,24 +1275,24 @@
IntRect hBarRect = m_owningLayer.rectForHorizontalScrollbar(borderBox);
layer->setPosition(hBarRect.location() - offsetFromRenderer);
layer->setSize(hBarRect.size());
- if (layer->hasContentsLayer()) {
+ if (layer->usesContentsLayer()) {
IntRect barRect = IntRect(IntPoint(), hBarRect.size());
layer->setContentsRect(barRect);
layer->setContentsClippingRect(barRect);
}
- layer->setDrawsContent(m_owningLayer.horizontalScrollbar() && !layer->hasContentsLayer());
+ layer->setDrawsContent(m_owningLayer.horizontalScrollbar() && !layer->usesContentsLayer());
}
if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
IntRect vBarRect = m_owningLayer.rectForVerticalScrollbar(borderBox);
layer->setPosition(vBarRect.location() - offsetFromRenderer);
layer->setSize(vBarRect.size());
- if (layer->hasContentsLayer()) {
+ if (layer->usesContentsLayer()) {
IntRect barRect = IntRect(IntPoint(), vBarRect.size());
layer->setContentsRect(barRect);
layer->setContentsClippingRect(barRect);
}
- layer->setDrawsContent(m_owningLayer.verticalScrollbar() && !layer->hasContentsLayer());
+ layer->setDrawsContent(m_owningLayer.verticalScrollbar() && !layer->usesContentsLayer());
}
if (GraphicsLayer* layer = layerForScrollCorner()) {
@@ -2580,7 +2580,7 @@
CompositingLayerType RenderLayerBacking::compositingLayerType() const
{
- if (m_graphicsLayer->hasContentsLayer())
+ if (m_graphicsLayer->usesContentsLayer())
return MediaCompositingLayer;
if (m_graphicsLayer->drawsContent())