- Revision
- 88653
- Author
- [email protected]
- Date
- 2011-06-13 11:02:13 -0700 (Mon, 13 Jun 2011)
Log Message
2011-06-10 Jer Noble <[email protected]>
Reviewed by Darin Adler.
Flash of white on left and right edges of screen when showing fullscreen controller when movie doesn't fill the entire screen
https://bugs.webkit.org/show_bug.cgi?id=62491
<rdar://problem/9584427>
No new tests; should be covered by existing fullscreen pixel tests.
On certain displays, when a RenderFullScreen renderer is created, it is large enough to trigger the
creation of a tiled CALayer (instead of a normal CALayer). Painting in these layers necessarily
happens asynchronously, so the flash is occurring because of the async painting of the RenderFullScreen
renderer's background color. Since we know the RenderFullScreen does not otherwise paint its contents,
we can add a special case in the RenderLayerBacking to set the GraphicsLayer contents to be the
renderer's background color. Fill in support for creating a contentLayer to contain the background
color inside GraphicsLayerCA.
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::setContentsToBackgroundColor): Renamed from setContentsBackgroundColor to match
the other setContentsTo... functions.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::setContentsToBackgroundColor): Added. Creates a contentsLayer to host the
background color.
(WebCore::GraphicsLayerCA::updateLayerBackgroundColor): Removed a comment only.
* platform/graphics/ca/GraphicsLayerCA.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): Special case the RenderFullScreen
renderer to call updateBackgroundColor.
(WebCore::RenderLayerBacking::updateBackgroundColor): Added.
(WebCore::RenderLayerBacking::containsPaintedContent): Tell the backing that the RenderFullScreen
renderer does not paint its contents.
* rendering/RenderLayerBacking.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (88652 => 88653)
--- trunk/Source/WebCore/ChangeLog 2011-06-13 17:59:28 UTC (rev 88652)
+++ trunk/Source/WebCore/ChangeLog 2011-06-13 18:02:13 UTC (rev 88653)
@@ -1,3 +1,37 @@
+2011-06-10 Jer Noble <[email protected]>
+
+ Reviewed by Darin Adler.
+
+ Flash of white on left and right edges of screen when showing fullscreen controller when movie doesn't fill the entire screen
+ https://bugs.webkit.org/show_bug.cgi?id=62491
+ <rdar://problem/9584427>
+
+ No new tests; should be covered by existing fullscreen pixel tests.
+
+ On certain displays, when a RenderFullScreen renderer is created, it is large enough to trigger the
+ creation of a tiled CALayer (instead of a normal CALayer). Painting in these layers necessarily
+ happens asynchronously, so the flash is occurring because of the async painting of the RenderFullScreen
+ renderer's background color. Since we know the RenderFullScreen does not otherwise paint its contents,
+ we can add a special case in the RenderLayerBacking to set the GraphicsLayer contents to be the
+ renderer's background color. Fill in support for creating a contentLayer to contain the background
+ color inside GraphicsLayerCA.
+
+ * platform/graphics/GraphicsLayer.h:
+ (WebCore::GraphicsLayer::setContentsToBackgroundColor): Renamed from setContentsBackgroundColor to match
+ the other setContentsTo... functions.
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::setContentsToBackgroundColor): Added. Creates a contentsLayer to host the
+ background color.
+ (WebCore::GraphicsLayerCA::updateLayerBackgroundColor): Removed a comment only.
+ * platform/graphics/ca/GraphicsLayerCA.h:
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): Special case the RenderFullScreen
+ renderer to call updateBackgroundColor.
+ (WebCore::RenderLayerBacking::updateBackgroundColor): Added.
+ (WebCore::RenderLayerBacking::containsPaintedContent): Tell the backing that the RenderFullScreen
+ renderer does not paint its contents.
+ * rendering/RenderLayerBacking.h:
+
2011-06-13 Tim Horton <[email protected]>
Reviewed by Simon Fraser.
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (88652 => 88653)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2011-06-13 17:59:28 UTC (rev 88652)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2011-06-13 18:02:13 UTC (rev 88653)
@@ -313,7 +313,7 @@
// Layer contents
virtual void setContentsToImage(Image*) { }
virtual void setContentsToMedia(PlatformLayer*) { } // video or plug-in
- virtual void setContentsBackgroundColor(const Color&) { }
+ virtual void setContentsToBackgroundColor(const Color&) { }
virtual void setContentsToCanvas(PlatformLayer*) { }
virtual bool hasContentsLayer() const { return false; }
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (88652 => 88653)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2011-06-13 17:59:28 UTC (rev 88652)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2011-06-13 18:02:13 UTC (rev 88653)
@@ -670,6 +670,26 @@
m_client->notifyAnimationStarted(this, startTime);
}
+void GraphicsLayerCA::setContentsToBackgroundColor(const Color& color)
+{
+ setBackgroundColor(color);
+ if (color != Color::transparent) {
+ m_contentsLayerPurpose = ContentsLayerForBackgroundColor;
+ m_contentsLayer = PlatformCALayer::create(PlatformCALayer::LayerTypeLayer, this);
+#ifndef NDEBUG
+ m_contentsLayer->setName("Background Color Layer");
+#endif
+ updateContentsRect();
+ setupContentsLayer(m_contentsLayer.get());
+ } else {
+ m_contentsLayerPurpose = NoContentsLayer;
+ m_contentsLayer = 0;
+ }
+
+ noteSublayersChanged();
+ noteLayerPropertyChanged(BackgroundColorChanged);
+}
+
void GraphicsLayerCA::setContentsToImage(Image* image)
{
if (image) {
@@ -1254,7 +1274,6 @@
if (!m_contentsLayer)
return;
- // We never create the contents layer just for background color yet.
if (m_backgroundColorSet)
m_contentsLayer->setBackgroundColor(m_backgroundColor);
else
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (88652 => 88653)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2011-06-13 17:59:28 UTC (rev 88652)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2011-06-13 18:02:13 UTC (rev 88653)
@@ -110,6 +110,7 @@
virtual void setContentsToImage(Image*);
virtual void setContentsToMedia(PlatformLayer*);
virtual void setContentsToCanvas(PlatformLayer*);
+ virtual void setContentsToBackgroundColor(const Color&);
virtual bool hasContentsLayer() const { return m_contentsLayer; }
@@ -350,7 +351,8 @@
NoContentsLayer = 0,
ContentsLayerForImage,
ContentsLayerForMedia,
- ContentsLayerForCanvas
+ ContentsLayerForCanvas,
+ ContentsLayerForBackgroundColor
};
ContentsLayerPurpose m_contentsLayerPurpose;
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (88652 => 88653)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2011-06-13 17:59:28 UTC (rev 88652)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2011-06-13 18:02:13 UTC (rev 88653)
@@ -305,7 +305,19 @@
layerConfigChanged = true;
}
#endif
-
+#if ENABLE(FULLSCREEN_API)
+ else if (renderer->isRenderFullScreen()) {
+ // RenderFullScreen renderers have no content, and only a solid
+ // background color. They also can be large enough to trigger the
+ // creation of a tiled-layer, which can cause flashing problems
+ // during repainting. Special case the RenderFullScreen case because
+ // we know its style does not come from CSS and it is therefore will
+ // not contain paintable content (e.g. background images, gradients,
+ // etc), so safe to set the layer's background color to the renderer's
+ // style's background color.
+ updateBackgroundColor();
+ }
+#endif
if (renderer->isRenderPart())
layerConfigChanged = RenderLayerCompositor::parentFrameContentLayers(toRenderPart(renderer));
@@ -770,6 +782,11 @@
return renderer()->style()->visitedDependentColor(CSSPropertyBackgroundColor);
}
+void RenderLayerBacking::updateBackgroundColor()
+{
+ m_graphicsLayer->setContentsToBackgroundColor(rendererBackgroundColor());
+}
+
// A "simple container layer" is a RenderLayer which has no visible content to render.
// It may have no children, or all its children may be themselves composited.
// This is a useful optimization, because it allows us to avoid allocating backing store.
@@ -903,6 +920,10 @@
if (isAcceleratedCanvas(renderer()))
return hasBoxDecorationsOrBackground(renderer());
#endif
+#if ENABLE(FULLSCREEN_API)
+ if (renderer()->isRenderFullScreen())
+ return false;
+#endif
return true;
}
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (88652 => 88653)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2011-06-13 17:59:28 UTC (rev 88652)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2011-06-13 18:02:13 UTC (rev 88653)
@@ -182,6 +182,7 @@
bool rendererHasBackground() const;
const Color rendererBackgroundColor() const;
+ void updateBackgroundColor();
bool hasNonCompositingDescendants() const;