Title: [281299] trunk
Revision
281299
Author
[email protected]
Date
2021-08-20 01:03:55 -0700 (Fri, 20 Aug 2021)

Log Message

Ensure ancestors with opacity don't affect top layer elements
https://bugs.webkit.org/show_bug.cgi?id=229317

Reviewed by Antti Koivisto.

Test: imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity.html

Associated WPT PR: https://github.com/web-platform-tests/wpt/pull/30104

LayoutTests/imported/w3c:

* web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity-expected.html: Added.
* web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity.html: Added.

Source/WebCore:

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::compositingOpacity const):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (281298 => 281299)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-08-20 07:55:13 UTC (rev 281298)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-08-20 08:03:55 UTC (rev 281299)
@@ -1,3 +1,17 @@
+2021-08-20  Tim Nguyen  <[email protected]>
+
+        Ensure ancestors with opacity don't affect top layer elements
+        https://bugs.webkit.org/show_bug.cgi?id=229317
+
+        Reviewed by Antti Koivisto.
+
+        Test: imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity.html
+
+        Associated WPT PR: https://github.com/web-platform-tests/wpt/pull/30104
+
+        * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity-expected.html: Added.
+        * web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity.html: Added.
+
 2021-08-20  Youenn Fablet  <[email protected]>
 
         Add support for RTCPeerConnection.canTrickleIceCandidates

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity-expected.html (0 => 281299)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity-expected.html	2021-08-20 08:03:55 UTC (rev 281299)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<title>Reference: Test that parent opacity does not affect top layer elements</title>
+<meta charset="utf-8">
+<style>
+dialog {
+    width: 100px;
+    height: 100px;
+    background: green;
+}
+</style>
+<body>
+<p>PASS if you see a green square</p>
+<dialog></dialog>
+<script>
+    document.querySelector("dialog").showModal();
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity.html (0 => 281299)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity.html	2021-08-20 08:03:55 UTC (rev 281299)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<title>Test that parent opacity does not affect top layer elements</title>
+<meta charset="utf-8">
+<link rel="author" title="Tim Nguyen" href=""
+<link rel="match" href=""
+<link rel="help" href=""
+<link rel="help" href=""
+<style>
+#parent {
+    opacity: 0;
+}
+dialog {
+    width: 100px;
+    height: 100px;
+    background: green;
+}
+</style>
+<body>
+<p>PASS if you see a green square</p>
+<div id="parent">
+    <dialog></dialog>
+</div>
+<script>
+    document.querySelector("dialog").showModal();
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (281298 => 281299)


--- trunk/Source/WebCore/ChangeLog	2021-08-20 07:55:13 UTC (rev 281298)
+++ trunk/Source/WebCore/ChangeLog	2021-08-20 08:03:55 UTC (rev 281299)
@@ -1,3 +1,17 @@
+2021-08-20  Tim Nguyen  <[email protected]>
+
+        Ensure ancestors with opacity don't affect top layer elements
+        https://bugs.webkit.org/show_bug.cgi?id=229317
+
+        Reviewed by Antti Koivisto.
+
+        Test: imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-parent-opacity.html
+
+        Associated WPT PR: https://github.com/web-platform-tests/wpt/pull/30104
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::compositingOpacity const):
+
 2021-08-20  Youenn Fablet  <[email protected]>
 
         Add support for RTCPeerConnection.canTrickleIceCandidates

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (281298 => 281299)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2021-08-20 07:55:13 UTC (rev 281298)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2021-08-20 08:03:55 UTC (rev 281299)
@@ -2429,6 +2429,10 @@
 float RenderLayerBacking::compositingOpacity(float rendererOpacity) const
 {
     float finalOpacity = rendererOpacity;
+
+    // Top layer elements should not be affected by parent elements opacity
+    if (m_owningLayer.establishesTopLayer())
+        return finalOpacity;
     
     for (auto* curr = m_owningLayer.parent(); curr; curr = curr->parent()) {
         // We only care about parents that are stacking contexts.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to