Skip to content

Commit

Permalink
Merge r270698 - [TextureMapper] REGRESION(r269570): mask layer doesn'…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
fujii authored and carlosgcampos committed Dec 15, 2020
1 parent 478c406 commit 279dc4e
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 4 deletions.
11 changes: 11 additions & 0 deletions LayoutTests/ChangeLog
@@ -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-11-16 Fujii Hironori <Hironori.Fujii@sony.com>

[TextureMapper] The edges of blur backdrop-filter look gradient tranparent
Expand Down
@@ -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>
22 changes: 22 additions & 0 deletions Source/WebCore/ChangeLog
@@ -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-11-03 Stephan Szabo <stephan.szabo@sony.com>

[WinCairo/PlayStation] ICU 68.1 no longer exposes FALSE and TRUE macros by default
Expand Down
11 changes: 8 additions & 3 deletions Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp
Expand Up @@ -343,6 +343,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;
}
Expand All @@ -353,7 +354,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);
}
Expand All @@ -363,9 +364,13 @@ void TextureMapperLayer::paintUsingOverlapRegions(const TextureMapperPaintOption
{
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
Expand Down
3 changes: 2 additions & 1 deletion Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h
Expand Up @@ -126,7 +126,8 @@ class WEBCORE_EXPORT TextureMapperLayer : public CanMakeWeakPtr<TextureMapperLay

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

0 comments on commit 279dc4e

Please sign in to comment.