Title: [270698] trunk
Revision
270698
Author
[email protected]
Date
2020-12-11 12:06:50 -0800 (Fri, 11 Dec 2020)

Log Message

[TextureMapper] REGRESION(r269570): mask layer doesn't clip descendent layers
https://bugs.webkit.org/show_bug.cgi?id=219136
<rdar://problem/71742605>

Reviewed by Carlos Garcia Campos.

Source/WebCore:

computeOverlapRegions shouldn't include the descendent layer
region for layers with a mask layer. Add a new mode Mask to
ComputeOverlapRegionMode which is like Union mode but doesn't
include descendent layers.

Test: compositing/masks/clip-path-composited-descendent-2.html

* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::computeOverlapRegions): Skip
children for the Mask mode.
(WebCore::TextureMapperLayer::paintUsingOverlapRegions): Use
ComputeOverlapRegionMode::Mask for a layer with mask layer.
* platform/graphics/texmap/TextureMapperLayer.h (ComputeOverlapRegionMode): Added Mask.

LayoutTests:

* compositing/masks/clip-path-composited-descendent-2-expected.html: Added.
* compositing/masks/clip-path-composited-descendent-2.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (270697 => 270698)


--- trunk/LayoutTests/ChangeLog	2020-12-11 20:00:37 UTC (rev 270697)
+++ trunk/LayoutTests/ChangeLog	2020-12-11 20:06:50 UTC (rev 270698)
@@ -1,3 +1,14 @@
+2020-12-11  Fujii Hironori  <[email protected]>
+
+        [TextureMapper] REGRESION(r269570): mask layer doesn't clip descendent layers
+        https://bugs.webkit.org/show_bug.cgi?id=219136
+        <rdar://problem/71742605>
+
+        Reviewed by Carlos Garcia Campos.
+
+        * compositing/masks/clip-path-composited-descendent-2-expected.html: Added.
+        * compositing/masks/clip-path-composited-descendent-2.html: Added.
+
 2020-12-11  Rini Patel  <[email protected]>
 
         [GPU process] Update TestExpectations to skip Layout tests crashes

Added: trunk/LayoutTests/compositing/masks/clip-path-composited-descendent-2-expected.html (0 => 270698)


--- trunk/LayoutTests/compositing/masks/clip-path-composited-descendent-2-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/masks/clip-path-composited-descendent-2-expected.html	2020-12-11 20:06:50 UTC (rev 270698)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Tests that clip-path with a composited descendent</title>
+        <style>
+            .box {
+                width: 200px;
+                height: 200px;
+                background-color: red;
+                clip-path: circle(80px at 100px 100px);
+            }
+            .box div {
+                width: 200px;
+                height: 200px;
+                background-color: green;
+                will-change: transform;
+            }
+        </style>
+    </head>
+    <body>
+        There should be only one green circle.
+        <div class="box">
+            <div></div>
+        </div>
+    </body>
+</html>

Added: trunk/LayoutTests/compositing/masks/clip-path-composited-descendent-2.html (0 => 270698)


--- trunk/LayoutTests/compositing/masks/clip-path-composited-descendent-2.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/masks/clip-path-composited-descendent-2.html	2020-12-11 20:06:50 UTC (rev 270698)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Tests that clip-path with a composited descendent</title>
+        <style>
+            .box {
+                width: 200px;
+                height: 200px;
+                background-color: red;
+                clip-path: circle(80px at 100px 100px);
+            }
+            .box div {
+                width: 300px;
+                height: 300px;
+                background-color: green;
+                will-change: transform;
+            }
+        </style>
+    </head>
+    <body>
+        There should be only one green circle.
+        <div class="box">
+            <div></div>
+        </div>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (270697 => 270698)


--- trunk/Source/WebCore/ChangeLog	2020-12-11 20:00:37 UTC (rev 270697)
+++ trunk/Source/WebCore/ChangeLog	2020-12-11 20:06:50 UTC (rev 270698)
@@ -1,3 +1,25 @@
+2020-12-11  Fujii Hironori  <[email protected]>
+
+        [TextureMapper] REGRESION(r269570): mask layer doesn't clip descendent layers
+        https://bugs.webkit.org/show_bug.cgi?id=219136
+        <rdar://problem/71742605>
+
+        Reviewed by Carlos Garcia Campos.
+
+        computeOverlapRegions shouldn't include the descendent layer
+        region for layers with a mask layer. Add a new mode Mask to
+        ComputeOverlapRegionMode which is like Union mode but doesn't
+        include descendent layers.
+
+        Test: compositing/masks/clip-path-composited-descendent-2.html
+
+        * platform/graphics/texmap/TextureMapperLayer.cpp:
+        (WebCore::TextureMapperLayer::computeOverlapRegions): Skip
+        children for the Mask mode.
+        (WebCore::TextureMapperLayer::paintUsingOverlapRegions): Use
+        ComputeOverlapRegionMode::Mask for a layer with mask layer.
+        * platform/graphics/texmap/TextureMapperLayer.h (ComputeOverlapRegionMode): Added Mask.
+
 2020-12-11  Don Olmstead  <[email protected]>
 
         [CMake] Determine correct visibility for linked frameworks

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (270697 => 270698)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2020-12-11 20:00:37 UTC (rev 270697)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2020-12-11 20:06:50 UTC (rev 270698)
@@ -366,6 +366,7 @@
         resolveOverlaps(viewportBoundingRect, data.overlapRegion, data.nonOverlapRegion);
         break;
     case ComputeOverlapRegionMode::Union:
+    case ComputeOverlapRegionMode::Mask:
         data.overlapRegion.unite(viewportBoundingRect);
         break;
     }
@@ -376,7 +377,7 @@
         computeOverlapRegions(data, newReplicaTransform, false);
     }
 
-    if (!m_state.masksToBounds) {
+    if (!m_state.masksToBounds && data.mode != ComputeOverlapRegionMode::Mask) {
         for (auto* child : m_children)
             child->computeOverlapRegions(data, accumulatedReplicaTransform);
     }
@@ -386,9 +387,13 @@
 {
     Region overlapRegion;
     Region nonOverlapRegion;
-    bool needsUnion = hasFilters() || m_state.maskLayer || (m_state.replicaLayer && m_state.replicaLayer->m_state.maskLayer);
+    auto mode = ComputeOverlapRegionMode::Intersection;
+    if (m_state.maskLayer)
+        mode = ComputeOverlapRegionMode::Mask;
+    else if (hasFilters() || (m_state.replicaLayer && m_state.replicaLayer->m_state.maskLayer))
+        mode = ComputeOverlapRegionMode::Union;
     ComputeOverlapRegionData data {
-        needsUnion ? ComputeOverlapRegionMode::Union : ComputeOverlapRegionMode::Intersection,
+        mode,
         options.textureMapper.clipBounds(),
         overlapRegion,
         nonOverlapRegion

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (270697 => 270698)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2020-12-11 20:00:37 UTC (rev 270697)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2020-12-11 20:06:50 UTC (rev 270698)
@@ -123,7 +123,8 @@
 
     enum class ComputeOverlapRegionMode : uint8_t {
         Intersection,
-        Union
+        Union,
+        Mask
     };
     struct ComputeOverlapRegionData {
         ComputeOverlapRegionMode mode;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to