[Chromium] Don't create SolidColorLayer for full transparent background
authorwangxianzhu@chromium.org <wangxianzhu@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Mar 2013 23:08:43 +0000 (23:08 +0000)
committerwangxianzhu@chromium.org <wangxianzhu@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Mar 2013 23:08:43 +0000 (23:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=113524

Reviewed by James Robinson.

Source/WebCore:

Test: GraphicsLayerChromiumTest.setContentsToSolidColor

* platform/graphics/chromium/GraphicsLayerChromium.cpp:
(WebCore::GraphicsLayerChromium::setContentsToSolidColor):

Source/WebKit/chromium:

* tests/GraphicsLayerChromiumTest.cpp:
(GraphicsLayerChromiumTest::setContentsToSolidColor):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@147178 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/GraphicsLayerChromiumTest.cpp

index 6e820a9..31f97e8 100644 (file)
@@ -1,3 +1,15 @@
+2013-03-28  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        [Chromium] Don't create SolidColorLayer for full transparent background
+        https://bugs.webkit.org/show_bug.cgi?id=113524
+
+        Reviewed by James Robinson.
+
+        Test: GraphicsLayerChromiumTest.setContentsToSolidColor
+
+        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
+        (WebCore::GraphicsLayerChromium::setContentsToSolidColor):
+
 2013-03-28  Arnaud Renevier  <a.renevier@sisa.samsung.com>
 
         use XMLHttpRequestResponseType enumeration in XMLHttpRequest.idl
index 203d19e..794ec73 100644 (file)
@@ -524,7 +524,7 @@ void GraphicsLayerChromium::setContentsToSolidColor(const Color& color)
 
     m_contentsSolidColor = color;
 
-    if (color.isValid()) {
+    if (color.isValid() && color.alpha()) {
         if (!m_contentsSolidColorLayer) {
             m_contentsSolidColorLayer = adoptPtr(Platform::current()->compositorSupport()->createSolidColorLayer());
             registerContentsLayer(m_contentsSolidColorLayer->layer());
index 0125232..5c6e1ea 100644 (file)
@@ -1,3 +1,13 @@
+2013-03-28  Xianzhu Wang  <wangxianzhu@chromium.org>
+
+        [Chromium] Don't create SolidColorLayer for full transparent background
+        https://bugs.webkit.org/show_bug.cgi?id=113524
+
+        Reviewed by James Robinson.
+
+        * tests/GraphicsLayerChromiumTest.cpp:
+        (GraphicsLayerChromiumTest::setContentsToSolidColor):
+
 2013-03-28  Kent Tamura  <tkent@chromium.org>
 
         [Chromium] REGRESSION(r88030): Right-click on invalid form controls unexpectedly dispatches 'invalid' events
index d7405c6..0b8d2d4 100644 (file)
@@ -147,4 +147,16 @@ TEST_F(GraphicsLayerChromiumTest, applyScrollToScrollableArea)
     EXPECT_EQ(scrollPosition, WebPoint(scrollableArea.scrollPosition()));
 }
 
+TEST_F(GraphicsLayerChromiumTest, setContentsToSolidColor)
+{
+    m_graphicsLayer->setContentsToSolidColor(Color::transparent);
+    EXPECT_FALSE(m_graphicsLayer->contentsLayer());
+
+    m_graphicsLayer->setContentsToSolidColor(Color::white);
+    EXPECT_TRUE(m_graphicsLayer->contentsLayer());
+
+    m_graphicsLayer->setContentsToSolidColor(Color());
+    EXPECT_FALSE(m_graphicsLayer->contentsLayer());
+}
+
 } // namespace