1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
Upstream-Status: Pending
Patch from https://trac.webkit.org/changeset/254680/webkit
diff --git a/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.cpp b/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.cpp
index e44966440ea..7789eddc3cb 100644
--- a/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.cpp
+++ b/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.cpp
@@ -223,8 +223,8 @@ Animation& Animation::operator=(const Animation& other)
void Animation::apply(ApplicationResult& applicationResults, MonotonicTime time)
{
- if (!isActive())
- return;
+ // Even when m_state == AnimationState::Stopped && !m_fillsForwards, we should calculate the last value to avoid a flash.
+ // CoordinatedGraphicsScene will soon remove the stopped animation and update the value instead of this function.
Seconds totalRunningTime = computeTotalRunningTime(time);
double normalizedValue = normalizedAnimationValue(totalRunningTime.seconds(), m_duration, m_direction, m_iterationCount);
@@ -232,8 +232,7 @@ void Animation::apply(ApplicationResult& applicationResults, MonotonicTime time)
if (m_iterationCount != WebCore::Animation::IterationCountInfinite && totalRunningTime.seconds() >= m_duration * m_iterationCount) {
m_state = AnimationState::Stopped;
m_pauseTime = 0_s;
- if (m_fillsForwards)
- normalizedValue = normalizedAnimationValueForFillsForwards(m_iterationCount, m_direction);
+ normalizedValue = normalizedAnimationValueForFillsForwards(m_iterationCount, m_direction);
}
applicationResults.hasRunningAnimations |= (m_state == AnimationState::Playing);
@@ -308,11 +307,6 @@ Seconds Animation::computeTotalRunningTime(MonotonicTime time)
return m_totalRunningTime;
}
-bool Animation::isActive() const
-{
- return m_state != AnimationState::Stopped || m_fillsForwards;
-}
-
void Animation::applyInternal(ApplicationResult& applicationResults, const AnimationValue& from, const AnimationValue& to, float progress)
{
switch (m_keyframes.property()) {
@@ -390,7 +384,7 @@ bool Animations::hasActiveAnimationsOfType(AnimatedPropertyID type) const
{
return std::any_of(m_animations.begin(), m_animations.end(),
[&type](const Animation& animation) {
- return animation.isActive() && animation.keyframes().property() == type;
+ return animation.keyframes().property() == type;
});
}
@@ -402,14 +396,4 @@ bool Animations::hasRunningAnimations() const
});
}
-Animations Animations::getActiveAnimations() const
-{
- Animations active;
- for (auto& animation : m_animations) {
- if (animation.isActive())
- active.add(animation);
- }
- return active;
-}
-
} // namespace Nicosia
diff --git a/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.h b/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.h
index 24ffe9dab5c..d8cd1dc1c10 100644
--- a/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.h
+++ b/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.h
@@ -53,7 +53,6 @@ public:
void applyKeepingInternalState(ApplicationResult&, MonotonicTime);
void pause(Seconds);
void resume();
- bool isActive() const;
const String& name() const { return m_name; }
const WebCore::KeyframeValueList& keyframes() const { return m_keyframes; }
@@ -101,7 +100,6 @@ public:
bool hasRunningAnimations() const;
bool hasActiveAnimationsOfType(WebCore::AnimatedPropertyID type) const;
- Animations getActiveAnimations() const;
private:
Vector<Animation> m_animations;
diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
index bd690e5c351..b28a907173a 100644
--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
@@ -874,7 +874,7 @@ void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly()
if (localDelta.filtersChanged)
state.filters = filters();
if (localDelta.animationsChanged)
- state.animations = m_animations.getActiveAnimations();
+ state.animations = m_animations;
if (localDelta.childrenChanged) {
state.children = WTF::map(children(),
|