Title: [289156] trunk/Source/WebCore
- Revision
- 289156
- Author
- [email protected]
- Date
- 2022-02-05 08:35:53 -0800 (Sat, 05 Feb 2022)
Log Message
[Web Animations] DocumentTimeline::getAnimatedStyle() should be on Styleable
https://bugs.webkit.org/show_bug.cgi?id=236176
Reviewed by Dean Jackson.
There is no need to go through the DocumentTimeline to compute the animated
style for a renderer. Styleable is a more appropriate place for this.
* animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::animatedStyleForRenderer): Deleted.
* animation/DocumentTimeline.h:
* rendering/RenderElement.cpp:
(WebCore::RenderElement::animatedStyle):
* style/Styleable.cpp:
(WebCore::Styleable::computeAnimatedStyle const):
* style/Styleable.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (289155 => 289156)
--- trunk/Source/WebCore/ChangeLog 2022-02-05 16:28:36 UTC (rev 289155)
+++ trunk/Source/WebCore/ChangeLog 2022-02-05 16:35:53 UTC (rev 289156)
@@ -1,3 +1,22 @@
+2022-02-05 Antoine Quint <[email protected]>
+
+ [Web Animations] DocumentTimeline::getAnimatedStyle() should be on Styleable
+ https://bugs.webkit.org/show_bug.cgi?id=236176
+
+ Reviewed by Dean Jackson.
+
+ There is no need to go through the DocumentTimeline to compute the animated
+ style for a renderer. Styleable is a more appropriate place for this.
+
+ * animation/DocumentTimeline.cpp:
+ (WebCore::DocumentTimeline::animatedStyleForRenderer): Deleted.
+ * animation/DocumentTimeline.h:
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::animatedStyle):
+ * style/Styleable.cpp:
+ (WebCore::Styleable::computeAnimatedStyle const):
+ * style/Styleable.h:
+
2022-02-05 Alan Bujtas <[email protected]>
[LFC][IFC] Move all the line box vertical alignment logic to LineBoxVerticalAligner
Modified: trunk/Source/WebCore/animation/DocumentTimeline.cpp (289155 => 289156)
--- trunk/Source/WebCore/animation/DocumentTimeline.cpp 2022-02-05 16:28:36 UTC (rev 289155)
+++ trunk/Source/WebCore/animation/DocumentTimeline.cpp 2022-02-05 16:35:53 UTC (rev 289156)
@@ -387,26 +387,6 @@
return false;
}
-std::unique_ptr<RenderStyle> DocumentTimeline::animatedStyleForRenderer(RenderElement& renderer)
-{
- auto styleable = Styleable::fromRenderer(renderer);
- if (!styleable)
- return RenderStyle::clonePtr(renderer.style());
-
- auto* effectStack = styleable->keyframeEffectStack();
- if (!effectStack)
- return RenderStyle::clonePtr(renderer.style());
-
- std::unique_ptr<RenderStyle> result;
- for (const auto& effect : effectStack->sortedEffects())
- effect->getAnimatedStyle(result);
-
- if (!result)
- result = RenderStyle::clonePtr(renderer.style());
-
- return result;
-}
-
void DocumentTimeline::animationAcceleratedRunningStateDidChange(WebAnimation& animation)
{
m_acceleratedAnimationsPendingRunningStateChange.add(&animation);
Modified: trunk/Source/WebCore/animation/DocumentTimeline.h (289155 => 289156)
--- trunk/Source/WebCore/animation/DocumentTimeline.h 2022-02-05 16:28:36 UTC (rev 289155)
+++ trunk/Source/WebCore/animation/DocumentTimeline.h 2022-02-05 16:35:53 UTC (rev 289156)
@@ -64,7 +64,6 @@
// using the given rect, returning the result in the rect. Return false if there is some
// transform animation but we were unable to cheaply compute its effect on the extent.
bool computeExtentOfAnimation(RenderElement&, LayoutRect&) const;
- std::unique_ptr<RenderStyle> animatedStyleForRenderer(RenderElement& renderer);
bool isRunningAcceleratedAnimationOnRenderer(RenderElement&, CSSPropertyID) const;
void animationAcceleratedRunningStateDidChange(WebAnimation&);
bool runningAnimationsForRendererAreAllAccelerated(const RenderBoxModelObject&) const;
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (289155 => 289156)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2022-02-05 16:28:36 UTC (rev 289155)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2022-02-05 16:35:53 UTC (rev 289156)
@@ -84,6 +84,7 @@
#include "ShadowRoot.h"
#include "StylePendingResources.h"
#include "StyleResolver.h"
+#include "Styleable.h"
#include "TextAutoSizing.h"
#include <wtf/IsoMallocInlines.h>
#include <wtf/MathExtras.h>
@@ -2394,8 +2395,8 @@
{
std::unique_ptr<RenderStyle> result;
- if (auto* timeline = documentTimeline())
- result = timeline->animatedStyleForRenderer(*this);
+ if (auto styleable = Styleable::fromRenderer(*this))
+ result = styleable->computeAnimatedStyle();
if (!result)
result = RenderStyle::clonePtr(style());
Modified: trunk/Source/WebCore/style/Styleable.cpp (289155 => 289156)
--- trunk/Source/WebCore/style/Styleable.cpp 2022-02-05 16:28:36 UTC (rev 289155)
+++ trunk/Source/WebCore/style/Styleable.cpp 2022-02-05 16:35:53 UTC (rev 289156)
@@ -113,6 +113,20 @@
return nullptr;
}
+std::unique_ptr<RenderStyle> Styleable::computeAnimatedStyle() const
+{
+ std::unique_ptr<RenderStyle> animatedStyle;
+
+ auto* effectStack = keyframeEffectStack();
+ if (!effectStack)
+ return animatedStyle;
+
+ for (const auto& effect : effectStack->sortedEffects())
+ effect->getAnimatedStyle(animatedStyle);
+
+ return animatedStyle;
+}
+
void Styleable::animationWasAdded(WebAnimation& animation) const
{
ensureAnimations().add(&animation);
Modified: trunk/Source/WebCore/style/Styleable.h (289155 => 289156)
--- trunk/Source/WebCore/style/Styleable.h 2022-02-05 16:28:36 UTC (rev 289155)
+++ trunk/Source/WebCore/style/Styleable.h 2022-02-05 16:35:53 UTC (rev 289156)
@@ -70,6 +70,8 @@
RenderElement* renderer() const;
+ std::unique_ptr<RenderStyle> computeAnimatedStyle() const;
+
KeyframeEffectStack* keyframeEffectStack() const
{
return element.keyframeEffectStack(pseudoId);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes