Title: [199862] trunk
Revision
199862
Author
d...@apple.com
Date
2016-04-21 18:48:41 -0700 (Thu, 21 Apr 2016)

Log Message

Backdrop Filter should not be visible if element has visibility:hidden
https://bugs.webkit.org/show_bug.cgi?id=149318
<rdar://problem/22749780>

Reviewed by Simon Fraser.

Source/WebCore:

Make sure that backdrop filter layers take note of when
the contents are visible or not.

Tests: css3/filters/backdrop/backdrop-with-visibility-hidden-changing.html
       css3/filters/backdrop/backdrop-with-visibility-hidden.html
       css3/filters/backdrop/backdrop-with-visibility-hidden-2.html

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateContentsVisibility): Tell the backdrop layer about the
change if there is one.
(WebCore::GraphicsLayerCA::updateBackdropFilters): When we update filters, make
sure to check the contents visibility.
(WebCore::dumpInnerLayer): Output "hidden" if the layer is set as such.
* platform/graphics/ca/PlatformCALayer.h: Add an isHidden method.
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(PlatformCALayerCocoa::isHidden): Call into CALayer isHidden.

Source/WebKit2:

Add the isHidden method to PlatformCALayerRemote.

* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::isHidden):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:

LayoutTests:

Three tests that check if a backdrop filter should be visible when
its owning element is visibility hidden.

* css3/filters/backdrop/backdrop-with-visibility-hidden-changing-expected.txt: Added.
* css3/filters/backdrop/backdrop-with-visibility-hidden-changing.html: Added.
* css3/filters/backdrop/backdrop-with-visibility-hidden-expected.txt: Added.
* css3/filters/backdrop/backdrop-with-visibility-hidden.html: Added.
* css3/filters/backdrop/backdrop-with-visibility-hidden-2.html: Added.
* css3/filters/backdrop/backdrop-with-visibility-hidden-2-expected.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (199861 => 199862)


--- trunk/LayoutTests/ChangeLog	2016-04-22 01:25:50 UTC (rev 199861)
+++ trunk/LayoutTests/ChangeLog	2016-04-22 01:48:41 UTC (rev 199862)
@@ -1,3 +1,21 @@
+2016-04-21  Dean Jackson  <d...@apple.com>
+
+        Backdrop Filter should not be visible if element has visibility:hidden
+        https://bugs.webkit.org/show_bug.cgi?id=149318
+        <rdar://problem/22749780>
+
+        Reviewed by Simon Fraser.
+
+        Three tests that check if a backdrop filter should be visible when
+        its owning element is visibility hidden.
+
+        * css3/filters/backdrop/backdrop-with-visibility-hidden-changing-expected.txt: Added.
+        * css3/filters/backdrop/backdrop-with-visibility-hidden-changing.html: Added.
+        * css3/filters/backdrop/backdrop-with-visibility-hidden-expected.txt: Added.
+        * css3/filters/backdrop/backdrop-with-visibility-hidden.html: Added.
+        * css3/filters/backdrop/backdrop-with-visibility-hidden-2.html: Added.
+        * css3/filters/backdrop/backdrop-with-visibility-hidden-2-expected.html: Added.
+
 2016-04-21  Brady Eidson  <beid...@apple.com>
 
         Modern IDB (Workers): Get the IDBConnectionProxy from the Document to the WorkerGlobalScope.

Added: trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-2-expected.html (0 => 199862)


--- trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-2-expected.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-2-expected.html	2016-04-22 01:48:41 UTC (rev 199862)
@@ -0,0 +1,20 @@
+<title>This tests that an element with visibility hidden does not show its backdrop filter.</title>
+<style>
+.container {
+    width: 200px;
+    height: 200px;
+    background: blue;
+    margin: 50px;
+}
+.top {
+    width: 400px;
+    height: 50px;
+    position: absolute;
+    left: 0;
+    top: 150px;
+    border: 1px solid red;
+    visibility: hidden;
+}
+</style>
+<body>
+<div class="container"><div class="top"></div></div>
Property changes on: trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-2-expected.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-2.html (0 => 199862)


--- trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-2.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-2.html	2016-04-22 01:48:41 UTC (rev 199862)
@@ -0,0 +1,21 @@
+<title>This tests that an element with visibility hidden does not show its backdrop filter.</title>
+<style>
+.container {
+    width: 200px;
+    height: 200px;
+    background: blue;
+    margin: 50px;
+}
+.top {
+    width: 400px;
+    height: 50px;
+    position: absolute;
+    left: 0;
+    top: 150px;
+    border: 1px solid red;
+    -webkit-backdrop-filter: blur(50px);
+    visibility: hidden;
+}
+</style>
+<body>
+<div class="container"><div class="top"></div></div>
Property changes on: trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-2.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-changing-expected.txt (0 => 199862)


--- trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-changing-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-changing-expected.txt	2016-04-22 01:48:41 UTC (rev 199862)
@@ -0,0 +1,61 @@
+Dump when filter is visible:
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 0.00 150.00)
+          (bounds 402.00 52.00)
+          (drawsContent 1)
+          (structural layer 201.00, 176.00 402.00 x 52.00)
+          (backdrop layer 0.00, 0.00 402.00 x 52.00)
+        )
+      )
+    )
+  )
+)
+Dump when filter is hidden:
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 0.00 150.00)
+          (bounds 402.00 52.00)
+          (contentsVisible 0)
+          (structural layer 201.00, 176.00 402.00 x 52.00)
+          (backdrop layer 0.00, 0.00 402.00 x 52.00 hidden)
+        )
+      )
+    )
+  )
+)
+Dump when filter is visible again:
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 0.00 150.00)
+          (bounds 402.00 52.00)
+          (drawsContent 1)
+          (structural layer 201.00, 176.00 402.00 x 52.00)
+          (backdrop layer 0.00, 0.00 402.00 x 52.00)
+        )
+      )
+    )
+  )
+)
+
Property changes on: trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-changing-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-changing.html (0 => 199862)


--- trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-changing.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-changing.html	2016-04-22 01:48:41 UTC (rev 199862)
@@ -0,0 +1,64 @@
+<title>This tests that an element with visibility hidden does not show its backdrop filter.</title>
+<style>
+.container {
+    width: 200px;
+    height: 200px;
+    background: blue;
+    margin: 50px;
+}
+.top {
+    width: 400px;
+    height: 50px;
+    position: absolute;
+    left: 0;
+    top: 150px;
+    border: 1px solid red;
+    -webkit-backdrop-filter: blur(50px);
+}
+</style>
+<script>
+    var dump1, dump2, dump3;
+
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    function getLayerDump() {
+        if (window.internals)
+            return internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_CONTENT_LAYERS);
+        return "";
+    }
+
+    function step1() {
+        dump1 = getLayerDump();
+        var topElement = document.querySelector(".top");
+        topElement.style.visibility = "hidden";
+        setTimeout(step2, 0);
+    }
+
+    function step2() {
+        dump2 = getLayerDump();
+        var topElement = document.querySelector(".top");
+        topElement.style.visibility = "visible";
+        setTimeout(step3, 0);
+    }
+
+    function step3() {
+        dump3 = getLayerDump();
+        document.getElementById("result1").innerText = "Dump when filter is visible:\n" + dump1;
+        document.getElementById("result2").innerText = "Dump when filter is hidden:\n" + dump2;
+        document.getElementById("result3").innerText = "Dump when filter is visible again:\n" + dump3;
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }
+
+
+    window.addEventListener("load", step1, false);
+</script>
+</head>
+<body>
+<div class="container"><div class="top"></div></div>
+<pre id="result1"></pre>
+<pre id="result2"></pre>
+<pre id="result3"></pre>
Property changes on: trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-changing.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-expected.txt (0 => 199862)


--- trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-expected.txt	2016-04-22 01:48:41 UTC (rev 199862)
@@ -0,0 +1,20 @@
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 0.00 150.00)
+          (bounds 402.00 52.00)
+          (contentsVisible 0)
+          (structural layer 201.00, 176.00 402.00 x 52.00)
+          (backdrop layer 0.00, 0.00 402.00 x 52.00 hidden)
+        )
+      )
+    )
+  )
+)
+
Property changes on: trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden.html (0 => 199862)


--- trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden.html	                        (rev 0)
+++ trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden.html	2016-04-22 01:48:41 UTC (rev 199862)
@@ -0,0 +1,33 @@
+<title>This tests that an element with visibility hidden does not show its backdrop filter.</title>
+<style>
+.container {
+    width: 200px;
+    height: 200px;
+    background: blue;
+    margin: 50px;
+}
+.top {
+    width: 400px;
+    height: 50px;
+    position: absolute;
+    left: 0;
+    top: 150px;
+    border: 1px solid red;
+    -webkit-backdrop-filter: blur(50px);
+    visibility: hidden;
+}
+</style>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    function dumpLayers() {
+        if (window.internals)
+            document.getElementById("result").innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_CONTENT_LAYERS)
+    }
+    window.addEventListener("load", dumpLayers, false);
+</script>
+</head>
+<body>
+<div class="container"><div class="top"></div></div>
+<pre id="result"></pre>
Property changes on: trunk/LayoutTests/css3/filters/backdrop/backdrop-with-visibility-hidden.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (199861 => 199862)


--- trunk/Source/WebCore/ChangeLog	2016-04-22 01:25:50 UTC (rev 199861)
+++ trunk/Source/WebCore/ChangeLog	2016-04-22 01:48:41 UTC (rev 199862)
@@ -1,3 +1,29 @@
+2016-04-21  Dean Jackson  <d...@apple.com>
+
+        Backdrop Filter should not be visible if element has visibility:hidden
+        https://bugs.webkit.org/show_bug.cgi?id=149318
+        <rdar://problem/22749780>
+
+        Reviewed by Simon Fraser.
+
+        Make sure that backdrop filter layers take note of when
+        the contents are visible or not.
+
+        Tests: css3/filters/backdrop/backdrop-with-visibility-hidden-changing.html
+               css3/filters/backdrop/backdrop-with-visibility-hidden.html
+               css3/filters/backdrop/backdrop-with-visibility-hidden-2.html
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::updateContentsVisibility): Tell the backdrop layer about the
+        change if there is one.
+        (WebCore::GraphicsLayerCA::updateBackdropFilters): When we update filters, make
+        sure to check the contents visibility.
+        (WebCore::dumpInnerLayer): Output "hidden" if the layer is set as such.
+        * platform/graphics/ca/PlatformCALayer.h: Add an isHidden method.
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+        (PlatformCALayerCocoa::isHidden): Call into CALayer isHidden.
+
 2016-04-21  Zalan Bujtas  <za...@apple.com>
 
         RenderVideo should always update the intrinsic size before layout.

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (199861 => 199862)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2016-04-22 01:25:50 UTC (rev 199861)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2016-04-22 01:48:41 UTC (rev 199862)
@@ -1863,6 +1863,9 @@
     if (m_contentsVisible) {
         if (m_drawsContent)
             m_layer->setNeedsDisplay();
+
+        if (m_backdropLayer)
+            m_backdropLayer->setHidden(false);
     } else {
         m_layer->setContents(nullptr);
 
@@ -1870,6 +1873,9 @@
             for (auto& layer : layerCloneMap->values())
                 layer->setContents(nullptr);
         }
+
+        if (m_backdropLayer)
+            m_backdropLayer->setHidden(true);
     }
 }
 
@@ -1939,6 +1945,8 @@
         m_backdropLayer->setAnchorPoint(FloatPoint3D());
         m_backdropLayer->setMasksToBounds(true);
     }
+
+    m_backdropLayer->setHidden(!m_contentsVisible);
     m_backdropLayer->setFilters(m_backdropFilters);
 }
 
@@ -3353,7 +3361,10 @@
     if (behavior & LayerTreeAsTextDebug)
         textStream << "id=" << layer->layerID() << " ";
     textStream << layer->position().x() << ", " << layer->position().y()
-        << " " << layer->bounds().width() << " x " << layer->bounds().height() << ")\n";
+        << " " << layer->bounds().width() << " x " << layer->bounds().height();
+    if (layer->isHidden())
+        textStream << " hidden";
+    textStream << ")\n";
 }
 
 void GraphicsLayerCA::dumpAdditionalProperties(TextStream& textStream, int indent, LayerTreeAsTextBehavior behavior) const

Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (199861 => 199862)


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2016-04-22 01:25:50 UTC (rev 199861)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2016-04-22 01:48:41 UTC (rev 199862)
@@ -155,6 +155,7 @@
     virtual TransformationMatrix sublayerTransform() const = 0;
     virtual void setSublayerTransform(const TransformationMatrix&) = 0;
 
+    virtual bool isHidden() const = 0;
     virtual void setHidden(bool) = 0;
 
     virtual bool geometryFlipped() const = 0;

Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h (199861 => 199862)


--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h	2016-04-22 01:25:50 UTC (rev 199861)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h	2016-04-22 01:48:41 UTC (rev 199862)
@@ -87,6 +87,7 @@
     TransformationMatrix sublayerTransform() const override;
     void setSublayerTransform(const TransformationMatrix&) override;
 
+    bool isHidden() const override;
     void setHidden(bool) override;
 
     void setBackingStoreAttached(bool) override;

Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm (199861 => 199862)


--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2016-04-22 01:25:50 UTC (rev 199861)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2016-04-22 01:48:41 UTC (rev 199862)
@@ -604,6 +604,11 @@
     END_BLOCK_OBJC_EXCEPTIONS
 }
 
+bool PlatformCALayerCocoa::isHidden() const
+{
+    return [m_layer isHidden];
+}
+
 void PlatformCALayerCocoa::setHidden(bool value)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS

Modified: trunk/Source/WebKit2/ChangeLog (199861 => 199862)


--- trunk/Source/WebKit2/ChangeLog	2016-04-22 01:25:50 UTC (rev 199861)
+++ trunk/Source/WebKit2/ChangeLog	2016-04-22 01:48:41 UTC (rev 199862)
@@ -1,3 +1,17 @@
+2016-04-21  Dean Jackson  <d...@apple.com>
+
+        Backdrop Filter should not be visible if element has visibility:hidden
+        https://bugs.webkit.org/show_bug.cgi?id=149318
+        <rdar://problem/22749780>
+
+        Reviewed by Simon Fraser.
+
+        Add the isHidden method to PlatformCALayerRemote.
+
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::isHidden):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+
 2016-04-21  Anders Carlsson  <ander...@apple.com>
 
         WKWebView HTML5 AppCache not working

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (199861 => 199862)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2016-04-22 01:25:50 UTC (rev 199861)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2016-04-22 01:48:41 UTC (rev 199862)
@@ -496,6 +496,11 @@
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::SublayerTransformChanged);
 }
 
+bool PlatformCALayerRemote::isHidden() const
+{
+    return m_properties.hidden;
+}
+
 void PlatformCALayerRemote::setHidden(bool value)
 {
     m_properties.hidden = value;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (199861 => 199862)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2016-04-22 01:25:50 UTC (rev 199861)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2016-04-22 01:48:41 UTC (rev 199862)
@@ -91,6 +91,7 @@
     WebCore::TransformationMatrix sublayerTransform() const override;
     void setSublayerTransform(const WebCore::TransformationMatrix&) override;
 
+    bool isHidden() const override;
     void setHidden(bool) override;
 
     void setBackingStoreAttached(bool) override;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to