Changeset 286642 in webkit
- Timestamp:
- Dec 7, 2021, 10:28:55 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
animation/DeclarativeAnimation.cpp (modified) (1 diff)
-
animation/DeclarativeAnimation.h (modified) (1 diff)
-
animation/WebAnimation.cpp (modified) (4 diffs)
-
animation/WebAnimation.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r286640 r286642 1 2021-12-07 Antoine Quint <graouts@webkit.org> 2 3 ActiveDOMObject::suspendIfNeeded() should not be called in the WebAnimation constructor 4 https://bugs.webkit.org/show_bug.cgi?id=233932 5 6 Reviewed by Chris Dumez. 7 8 It is not safe to call ActiveDOMObject::suspendIfNeeded() in a constructor. Since WebAnimation has several subclasses 9 (DeclarativeAnimation, and then CSSTransition and CSSAnimation deriving from DeclarativeAnimation) each with their own 10 create() methods, we add a new protected initialize() method which refactors code from the WebAnimation constructor 11 and is called from the two WebAnimation::create() methods. 12 13 DeclarativeAnimation already had an initialize method for common setup for the create() methods in CSSTransition and 14 CSS Animation, so we can simply call WebAnimation::initialize() from DeclarativeAnimation::initialize() and this guarantees 15 all create() methods for WebAnimation and all of its subclasses are correctly calling ActiveDOMObject::suspendIfNeeded(). 16 17 * animation/DeclarativeAnimation.cpp: 18 (WebCore::DeclarativeAnimation::initialize): 19 * animation/DeclarativeAnimation.h: 20 * animation/WebAnimation.cpp: 21 (WebCore::WebAnimation::create): 22 (WebCore::WebAnimation::initialize): 23 (WebCore::WebAnimation::WebAnimation): 24 * animation/WebAnimation.h: 25 1 26 2021-12-07 Wenson Hsieh <wenson_hsieh@apple.com> 2 27 -
trunk/Source/WebCore/animation/DeclarativeAnimation.cpp
r284693 r286642 108 108 void DeclarativeAnimation::initialize(const RenderStyle* oldStyle, const RenderStyle& newStyle, const Style::ResolutionContext& resolutionContext) 109 109 { 110 WebAnimation::initialize(); 111 110 112 // We need to suspend invalidation of the animation's keyframe effect during its creation 111 113 // as it would otherwise trigger invalidation of the document's style and this would be -
trunk/Source/WebCore/animation/DeclarativeAnimation.h
r284693 r286642 76 76 DeclarativeAnimation(const Styleable&, const Animation&); 77 77 78 v irtual void initialize(const RenderStyle* oldStyle, const RenderStyle& newStyle, const Style::ResolutionContext&);78 void initialize(const RenderStyle* oldStyle, const RenderStyle& newStyle, const Style::ResolutionContext&); 79 79 virtual void syncPropertiesWithBackingAnimation(); 80 80 // elapsedTime is the animation's current time at the time the event is added and is exposed through the DOM API, timelineTime is the animations' -
trunk/Source/WebCore/animation/WebAnimation.cpp
r286544 r286642 67 67 { 68 68 auto result = adoptRef(*new WebAnimation(document)); 69 result->initialize(); 69 70 result->setEffect(effect); 70 71 result->setTimeline(&document.timeline()); … … 78 79 { 79 80 auto result = adoptRef(*new WebAnimation(document)); 81 result->initialize(); 80 82 result->setEffect(effect); 81 83 if (timeline) … … 85 87 86 88 return result; 89 } 90 91 void WebAnimation::initialize() 92 { 93 suspendIfNeeded(); 94 m_readyPromise->resolve(*this); 87 95 } 88 96 … … 92 100 , m_finishedPromise(makeUniqueRef<FinishedPromise>(*this, &WebAnimation::finishedPromiseResolve)) 93 101 { 94 m_readyPromise->resolve(*this);95 suspendIfNeeded();96 97 102 instances().add(this); 98 103 } -
trunk/Source/WebCore/animation/WebAnimation.h
r284693 r286642 156 156 explicit WebAnimation(Document&); 157 157 158 void initialize(); 158 159 void enqueueAnimationEvent(Ref<AnimationEventBase>&&); 159 160
Note:
See TracChangeset
for help on using the changeset viewer.