Title: [139750] trunk/Source
- Revision
- 139750
- Author
- simon.fra...@apple.com
- Date
- 2013-01-15 10:10:28 -0800 (Tue, 15 Jan 2013)
Log Message
Allow tiled WKViews to have transparent backgrounds
https://bugs.webkit.org/show_bug.cgi?id=106400
Source/WebCore:
Reviewed by Anders Carlsson.
When WKViews were set to have transparent backgrounds, they still
obscured content behind the view, for several reasons.
First, when in tiled scrolling mode, WKView set the background
of its layer to opaque white. Fix by using the clearColor (effectively
removing the background color) if the view has a non-opaque background.
Second, RenderLayerBacking just looked at FrameViews's isTransparent()
when deciding to make TileCache tiles non-opaque, but it also needs to
consider FrameViews with a non-opaque base background color. The
same logic was necessary to avoid setting an opaque white background
color on the TileCache layer.
Finally, for views with non-opaque backgrounds, we don't want to display
linen, so RenderLayerCompositor::requiresOverhangAreasLayer() was changed
to return false in that case.
View transparency is not testable in layout tests.
* page/FrameView.cpp:
(WebCore::FrameView::hasOpaqueBackground):
* page/FrameView.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
(WebCore::RenderLayerBacking::updateBackgroundColor):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresOverhangAreasLayer):
Source/WebKit2:
Reviewed by Anders Carlsson.
When WKViews were set to have transparent backgrounds, they still
obscured content behind the view, for several reasons.
First, when in tiled scrolling mode, WKView set the background
of its layer to opaque white. Fix by using the clearColor (effectively
removing the background color) if the view has a non-opaque background.
Second, RenderLayerBacking just looked at FrameViews's isTransparent()
when deciding to make TileCache tiles non-opaque, but it also needs to
consider FrameViews with a non-opaque base background color. The
same logic was necessary to avoid setting an opaque white background
color on the TileCache layer.
Finally, for views with non-opaque backgrounds, we don't want to display
linen, so RenderLayerCompositor::requiresOverhangAreasLayer() was changed
to return false in that case.
* UIProcess/API/mac/WKView.mm:
(-[WKView updateLayer]):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (139749 => 139750)
--- trunk/Source/WebCore/ChangeLog 2013-01-15 17:54:22 UTC (rev 139749)
+++ trunk/Source/WebCore/ChangeLog 2013-01-15 18:10:28 UTC (rev 139750)
@@ -1,3 +1,38 @@
+2013-01-15 Simon Fraser <simon.fra...@apple.com>
+
+ Allow tiled WKViews to have transparent backgrounds
+ https://bugs.webkit.org/show_bug.cgi?id=106400
+
+ Reviewed by Anders Carlsson.
+
+ When WKViews were set to have transparent backgrounds, they still
+ obscured content behind the view, for several reasons.
+
+ First, when in tiled scrolling mode, WKView set the background
+ of its layer to opaque white. Fix by using the clearColor (effectively
+ removing the background color) if the view has a non-opaque background.
+
+ Second, RenderLayerBacking just looked at FrameViews's isTransparent()
+ when deciding to make TileCache tiles non-opaque, but it also needs to
+ consider FrameViews with a non-opaque base background color. The
+ same logic was necessary to avoid setting an opaque white background
+ color on the TileCache layer.
+
+ Finally, for views with non-opaque backgrounds, we don't want to display
+ linen, so RenderLayerCompositor::requiresOverhangAreasLayer() was changed
+ to return false in that case.
+
+ View transparency is not testable in layout tests.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::hasOpaqueBackground):
+ * page/FrameView.h:
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
+ (WebCore::RenderLayerBacking::updateBackgroundColor):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::requiresOverhangAreasLayer):
+
2013-01-15 Ojan Vafai <o...@chromium.org>
RenderView does not need to override computePreferredLogicalWidth
Modified: trunk/Source/WebCore/page/FrameView.cpp (139749 => 139750)
--- trunk/Source/WebCore/page/FrameView.cpp 2013-01-15 17:54:22 UTC (rev 139749)
+++ trunk/Source/WebCore/page/FrameView.cpp 2013-01-15 18:10:28 UTC (rev 139750)
@@ -2325,6 +2325,11 @@
m_isTransparent = isTransparent;
}
+bool FrameView::hasOpaqueBackground() const
+{
+ return !m_isTransparent && !m_baseBackgroundColor.hasAlpha();
+}
+
Color FrameView::baseBackgroundColor() const
{
return m_baseBackgroundColor;
Modified: trunk/Source/WebCore/page/FrameView.h (139749 => 139750)
--- trunk/Source/WebCore/page/FrameView.h 2013-01-15 17:54:22 UTC (rev 139749)
+++ trunk/Source/WebCore/page/FrameView.h 2013-01-15 18:10:28 UTC (rev 139750)
@@ -164,6 +164,9 @@
bool isTransparent() const;
void setTransparent(bool isTransparent);
+
+ // True if the FrameView is not transparent, and the base background color is opaque.
+ bool hasOpaqueBackground() const;
Color baseBackgroundColor() const;
void setBaseBackgroundColor(const Color&);
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (139749 => 139750)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2013-01-15 17:54:22 UTC (rev 139749)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2013-01-15 18:10:28 UTC (rev 139750)
@@ -267,11 +267,11 @@
m_containmentLayer = createGraphicsLayer("TileCache Flattening Layer");
if (m_isMainFrameRenderViewLayer) {
- bool isTransparent = false;
+ bool hasOpaqueBackground = false;
if (FrameView* frameView = toRenderView(renderer())->frameView())
- isTransparent = frameView->isTransparent();
+ hasOpaqueBackground = !frameView->hasOpaqueBackground();
- m_graphicsLayer->setContentsOpaque(!isTransparent);
+ m_graphicsLayer->setContentsOpaque(!hasOpaqueBackground);
m_graphicsLayer->setAppliesPageScale();
}
@@ -1180,7 +1180,7 @@
FrameView* frameView = toRenderView(renderer())->frameView();
if (!frameView->isTransparent()) {
backgroundColor = frameView->documentBackgroundColor();
- if (!backgroundColor.isValid() || backgroundColor.hasAlpha())
+ if (frameView->hasOpaqueBackground() && (!backgroundColor.isValid() || backgroundColor.hasAlpha()))
backgroundColor = Color::white;
}
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (139749 => 139750)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2013-01-15 17:54:22 UTC (rev 139749)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2013-01-15 18:10:28 UTC (rev 139750)
@@ -2223,7 +2223,7 @@
return false;
// We do want a layer if we have a scrolling coordinator.
- if (scrollingCoordinator())
+ if (scrollingCoordinator() && m_renderView->frameView()->hasOpaqueBackground())
return true;
// Chromium always wants a layer.
Modified: trunk/Source/WebKit2/ChangeLog (139749 => 139750)
--- trunk/Source/WebKit2/ChangeLog 2013-01-15 17:54:22 UTC (rev 139749)
+++ trunk/Source/WebKit2/ChangeLog 2013-01-15 18:10:28 UTC (rev 139750)
@@ -1,3 +1,30 @@
+2013-01-15 Simon Fraser <simon.fra...@apple.com>
+
+ Allow tiled WKViews to have transparent backgrounds
+ https://bugs.webkit.org/show_bug.cgi?id=106400
+
+ Reviewed by Anders Carlsson.
+
+ When WKViews were set to have transparent backgrounds, they still
+ obscured content behind the view, for several reasons.
+
+ First, when in tiled scrolling mode, WKView set the background
+ of its layer to opaque white. Fix by using the clearColor (effectively
+ removing the background color) if the view has a non-opaque background.
+
+ Second, RenderLayerBacking just looked at FrameViews's isTransparent()
+ when deciding to make TileCache tiles non-opaque, but it also needs to
+ consider FrameViews with a non-opaque base background color. The
+ same logic was necessary to avoid setting an opaque white background
+ color on the TileCache layer.
+
+ Finally, for views with non-opaque backgrounds, we don't want to display
+ linen, so RenderLayerCompositor::requiresOverhangAreasLayer() was changed
+ to return false in that case.
+
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView updateLayer]):
+
2013-01-14 Dean Jackson <d...@apple.com>
[ANGLE] Update ANGLE in WebKit
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (139749 => 139750)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2013-01-15 17:54:22 UTC (rev 139749)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2013-01-15 18:10:28 UTC (rev 139750)
@@ -2969,7 +2969,10 @@
- (void)updateLayer
{
- self.layer.backgroundColor = CGColorGetConstantColor(kCGColorWhite);
+ if ([self drawsBackground] && ![self drawsTransparentBackground])
+ self.layer.backgroundColor = CGColorGetConstantColor(kCGColorWhite);
+ else
+ self.layer.backgroundColor = CGColorGetConstantColor(kCGColorClear);
if (DrawingAreaProxy* drawingArea = _data->_page->drawingArea())
drawingArea->waitForPossibleGeometryUpdate();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes