Changeset 258842 in webkit
- Timestamp:
- Mar 23, 2020, 7:41:04 AM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r258840 r258842 1 2020-03-23 Antoine Quint <graouts@apple.com> 2 3 [Web Animations] Refactor cancelDeclarativeAnimationsForElement and willDestroyRendererForElement on AnimationTimeline 4 https://bugs.webkit.org/show_bug.cgi?id=209423 5 6 Reviewed by Antti Koivisto. 7 8 The methods cancelDeclarativeAnimationsForElement and willDestroyRendererForElement on AnimationTimeline did the same 9 thing save for the argument passed to WebAnimation::cancel(). We now refactor those two methods into a single 10 cancelDeclarativeAnimationsForElement method with an argument to set whether cancelation should be silent. 11 As a result, we also change WebAnimation::cancel() to have a single flavor instead of one without an argument and one 12 with the silent argument. 13 14 No test because there is no change in visible behavior. 15 16 * animation/AnimationTimeline.cpp: 17 (WebCore::AnimationTimeline::elementWasRemoved): 18 (WebCore::AnimationTimeline::cancelDeclarativeAnimationsForElement): 19 (WebCore::AnimationTimeline::willDestroyRendererForElement): Deleted. 20 * animation/AnimationTimeline.h: 21 * animation/DeclarativeAnimation.cpp: 22 (WebCore::DeclarativeAnimation::cancel): 23 * animation/DeclarativeAnimation.h: 24 * animation/WebAnimation.cpp: 25 * animation/WebAnimation.h: 26 * rendering/updating/RenderTreeUpdater.cpp: 27 (WebCore::RenderTreeUpdater::tearDownRenderers): 28 1 29 2020-03-23 Youenn Fablet <youenn@apple.com> 2 30 -
trunk/Source/WebCore/animation/AnimationTimeline.cpp
r258834 r258842 189 189 } 190 190 191 void AnimationTimeline::willDestroyRendererForElement(Element& element) 191 void AnimationTimeline::elementWasRemoved(Element& element) 192 { 193 cancelDeclarativeAnimationsForElement(element, WebAnimation::Silently::Yes); 194 } 195 196 void AnimationTimeline::removeAnimationsForElement(Element& element) 197 { 198 for (auto& animation : animationsForElement(element)) 199 animation->remove(); 200 } 201 202 void AnimationTimeline::willChangeRendererForElement(Element& element) 203 { 204 for (auto& animation : animationsForElement(element)) 205 animation->willChangeRenderer(); 206 } 207 208 void AnimationTimeline::cancelDeclarativeAnimationsForElement(Element& element, WebAnimation::Silently silently) 192 209 { 193 210 if (auto* transitions = element.transitions()) { 194 211 for (auto& cssTransition : *transitions) 195 cssTransition->cancel( WebAnimation::Silently::Yes);212 cssTransition->cancel(silently); 196 213 } 197 214 … … 200 217 if (is<CSSAnimation>(cssAnimation)) 201 218 removeCSSAnimationCreatedByMarkup(element, downcast<CSSAnimation>(*cssAnimation)); 202 cssAnimation->cancel(WebAnimation::Silently::Yes); 203 } 204 } 205 } 206 207 void AnimationTimeline::elementWasRemoved(Element& element) 208 { 209 willDestroyRendererForElement(element); 210 } 211 212 void AnimationTimeline::removeAnimationsForElement(Element& element) 213 { 214 for (auto& animation : animationsForElement(element)) 215 animation->remove(); 216 } 217 218 void AnimationTimeline::willChangeRendererForElement(Element& element) 219 { 220 for (auto& animation : animationsForElement(element)) 221 animation->willChangeRenderer(); 222 } 223 224 void AnimationTimeline::cancelDeclarativeAnimationsForElement(Element& element) 225 { 226 if (auto* transitions = element.transitions()) { 227 for (auto& cssTransition : *transitions) 228 cssTransition->cancel(); 229 } 230 231 if (auto* cssAnimations = element.cssAnimations()) { 232 for (auto& cssAnimation : *cssAnimations) { 233 if (is<CSSAnimation>(cssAnimation)) 234 removeCSSAnimationCreatedByMarkup(element, downcast<CSSAnimation>(*cssAnimation)); 235 cssAnimation->cancel(); 219 cssAnimation->cancel(silently); 236 220 } 237 221 } -
trunk/Source/WebCore/animation/AnimationTimeline.h
r258834 r258842 65 65 66 66 void willChangeRendererForElement(Element&); 67 void willDestroyRendererForElement(Element&); 68 void cancelDeclarativeAnimationsForElement(Element&); 67 void cancelDeclarativeAnimationsForElement(Element&, WebAnimation::Silently); 69 68 70 69 virtual void animationWasAddedToElement(WebAnimation&, Element&); -
trunk/Source/WebCore/animation/DeclarativeAnimation.cpp
r257138 r258842 209 209 } 210 210 211 void DeclarativeAnimation::cancel( )211 void DeclarativeAnimation::cancel(Silently silently) 212 212 { 213 213 auto cancelationTime = 0_s; … … 217 217 } 218 218 219 WebAnimation::cancel( );219 WebAnimation::cancel(silently); 220 220 221 221 invalidateDOMEvents(cancelationTime); -
trunk/Source/WebCore/animation/DeclarativeAnimation.h
r257138 r258842 64 64 65 65 void setTimeline(RefPtr<AnimationTimeline>&&) final; 66 void cancel( ) final;66 void cancel(Silently = Silently::No) final; 67 67 68 68 void tick() override; -
trunk/Source/WebCore/animation/WebAnimation.cpp
r258823 r258842 603 603 // If the animation has no target effect, the target effect end is zero. 604 604 return m_effect ? m_effect->endTime() : 0_s; 605 }606 607 void WebAnimation::cancel()608 {609 cancel(Silently::No);610 invalidateEffect();611 605 } 612 606 -
trunk/Source/WebCore/animation/WebAnimation.h
r258826 r258842 94 94 FinishedPromise& finished() { return m_finishedPromise.get(); } 95 95 96 virtual void cancel(); 97 void cancel(Silently); 96 virtual void cancel(Silently = Silently::No); 98 97 ExceptionOr<void> finish(); 99 98 ExceptionOr<void> play(); -
trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp
r257899 r258842 574 574 if (timeline) { 575 575 if (document.renderTreeBeingDestroyed()) 576 timeline-> willDestroyRendererForElement(element);576 timeline->cancelDeclarativeAnimationsForElement(element, WebAnimation::Silently::Yes); 577 577 else if (teardownType == TeardownType::RendererUpdateCancelingAnimations) 578 timeline->cancelDeclarativeAnimationsForElement(element );578 timeline->cancelDeclarativeAnimationsForElement(element, WebAnimation::Silently::No); 579 579 } 580 580 animationController.cancelAnimations(element);
Note:
See TracChangeset
for help on using the changeset viewer.