Changeset 289455 in webkit
- Timestamp:
- Feb 8, 2022, 10:39:34 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
-
ChangeLog (modified) (1 diff)
-
animation/DocumentTimeline.cpp (modified) (1 diff)
-
animation/DocumentTimeline.h (modified) (1 diff)
-
animation/WebAnimation.cpp (modified) (1 diff)
-
animation/WebAnimation.h (modified) (1 diff)
-
rendering/RenderBoxModelObject.cpp (modified) (3 diffs)
-
style/Styleable.cpp (modified) (2 diffs)
-
style/Styleable.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r289454 r289455 1 2022-02-08 Antoine Quint <graouts@webkit.org> 2 3 Move DocumentTimeline::runningAnimationsForRendererAreAllAccelerated() to Styleable 4 https://bugs.webkit.org/show_bug.cgi?id=236239 5 6 Reviewed by Dean Jackson. 7 8 This method has nothing to do with DocumentTimeline and everything to do with Styleable and its associated 9 effect stack. This also allows us to remove WebAnimation::isRunningAccelerated() since we don't need to go 10 through the animation as we iterate over keyframe effects directly. 11 12 This refactor surfaced an issue with Styleable::fromRenderer() where in the ::marker case we would fail 13 to correctly obtain the parent RenderListItem, we now recurse through parents until we find one instead 14 of stopping at the first ancestor with an element. 15 16 * animation/DocumentTimeline.cpp: 17 (WebCore::DocumentTimeline::runningAnimationsForRendererAreAllAccelerated const): Deleted. 18 * animation/DocumentTimeline.h: 19 * animation/WebAnimation.cpp: 20 (WebCore::WebAnimation::isRunningAccelerated const): Deleted. 21 * animation/WebAnimation.h: 22 * rendering/RenderBoxModelObject.cpp: 23 (WebCore::RenderBoxModelObject::hasRunningAcceleratedAnimations const): 24 * style/Styleable.cpp: 25 (WebCore::Styleable::fromRenderer): 26 (WebCore::Styleable::runningAnimationsAreAllAccelerated const): 27 * style/Styleable.h: 28 1 29 2022-02-08 Antoine Quint <graouts@webkit.org> 2 30 -
trunk/Source/WebCore/animation/DocumentTimeline.cpp
r289357 r289455 387 387 } 388 388 389 bool DocumentTimeline::runningAnimationsForRendererAreAllAccelerated(const RenderBoxModelObject& renderer) const390 {391 auto styleable = Styleable::fromRenderer(renderer);392 if (!styleable)393 return false;394 395 auto* animations = styleable->animations();396 if (!animations || animations->isEmpty())397 return false;398 399 for (const auto& animation : *animations) {400 if (!animation->isRunningAccelerated())401 return false;402 }403 404 return true;405 }406 407 389 void DocumentTimeline::enqueueAnimationEvent(AnimationEventBase& event) 408 390 { -
trunk/Source/WebCore/animation/DocumentTimeline.h
r289357 r289455 62 62 63 63 void animationAcceleratedRunningStateDidChange(WebAnimation&); 64 bool runningAnimationsForRendererAreAllAccelerated(const RenderBoxModelObject&) const;65 64 void detachFromDocument(); 66 65 -
trunk/Source/WebCore/animation/WebAnimation.cpp
r289453 r289455 1253 1253 } 1254 1254 1255 bool WebAnimation::isRunningAccelerated() const1256 {1257 return is<KeyframeEffect>(m_effect) && downcast<KeyframeEffect>(*m_effect).isRunningAccelerated();1258 }1259 1260 1255 bool WebAnimation::needsTick() const 1261 1256 { -
trunk/Source/WebCore/animation/WebAnimation.h
r289357 r289455 135 135 void willChangeRenderer(); 136 136 137 bool isRunningAccelerated() const;138 137 bool isRelevant() const { return m_isRelevant; } 139 138 void updateRelevance(); -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r289357 r289455 32 32 #include "ColorBlending.h" 33 33 #include "Document.h" 34 #include "DocumentTimeline.h"35 34 #include "FloatRoundedRect.h" 36 35 #include "Frame.h" … … 61 60 #include "ScrollingConstraints.h" 62 61 #include "Settings.h" 62 #include "Styleable.h" 63 63 #include "TextBoxPainter.h" 64 64 #include "TransformState.h" … … 2700 2700 bool RenderBoxModelObject::hasRunningAcceleratedAnimations() const 2701 2701 { 2702 if (auto* node = element()) { 2703 if (auto* timeline = node->document().existingTimeline()) 2704 return timeline->runningAnimationsForRendererAreAllAccelerated(*this); 2705 } 2702 if (auto styleable = Styleable::fromRenderer(*this)) 2703 return styleable->runningAnimationsAreAllAccelerated(); 2706 2704 return false; 2707 2705 } -
trunk/Source/WebCore/style/Styleable.cpp
r289357 r289455 61 61 } 62 62 break; 63 case PseudoId::Marker: 64 if (auto* ancestor = renderer.parent()) { 65 while (ancestor && !ancestor->element()) 66 ancestor = ancestor->parent(); 67 ASSERT(is<RenderListItem>(ancestor)); 68 ASSERT(downcast<RenderListItem>(ancestor)->markerRenderer() == &renderer); 69 return Styleable(*ancestor->element(), PseudoId::Marker); 63 case PseudoId::Marker: { 64 auto* ancestor = renderer.parent(); 65 while (ancestor) { 66 if (is<RenderListItem>(ancestor) && ancestor->element() && downcast<RenderListItem>(ancestor)->markerRenderer() == &renderer) 67 return Styleable(*ancestor->element(), PseudoId::Marker); 68 ancestor = ancestor->parent(); 70 69 } 71 70 break; 71 } 72 72 case PseudoId::After: 73 73 case PseudoId::Before: … … 162 162 163 163 return false; 164 } 165 166 bool Styleable::runningAnimationsAreAllAccelerated() const 167 { 168 auto* effectStack = keyframeEffectStack(); 169 if (!effectStack || !effectStack->hasEffects()) 170 return false; 171 172 for (const auto& effect : effectStack->sortedEffects()) { 173 if (!effect->isRunningAccelerated()) 174 return false; 175 } 176 177 return true; 164 178 } 165 179 -
trunk/Source/WebCore/style/Styleable.h
r289357 r289455 79 79 80 80 bool isRunningAcceleratedTransformAnimation() const; 81 82 bool runningAnimationsAreAllAccelerated() const; 81 83 82 84 KeyframeEffectStack* keyframeEffectStack() const
Note:
See TracChangeset
for help on using the changeset viewer.