Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
TextureMapper: if an element has both a mask image and reflection, th…
…e part of the reflection isn't painted https://bugs.webkit.org/show_bug.cgi?id=241257 Reviewed by Don Olmstead. If an element has both a mask image and reflection, the mask should be applied both for the reflection and the real layers. However, TextureMapper was using a single intermediate surface for painting the reflection and the real layers. 1. Painting the reflection layer 2. Applying the mask to the reflection layer 3. Painting the real layer 4. Applying the mask to the real layer In the step#4, if the mask layer is larger than the element rect, the mask was unexpectedly applied to the part of the reflection. The reflection and the real layers should be painted and masked separately using intermediate surfaces. If the element has opacity, they should have another intermediate surface to blend together with the destination. * LayoutTests/compositing/reflections/mask-and-reflection-expected.html: Added. * LayoutTests/compositing/reflections/mask-and-reflection.html: Added. * Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::shouldBlend const): (WebCore::TextureMapperLayer::paintSelfAndChildrenWithReplica): (WebCore::TextureMapperLayer::paintUsingOverlapRegions): (WebCore::TextureMapperLayer::paintSelfChildrenFilterAndMask): (WebCore::TextureMapperLayer::paintIntoSurface): (WebCore::TextureMapperLayer::paintWithIntermediateSurface): (WebCore::TextureMapperLayer::paintSelfAndChildrenWithIntermediateSurface): (WebCore::TextureMapperLayer::paintSelfChildrenReplicaFilterAndMask): (WebCore::TextureMapperLayer::paintRecursive): (WebCore::TextureMapperLayer::setMaskLayer): * Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h: Canonical link: https://commits.webkit.org/251519@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
4 changed files
with
162 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style> | ||
.outer { | ||
width: 100px; | ||
height: 100px; | ||
-webkit-box-reflect: below 10px; | ||
} | ||
|
||
.inner { | ||
width: 100px; | ||
height: 100px; | ||
-webkit-box-reflect: right 10px; | ||
background-color: green; | ||
will-change: transform; | ||
-webkit-mask-image: linear-gradient(-45deg, black, transparent); | ||
mask-image: linear-gradient(-45deg, black, transparent); | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<p>You should see four mirrored square boxes with linear gradient green.</p> | ||
<div class="outer"> | ||
<div class="inner"> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style> | ||
.outer { | ||
width: 100px; | ||
height: 100px; | ||
-webkit-box-reflect: below 10px; | ||
} | ||
|
||
.inner { | ||
width: 100px; | ||
height: 100px; | ||
-webkit-box-reflect: right 10px; | ||
background-color: green; | ||
will-change: transform; | ||
-webkit-mask-image: linear-gradient(-45deg, black, transparent); | ||
mask-image: linear-gradient(-45deg, black, transparent); | ||
} | ||
|
||
.child { | ||
position: relative; | ||
top: 100px; | ||
left: 100px; | ||
width: 100px; | ||
height: 100px; | ||
background-color: blue; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<p>You should see four mirrored square boxes with linear gradient green.</p> | ||
<div class="outer"> | ||
<div class="inner"> | ||
<div class="child"> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters