Skip to content

Commit d06ccb1

Browse files
committed
SkiaCompositingLayer: opacity animation doesn't damage correctly
https://bugs.webkit.org/show_bug.cgi?id=316045 Reviewed by Carlos Garcia Campos. Don't convert float opacity values into bool type before comparing. Test: platform/glib/damage/animations-opacity-2.html * LayoutTests/platform/glib/damage/animations-opacity-2-expected.txt: Added. * LayoutTests/platform/glib/damage/animations-opacity-2.html: Added. * Source/WebCore/platform/graphics/skia/SkiaCompositingLayer.cpp: (WebCore::SkiaCompositingLayer::syncAnimations): Canonical link: https://commits.webkit.org/314344@main
1 parent 54515a6 commit d06ccb1

3 files changed

Lines changed: 48 additions & 3 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PASS
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<link rel="stylesheet" href="./common.css">
5+
<style>
6+
body {
7+
margin-top: 50px;
8+
}
9+
.rect {
10+
width: 64px;
11+
height: 64px;
12+
margin-left: 50px;
13+
background-color: green;
14+
animation-name: animate;
15+
animation-duration: 5s;
16+
animation-iteration-count: infinite;
17+
animation-timing-function: linear;
18+
}
19+
@keyframes animate {
20+
from {
21+
opacity: 1.0;
22+
}
23+
to {
24+
opacity: 0.15;
25+
}
26+
}
27+
</style>
28+
</head>
29+
<body>
30+
<div class="rect">opacity animation</div>
31+
<script src="./common.js"></script>
32+
<script>
33+
setupTestCase({disableConsoleLog: true});
34+
35+
setTimeout(() => {
36+
var damage = latestFrameDamage();
37+
if (!assertEq(damage.rects.length, 1, "wrong number of damage rects")
38+
|| !assertRectsEq(damage.rects, [[50, 50, 64, 64]])) {
39+
failTest(failure);
40+
return;
41+
}
42+
passTest();
43+
}, 2000);
44+
</script>
45+
</body>
46+
</html>

Source/WebCore/platform/graphics/skia/SkiaCompositingLayer.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,7 @@ std::optional<SkiaCompositingLayer::AnimationsState> SkiaCompositingLayer::syncA
328328
}
329329
state.opacity = applicationResults.opacity;
330330
#if ENABLE(DAMAGE_TRACKING)
331-
const bool currentOpacity = opacity();
332-
const bool newOpacity = state.opacity.value_or(m_opacity);
333-
if (frameDamagePropagationEnabled() && currentOpacity != newOpacity) {
331+
if (frameDamagePropagationEnabled() && opacity() != state.opacity.value_or(m_opacity)) {
334332
damageWholeLayer();
335333
// FIXME: add collectFrameDamageDespiteBeingInvisible?
336334
}

0 commit comments

Comments
 (0)