Title: [125629] trunk
Revision
125629
Author
[email protected]
Date
2012-08-14 18:21:47 -0700 (Tue, 14 Aug 2012)

Log Message

[CSS Shaders][Chromium] Filters area applied twice when CustomFilterOperation is in the list
https://bugs.webkit.org/show_bug.cgi?id=93900

Reviewed by James Robinson.

Source/WebCore:

Whenever the platform cannot render a shader in hardware it will fallback to software.
In such cases, the platform should remove any old filters applied, so that the filters do not apply twice.

Test: css3/filters/custom/filter-fallback-to-software.html

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

LayoutTests:

Added a test that first applies a blur and then switches to a CSS Shader plus a blur.
The test was failing on Chromium by not removing the old blur filter from the platform layer.

* css3/filters/custom/filter-fallback-to-software-expected.html: Added.
* css3/filters/custom/filter-fallback-to-software.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (125628 => 125629)


--- trunk/LayoutTests/ChangeLog	2012-08-15 01:19:23 UTC (rev 125628)
+++ trunk/LayoutTests/ChangeLog	2012-08-15 01:21:47 UTC (rev 125629)
@@ -1,3 +1,16 @@
+2012-08-14  Alexandru Chiculita  <[email protected]>
+
+        [CSS Shaders][Chromium] Filters area applied twice when CustomFilterOperation is in the list
+        https://bugs.webkit.org/show_bug.cgi?id=93900
+
+        Reviewed by James Robinson.
+
+        Added a test that first applies a blur and then switches to a CSS Shader plus a blur.
+        The test was failing on Chromium by not removing the old blur filter from the platform layer.
+
+        * css3/filters/custom/filter-fallback-to-software-expected.html: Added.
+        * css3/filters/custom/filter-fallback-to-software.html: Added.
+
 2012-08-14  Adrienne Walker  <[email protected]>
 
         [chromium] Add baselines for video-controls-layer-creation layout test

Added: trunk/LayoutTests/css3/filters/custom/filter-fallback-to-software-expected.html (0 => 125629)


--- trunk/LayoutTests/css3/filters/custom/filter-fallback-to-software-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/custom/filter-fallback-to-software-expected.html	2012-08-15 01:21:47 UTC (rev 125629)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .box {
+            position: relative;
+            left: 5px;
+            height: 50px;
+            width: 45px;
+            background-color: green;
+            -webkit-filter: drop-shadow(10px 10px 10px blue);
+        }
+    </style>
+</head>
+
+<body>
+    <div class="box"></div>
+</body>
+</html>

Added: trunk/LayoutTests/css3/filters/custom/filter-fallback-to-software.html (0 => 125629)


--- trunk/LayoutTests/css3/filters/custom/filter-fallback-to-software.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/custom/filter-fallback-to-software.html	2012-08-15 01:21:47 UTC (rev 125629)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<!-- 
+    This tests verifies that the old filters are removed from the platform layer when the filters cannot be 
+    rendered in platform code and it fallbacks to render the filters in software.
+-->
+<html>
+<head>
+    <script>
+        if (window.testRunner) {
+            window.testRunner.overridePreference("WebKitCSSCustomFilterEnabled", "1");
+            window.testRunner.overridePreference("WebKitWebGLEnabled", "1");
+            window.testRunner.dumpAsText(true);
+            window.testRunner.waitUntilDone();
+        }
+
+        function done()
+        {
+            // After the onload is fired, we know for sure that the shader is loaded.
+            if (window.testRunner)
+                window.testRunner.notifyDone();
+        }
+    </script>
+    <style>
+        .box {
+            height: 50px;
+            width: 50px;
+            background-color: green;
+            /* Force a platform layer. */
+            -webkit-transform: translate3d(0, 0, 0);
+        }
+
+        .shader {
+            -webkit-filter: custom(url('../resources/vertex-offset.vs')) drop-shadow(10px 10px 10px blue);
+        }
+
+        .before {
+            -webkit-filter: drop-shadow(10px 10px 10px red);
+        }
+    </style>
+</head>
+
+<body _onload_="done()">
+    <!-- 
+        The expected result is a green square with a blue shadow. At the end there should be no red on screen.
+    -->
+    <div class="box shader before"></div>
+    <script>
+        // Force a layout.
+        document.body.clientHeight;
+        // Having this inline forces the onload event to only fire after the shader code is loaded.
+        document.querySelector(".before").classList.remove("before");
+    </script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (125628 => 125629)


--- trunk/Source/WebCore/ChangeLog	2012-08-15 01:19:23 UTC (rev 125628)
+++ trunk/Source/WebCore/ChangeLog	2012-08-15 01:21:47 UTC (rev 125629)
@@ -1,3 +1,18 @@
+2012-08-14  Alexandru Chiculita  <[email protected]>
+
+        [CSS Shaders][Chromium] Filters area applied twice when CustomFilterOperation is in the list
+        https://bugs.webkit.org/show_bug.cgi?id=93900
+
+        Reviewed by James Robinson.
+
+        Whenever the platform cannot render a shader in hardware it will fallback to software. 
+        In such cases, the platform should remove any old filters applied, so that the filters do not apply twice.
+        
+        Test: css3/filters/custom/filter-fallback-to-software.html
+
+        * platform/graphics/chromium/GraphicsLayerChromium.cpp:
+        (WebCore::GraphicsLayerChromium::setFilters):
+
 2012-08-14  Alec Flett  <[email protected]>
 
         IndexedDB: add tracing to IDBLevelDBBackingStore

Modified: trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp (125628 => 125629)


--- trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp	2012-08-15 01:19:23 UTC (rev 125628)
+++ trunk/Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp	2012-08-15 01:21:47 UTC (rev 125629)
@@ -388,8 +388,13 @@
 bool GraphicsLayerChromium::setFilters(const FilterOperations& filters)
 {
     WebFilterOperations webFilters;
-    if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters))
+    if (!copyWebCoreFilterOperationsToWebFilterOperations(filters, webFilters)) {
+        // Make sure the filters are removed from the platform layer, as they are
+        // going to fallback to software mode.
+        m_layer.setFilters(WebFilterOperations());
+        GraphicsLayer::setFilters(FilterOperations());
         return false;
+    }
     m_layer.setFilters(webFilters);
     return GraphicsLayer::setFilters(filters);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to