-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CompositeClipPathAnimations] Fix crash caused by position: fixed.
With a translation of 0,0, a DCHECK in DrawingDisplayItem::CalculateRectKnownToBeOpaqueForRecord would fail, as the 'image size' for a deferred image is set by a parameter in the paint worklet input, which in this case was the reference box. This would fail the DCHECK when the clip path was larger than the reference box. An extra parameter has been added to the clip path paint worklet input so that the reference box is independent from the size of the clip area. The area painted when producing the deferred image has also been translated so that its origin is 0,0. This is also necessary to avoid the DCHECK. More about this change: https://docs.google.com/document/d/1gYI6G6ylpxKX0N1L23KPnaKsNOvNMaE-vM3l6RIroqU/edit Note that the test for a version of this crash caused by a rounding error is also affected by another issue (1249071), so currently this test only guards against a crash and not visually incorrect clip paths. This will be resolved in a future CL. This change also sets up a future change that resolves https://bugs.chromium.org/p/chromium/issues/detail?id=1248610 Bug: 1353038, 1249071 Change-Id: I1d62a00a92f38e06e2ae090caefced5fdf289fd9 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3866054 Reviewed-by: Robert Flack <flackr@chromium.org> Commit-Queue: Claire Chambers <clchambers@microsoft.com> Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1052298}
- Loading branch information
Claire Chambers
authored and
Chromium LUCI CQ
committed
Sep 28, 2022
1 parent
0530ee4
commit 45a1cd0
Showing
11 changed files
with
198 additions
and
20 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
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
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
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
28 changes: 28 additions & 0 deletions
28
...rnal/wpt/css/css-masking/clip-path/animations/clip-path-animation-fixed-position-ref.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,28 @@ | ||
<!DOCTYPE html> | ||
<style> | ||
.container { | ||
position: fixed; | ||
top: 100px; | ||
left: 100px; | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
clip-path: circle(200% at 35% 35%); | ||
} | ||
|
||
.big { | ||
position: absolute; | ||
top: 100px; | ||
width: 500px; | ||
height: 500px; | ||
background-color: blue; | ||
} | ||
</style> | ||
|
||
<body> | ||
<div class="container"> | ||
<div class="big"></div> | ||
</div> | ||
</body> | ||
|
||
</html> |
17 changes: 17 additions & 0 deletions
17
...s-masking/clip-path/animations/clip-path-animation-fixed-position-rounding-error-ref.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,17 @@ | ||
<!DOCTYPE html> | ||
<style> | ||
.container { | ||
position: fixed; | ||
width: 70px; | ||
height: 126px; | ||
background-color: green; | ||
clip-path: inset(5% 5%) | ||
} | ||
|
||
</style> | ||
|
||
<body> | ||
<div class="container"></div> | ||
</body> | ||
|
||
</html> |
49 changes: 49 additions & 0 deletions
49
...s/css-masking/clip-path/animations/clip-path-animation-fixed-position-rounding-error.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,49 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<meta name=fuzzy content="0-129;0-115"> | ||
<link rel="help" href="https://drafts.csswg.org/css-shapes-1/#basic-shape-interpolation"> | ||
<link rel="match" href="clip-path-animation-fixed-position-rounding-error-ref.html"> | ||
<!-- | ||
Test that clip paths on elements with position: fixed draw correctly, | ||
even in scenarios that involve partial pixels | ||
Currently uses fuzzy diff because of crbug.com/1249071 | ||
--> | ||
<style> | ||
.container { | ||
background-color: green; | ||
/* Use a long animation that start at 50% progress where the slope of the | ||
selected timing function is zero. By setting up the animation in this way, | ||
we accommodate lengthy delays in running the test without a potential drift | ||
in the animated property value. This is important for avoiding flakes, | ||
especially on debug builds. The screenshots are taken as soon as the | ||
animation is ready, thus the long animation duration has no bearing on | ||
the actual duration of the test. */ | ||
animation: clippath 1000000s cubic-bezier(0, 1, 1, 0) -500000s; | ||
position: fixed; | ||
width: 70px; | ||
height: 126px; | ||
} | ||
|
||
@keyframes clippath { | ||
0% { | ||
clip-path: inset(0% 0%); | ||
} | ||
|
||
100% { | ||
clip-path: inset(10% 10%); | ||
} | ||
} | ||
|
||
</style> | ||
<script src="/common/reftest-wait.js"></script> | ||
|
||
<body> | ||
<div class="container"></div> | ||
|
||
<script> | ||
document.getAnimations()[0].ready.then(takeScreenshot); | ||
</script> | ||
</body> | ||
|
||
</html> |
58 changes: 58 additions & 0 deletions
58
...external/wpt/css/css-masking/clip-path/animations/clip-path-animation-fixed-position.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,58 @@ | ||
<!DOCTYPE html> | ||
<html class="reftest-wait"> | ||
<link rel="help" href="https://drafts.csswg.org/css-shapes-1/#basic-shape-interpolation"> | ||
<link rel="match" href="clip-path-animation-fixed-position-ref.html"> | ||
<!-- | ||
Test that clip paths on elements with position: fixed draw correctly, | ||
including clipping children that are out of bounds. | ||
--> | ||
<style> | ||
.container { | ||
width: 100px; | ||
height: 100px; | ||
position: fixed; | ||
top: 100px; | ||
left: 100px; | ||
background-color: green; | ||
/* Use a long animation that start at 50% progress where the slope of the | ||
selected timing function is zero. By setting up the animation in this way, | ||
we accommodate lengthy delays in running the test without a potential drift | ||
in the animated property value. This is important for avoiding flakes, | ||
especially on debug builds. The screenshots are taken as soon as the | ||
animation is ready, thus the long animation duration has no bearing on | ||
the actual duration of the test. */ | ||
animation: clippath 1000000s cubic-bezier(0, 1, 1, 0) -500000s; | ||
} | ||
|
||
.big { | ||
position: absolute; | ||
top: 100px; | ||
width: 500px; | ||
height: 500px; | ||
background-color: blue; | ||
} | ||
|
||
@keyframes clippath { | ||
0% { | ||
clip-path: circle(50% at 50% 50%); | ||
} | ||
|
||
100% { | ||
clip-path: circle(350% at 20% 20%); | ||
} | ||
} | ||
|
||
</style> | ||
<script src="/common/reftest-wait.js"></script> | ||
|
||
<body> | ||
<div class="container"> | ||
<div class="big"></div> | ||
</div> | ||
|
||
<script> | ||
document.getAnimations()[0].ready.then(takeScreenshot); | ||
</script> | ||
</body> | ||
|
||
</html> |