Title: [143656] trunk/Source/WebCore
Revision
143656
Author
simon.fra...@apple.com
Date
2013-02-21 15:29:23 -0800 (Thu, 21 Feb 2013)

Log Message

Don't make an overhang shadow layer when the WKView has a transparent background
https://bugs.webkit.org/show_bug.cgi?id=110429

Reviewed by Anders Carlsson.

When in coordinated scrolling mode, RenderLayerCompositor makes a layer to show
the shadow around the content when rubber-banding. However, if the view is
transparent, we don't want to make this layer, since it darkens the entire view.

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateRootLayerConfiguration): Code was moved
into viewHasTransparentBackground(), so just call that here.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresContentShadowLayer): Don't make
a shadow layer when the view is transparent.
(WebCore::RenderLayerCompositor::viewHasTransparentBackground): Return
true if the view is transparent or has a non-opaque background color,
and optionally return that color.
* rendering/RenderLayerCompositor.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143655 => 143656)


--- trunk/Source/WebCore/ChangeLog	2013-02-21 23:29:17 UTC (rev 143655)
+++ trunk/Source/WebCore/ChangeLog	2013-02-21 23:29:23 UTC (rev 143656)
@@ -1,5 +1,27 @@
 2013-02-21  Simon Fraser  <simon.fra...@apple.com>
 
+        Don't make an overhang shadow layer when the WKView has a transparent background
+        https://bugs.webkit.org/show_bug.cgi?id=110429
+
+        Reviewed by Anders Carlsson.
+
+        When in coordinated scrolling mode, RenderLayerCompositor makes a layer to show
+        the shadow around the content when rubber-banding. However, if the view is
+        transparent, we don't want to make this layer, since it darkens the entire view.
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateRootLayerConfiguration): Code was moved
+        into viewHasTransparentBackground(), so just call that here.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresContentShadowLayer): Don't make
+        a shadow layer when the view is transparent.
+        (WebCore::RenderLayerCompositor::viewHasTransparentBackground): Return
+        true if the view is transparent or has a non-opaque background color,
+        and optionally return that color.
+        * rendering/RenderLayerCompositor.h:
+
+2013-02-21  Simon Fraser  <simon.fra...@apple.com>
+
         [Safari] Crash with opacity + drop shadow filter + child element extending beyond filter outsets
         https://bugs.webkit.org/show_bug.cgi?id=107467
 

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (143655 => 143656)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-02-21 23:29:17 UTC (rev 143655)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-02-21 23:29:23 UTC (rev 143656)
@@ -1320,17 +1320,8 @@
         return;
 
     Color backgroundColor;
-    FrameView* frameView = toRenderView(renderer())->frameView();
-    bool viewIsTransparent = frameView->isTransparent();
+    bool viewIsTransparent = compositor()->viewHasTransparentBackground(&backgroundColor);
 
-    if (!viewIsTransparent) {
-        backgroundColor = frameView->documentBackgroundColor();
-        if (!backgroundColor.isValid())
-            backgroundColor = Color::white;
-
-        viewIsTransparent = backgroundColor.hasAlpha();
-    }
-
     if (m_backgroundLayerPaintsFixedRootBackground && m_backgroundLayer) {
         m_backgroundLayer->setBackgroundColor(backgroundColor);
         m_backgroundLayer->setContentsOpaque(!viewIsTransparent);

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (143655 => 143656)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2013-02-21 23:29:17 UTC (rev 143655)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2013-02-21 23:29:23 UTC (rev 143656)
@@ -2332,6 +2332,9 @@
         return false;
 
 #if PLATFORM(MAC)
+    if (viewHasTransparentBackground())
+        return false;
+
     // On Mac, we want a content shadow layer if we have a scrolling coordinator and can scroll.
     if (scrollingCoordinator() && !m_renderView->frameView()->prohibitsScrolling())
         return true;
@@ -2341,6 +2344,25 @@
 }
 #endif
 
+bool RenderLayerCompositor::viewHasTransparentBackground(Color* backgroundColor) const
+{
+    FrameView* frameView = m_renderView->frameView();
+    if (frameView->isTransparent()) {
+        if (backgroundColor)
+            *backgroundColor = Color(); // Return an invalid color.
+        return true;
+    }
+
+    Color documentBackgroundColor = frameView->documentBackgroundColor();
+    if (!documentBackgroundColor.isValid())
+        documentBackgroundColor = Color::white;
+
+    if (backgroundColor)
+        *backgroundColor = documentBackgroundColor;
+        
+    return documentBackgroundColor.hasAlpha();
+}
+
 void RenderLayerCompositor::updateOverflowControlsLayers()
 {
 #if ENABLE(RUBBER_BANDING)

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (143655 => 143656)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2013-02-21 23:29:17 UTC (rev 143655)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2013-02-21 23:29:23 UTC (rev 143656)
@@ -236,6 +236,8 @@
     void reportMemoryUsage(MemoryObjectInfo*) const;
     void setShouldReevaluateCompositingAfterLayout() { m_reevaluateCompositingAfterLayout = true; }
 
+    bool viewHasTransparentBackground(Color* backgroundColor = 0) const;
+    
 private:
     class OverlapMap;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to