Backdrop Filter should repaint when changed via script
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Apr 2016 00:19:32 +0000 (00:19 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Apr 2016 00:19:32 +0000 (00:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149319
rdar://problem/22749892

Reviewed by Tim Horton.

Source/WebCore:

When backdrop filters change, we need to trigger a recomposite, just as we do
for filters. It's ok to re-use ContextSensitivePropertyFilter because
adjustStyleDifference() does the right thing.

Test: css3/filters/backdrop/dynamic-backdrop-filter-change.html

* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresLayerRepaint):

LayoutTests:

* css3/filters/backdrop/dynamic-backdrop-filter-change-expected.html: Added.
* css3/filters/backdrop/dynamic-backdrop-filter-change.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/css3/filters/backdrop/dynamic-backdrop-filter-change-expected.html [new file with mode: 0644]
LayoutTests/css3/filters/backdrop/dynamic-backdrop-filter-change.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/style/RenderStyle.cpp

index 7f07b87..a74d41f 100644 (file)
@@ -1,3 +1,14 @@
+2016-04-01  Simon Fraser  <simon.fraser@apple.com>
+
+        Backdrop Filter should repaint when changed via script
+        https://bugs.webkit.org/show_bug.cgi?id=149319
+        rdar://problem/22749892
+
+        Reviewed by Tim Horton.
+
+        * css3/filters/backdrop/dynamic-backdrop-filter-change-expected.html: Added.
+        * css3/filters/backdrop/dynamic-backdrop-filter-change.html: Added.
+
 2016-03-31  Zalan Bujtas  <zalan@apple.com>
 
         putImageData leaves visible artifacts on retina display
diff --git a/LayoutTests/css3/filters/backdrop/dynamic-backdrop-filter-change-expected.html b/LayoutTests/css3/filters/backdrop/dynamic-backdrop-filter-change-expected.html
new file mode 100644 (file)
index 0000000..083af23
--- /dev/null
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .background {
+            height: 100px;
+            width: 100px;
+            padding: 50px;
+            background-image: repeating-linear-gradient(black 0px, black 25px, white 25px, white 50px);
+            border: 1px solid black;
+        }
+        
+        #box {
+            height: 100px;
+            width: 100px;
+            -webkit-backdrop-filter: blur(20px);
+        }
+    </style>
+</head>
+<body>
+<div class="background">
+    <div id="box">
+    </div>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/css3/filters/backdrop/dynamic-backdrop-filter-change.html b/LayoutTests/css3/filters/backdrop/dynamic-backdrop-filter-change.html
new file mode 100644 (file)
index 0000000..753e69a
--- /dev/null
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .background {
+            height: 100px;
+            width: 100px;
+            padding: 50px;
+            background-image: repeating-linear-gradient(black 0px, black 25px, white 25px, white 50px);
+            border: 1px solid black;
+        }
+        
+        #box {
+            height: 100px;
+            width: 100px;
+            -webkit-backdrop-filter: blur(0px);
+        }
+        
+        #box.changed {
+            -webkit-backdrop-filter: blur(20px);
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.notifyDone();
+
+        window.addEventListener('load', function() {
+            window.setTimeout(function() {
+                document.getElementById('box').classList.add('changed');
+            }, 0);
+        }, false);
+    </script>
+</head>
+<body>
+<div class="background">
+    <div id="box">
+    </div>
+</div>
+</body>
+</html>
index e34698a..9520fe3 100644 (file)
@@ -1,3 +1,20 @@
+2016-04-01  Simon Fraser  <simon.fraser@apple.com>
+
+        Backdrop Filter should repaint when changed via script
+        https://bugs.webkit.org/show_bug.cgi?id=149319
+        rdar://problem/22749892
+
+        Reviewed by Tim Horton.
+
+        When backdrop filters change, we need to trigger a recomposite, just as we do
+        for filters. It's ok to re-use ContextSensitivePropertyFilter because
+        adjustStyleDifference() does the right thing.
+
+        Test: css3/filters/backdrop/dynamic-backdrop-filter-change.html
+
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::changeRequiresLayerRepaint):
+
 2016-03-31  Zalan Bujtas  <zalan@apple.com>
 
         putImageData leaves visible artifacts on retina display
index 5fbb72a..bc3ae86 100644 (file)
@@ -789,6 +789,13 @@ bool RenderStyle::changeRequiresLayerRepaint(const RenderStyle& other, unsigned&
         // Don't return; keep looking for another change.
     }
 
+#if ENABLE(FILTERS_LEVEL_2)
+    if (rareNonInheritedData->m_backdropFilter != other.rareNonInheritedData->m_backdropFilter) {
+        changedContextSensitiveProperties |= ContextSensitivePropertyFilter;
+        // Don't return; keep looking for another change.
+    }
+#endif
+
     if (rareNonInheritedData->m_mask != other.rareNonInheritedData->m_mask
         || rareNonInheritedData->m_maskBoxImage != other.rareNonInheritedData->m_maskBoxImage)
         return true;