- Revision
- 289455
- Author
- [email protected]
- Date
- 2022-02-08 22:39:34 -0800 (Tue, 08 Feb 2022)
Log Message
Move DocumentTimeline::runningAnimationsForRendererAreAllAccelerated() to Styleable
https://bugs.webkit.org/show_bug.cgi?id=236239
Reviewed by Dean Jackson.
This method has nothing to do with DocumentTimeline and everything to do with Styleable and its associated
effect stack. This also allows us to remove WebAnimation::isRunningAccelerated() since we don't need to go
through the animation as we iterate over keyframe effects directly.
This refactor surfaced an issue with Styleable::fromRenderer() where in the ::marker case we would fail
to correctly obtain the parent RenderListItem, we now recurse through parents until we find one instead
of stopping at the first ancestor with an element.
* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::runningAnimationsForRendererAreAllAccelerated const): Deleted.
* animation/DocumentTimeline.h:
* animation/WebAnimation.cpp:
(WebCore::WebAnimation::isRunningAccelerated const): Deleted.
* animation/WebAnimation.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::hasRunningAcceleratedAnimations const):
* style/Styleable.cpp:
(WebCore::Styleable::fromRenderer):
(WebCore::Styleable::runningAnimationsAreAllAccelerated const):
* style/Styleable.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (289454 => 289455)
--- trunk/Source/WebCore/ChangeLog 2022-02-09 06:25:57 UTC (rev 289454)
+++ trunk/Source/WebCore/ChangeLog 2022-02-09 06:39:34 UTC (rev 289455)
@@ -1,5 +1,33 @@
2022-02-08 Antoine Quint <[email protected]>
+ Move DocumentTimeline::runningAnimationsForRendererAreAllAccelerated() to Styleable
+ https://bugs.webkit.org/show_bug.cgi?id=236239
+
+ Reviewed by Dean Jackson.
+
+ This method has nothing to do with DocumentTimeline and everything to do with Styleable and its associated
+ effect stack. This also allows us to remove WebAnimation::isRunningAccelerated() since we don't need to go
+ through the animation as we iterate over keyframe effects directly.
+
+ This refactor surfaced an issue with Styleable::fromRenderer() where in the ::marker case we would fail
+ to correctly obtain the parent RenderListItem, we now recurse through parents until we find one instead
+ of stopping at the first ancestor with an element.
+
+ * animation/DocumentTimeline.cpp:
+ (WebCore::DocumentTimeline::runningAnimationsForRendererAreAllAccelerated const): Deleted.
+ * animation/DocumentTimeline.h:
+ * animation/WebAnimation.cpp:
+ (WebCore::WebAnimation::isRunningAccelerated const): Deleted.
+ * animation/WebAnimation.h:
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::hasRunningAcceleratedAnimations const):
+ * style/Styleable.cpp:
+ (WebCore::Styleable::fromRenderer):
+ (WebCore::Styleable::runningAnimationsAreAllAccelerated const):
+ * style/Styleable.h:
+
+2022-02-08 Antoine Quint <[email protected]>
+
[web-animations] additive and accumulation interpolation does not work correctly with implicit 0% and 100% keyframes
https://bugs.webkit.org/show_bug.cgi?id=236314
Modified: trunk/Source/WebCore/animation/DocumentTimeline.cpp (289454 => 289455)
--- trunk/Source/WebCore/animation/DocumentTimeline.cpp 2022-02-09 06:25:57 UTC (rev 289454)
+++ trunk/Source/WebCore/animation/DocumentTimeline.cpp 2022-02-09 06:39:34 UTC (rev 289455)
@@ -386,24 +386,6 @@
effectStack->stopAcceleratingTransformRelatedProperties(UseAcceleratedAction::No);
}
-bool DocumentTimeline::runningAnimationsForRendererAreAllAccelerated(const RenderBoxModelObject& renderer) const
-{
- auto styleable = Styleable::fromRenderer(renderer);
- if (!styleable)
- return false;
-
- auto* animations = styleable->animations();
- if (!animations || animations->isEmpty())
- return false;
-
- for (const auto& animation : *animations) {
- if (!animation->isRunningAccelerated())
- return false;
- }
-
- return true;
-}
-
void DocumentTimeline::enqueueAnimationEvent(AnimationEventBase& event)
{
m_pendingAnimationEvents.append(event);
Modified: trunk/Source/WebCore/animation/DocumentTimeline.h (289454 => 289455)
--- trunk/Source/WebCore/animation/DocumentTimeline.h 2022-02-09 06:25:57 UTC (rev 289454)
+++ trunk/Source/WebCore/animation/DocumentTimeline.h 2022-02-09 06:39:34 UTC (rev 289455)
@@ -61,7 +61,6 @@
void transitionDidComplete(RefPtr<CSSTransition>);
void animationAcceleratedRunningStateDidChange(WebAnimation&);
- bool runningAnimationsForRendererAreAllAccelerated(const RenderBoxModelObject&) const;
void detachFromDocument();
void enqueueAnimationEvent(AnimationEventBase&);
Modified: trunk/Source/WebCore/animation/WebAnimation.cpp (289454 => 289455)
--- trunk/Source/WebCore/animation/WebAnimation.cpp 2022-02-09 06:25:57 UTC (rev 289454)
+++ trunk/Source/WebCore/animation/WebAnimation.cpp 2022-02-09 06:39:34 UTC (rev 289455)
@@ -1252,11 +1252,6 @@
invalidateEffect();
}
-bool WebAnimation::isRunningAccelerated() const
-{
- return is<KeyframeEffect>(m_effect) && downcast<KeyframeEffect>(*m_effect).isRunningAccelerated();
-}
-
bool WebAnimation::needsTick() const
{
return pending() || playState() == PlayState::Running || m_hasScheduledEventsDuringTick;
Modified: trunk/Source/WebCore/animation/WebAnimation.h (289454 => 289455)
--- trunk/Source/WebCore/animation/WebAnimation.h 2022-02-09 06:25:57 UTC (rev 289454)
+++ trunk/Source/WebCore/animation/WebAnimation.h 2022-02-09 06:39:34 UTC (rev 289455)
@@ -134,7 +134,6 @@
void acceleratedStateDidChange();
void willChangeRenderer();
- bool isRunningAccelerated() const;
bool isRelevant() const { return m_isRelevant; }
void updateRelevance();
void effectTimingDidChange();
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (289454 => 289455)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2022-02-09 06:25:57 UTC (rev 289454)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2022-02-09 06:39:34 UTC (rev 289455)
@@ -31,7 +31,6 @@
#include "CachedImage.h"
#include "ColorBlending.h"
#include "Document.h"
-#include "DocumentTimeline.h"
#include "FloatRoundedRect.h"
#include "Frame.h"
#include "FrameView.h"
@@ -60,6 +59,7 @@
#include "RenderView.h"
#include "ScrollingConstraints.h"
#include "Settings.h"
+#include "Styleable.h"
#include "TextBoxPainter.h"
#include "TransformState.h"
#include <wtf/IsoMallocInlines.h>
@@ -2699,10 +2699,8 @@
bool RenderBoxModelObject::hasRunningAcceleratedAnimations() const
{
- if (auto* node = element()) {
- if (auto* timeline = node->document().existingTimeline())
- return timeline->runningAnimationsForRendererAreAllAccelerated(*this);
- }
+ if (auto styleable = Styleable::fromRenderer(*this))
+ return styleable->runningAnimationsAreAllAccelerated();
return false;
}
Modified: trunk/Source/WebCore/style/Styleable.cpp (289454 => 289455)
--- trunk/Source/WebCore/style/Styleable.cpp 2022-02-09 06:25:57 UTC (rev 289454)
+++ trunk/Source/WebCore/style/Styleable.cpp 2022-02-09 06:39:34 UTC (rev 289455)
@@ -60,15 +60,15 @@
return Styleable(topLayerElement.get(), PseudoId::Backdrop);
}
break;
- case PseudoId::Marker:
- if (auto* ancestor = renderer.parent()) {
- while (ancestor && !ancestor->element())
- ancestor = ancestor->parent();
- ASSERT(is<RenderListItem>(ancestor));
- ASSERT(downcast<RenderListItem>(ancestor)->markerRenderer() == &renderer);
- return Styleable(*ancestor->element(), PseudoId::Marker);
+ case PseudoId::Marker: {
+ auto* ancestor = renderer.parent();
+ while (ancestor) {
+ if (is<RenderListItem>(ancestor) && ancestor->element() && downcast<RenderListItem>(ancestor)->markerRenderer() == &renderer)
+ return Styleable(*ancestor->element(), PseudoId::Marker);
+ ancestor = ancestor->parent();
}
break;
+ }
case PseudoId::After:
case PseudoId::Before:
case PseudoId::None:
@@ -163,6 +163,20 @@
return false;
}
+bool Styleable::runningAnimationsAreAllAccelerated() const
+{
+ auto* effectStack = keyframeEffectStack();
+ if (!effectStack || !effectStack->hasEffects())
+ return false;
+
+ for (const auto& effect : effectStack->sortedEffects()) {
+ if (!effect->isRunningAccelerated())
+ return false;
+ }
+
+ return true;
+}
+
void Styleable::animationWasAdded(WebAnimation& animation) const
{
ensureAnimations().add(&animation);
Modified: trunk/Source/WebCore/style/Styleable.h (289454 => 289455)
--- trunk/Source/WebCore/style/Styleable.h 2022-02-09 06:25:57 UTC (rev 289454)
+++ trunk/Source/WebCore/style/Styleable.h 2022-02-09 06:39:34 UTC (rev 289455)
@@ -79,6 +79,8 @@
bool isRunningAcceleratedTransformAnimation() const;
+ bool runningAnimationsAreAllAccelerated() const;
+
KeyframeEffectStack* keyframeEffectStack() const
{
return element.keyframeEffectStack(pseudoId);