Skip to content
Permalink
Browse files
[TextureMapper] REGRESION(r269570): mask layer doesn't clip descenden…
…t 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.

Canonical link: https://commits.webkit.org/232361@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@270698 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
fujii committed Dec 11, 2020
1 parent 8dea867 commit 2b24410d1be46677cdc4dfd3c76bedc5f0bc2ec9
Showing 6 changed files with 95 additions and 4 deletions.
@@ -1,3 +1,14 @@
2020-12-11 Fujii Hironori <Hironori.Fujii@sony.com>

[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 <rini_patel@apple.com>

[GPU process] Update TestExpectations to skip Layout tests crashes
@@ -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>
@@ -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>
@@ -1,3 +1,25 @@
2020-12-11 Fujii Hironori <Hironori.Fujii@sony.com>

[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 <don.olmstead@sony.com>

[CMake] Determine correct visibility for linked frameworks
@@ -366,6 +366,7 @@ void TextureMapperLayer::computeOverlapRegions(ComputeOverlapRegionData& data, c
resolveOverlaps(viewportBoundingRect, data.overlapRegion, data.nonOverlapRegion);
break;
case ComputeOverlapRegionMode::Union:
case ComputeOverlapRegionMode::Mask:
data.overlapRegion.unite(viewportBoundingRect);
break;
}
@@ -376,7 +377,7 @@ void TextureMapperLayer::computeOverlapRegions(ComputeOverlapRegionData& data, c
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 @@ void TextureMapperLayer::paintUsingOverlapRegions(TextureMapperPaintOptions& opt
{
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
@@ -123,7 +123,8 @@ class WEBCORE_EXPORT TextureMapperLayer : public CanMakeWeakPtr<TextureMapperLay

enum class ComputeOverlapRegionMode : uint8_t {
Intersection,
Union
Union,
Mask
};
struct ComputeOverlapRegionData {
ComputeOverlapRegionMode mode;

0 comments on commit 2b24410

Please sign in to comment.