Changeset 107575 in webkit
- Timestamp:
- Feb 13, 2012 8:39:34 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/compositing/repaint/become-overlay-composited-layer.html
r44817 r107575 52 52 window.setTimeout(function() { 53 53 document.getElementById("container").className = ""; 54 if (window.layoutTestController) 55 layoutTestController.notifyDone(); 54 window.setTimeout(function() { 55 if (window.layoutTestController) 56 layoutTestController.notifyDone(); 57 }, 250); 56 58 }, 250); 57 59 } -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r107563 r107575 997 997 // SVG TESTS 998 998 // ----------------------------------------------------------------- 999 1000 // Need rebaselining after bug 64591 1001 BUGWK64591 : compositing/repaint/become-overlay-composited-layer.html = PASS FAIL 999 1002 1000 1003 BUGCR8763 MAC : svg/custom/use-on-g-containing-foreignObject-and-image.svg = IMAGE -
trunk/Source/WebCore/ChangeLog
r107574 r107575 1 2012-02-13 Joel Webber <jgw@google.com> 2 3 Use requestAnimationFrame callbacks to pump CSS animations 4 https://bugs.webkit.org/show_bug.cgi?id=64591 5 6 Reviewed by James Robinson. 7 8 No new tests needed (covered by tests in animations/*). 9 10 * page/FrameView.cpp: 11 (WebCore::FrameView::serviceScriptedAnimations): 12 * page/animation/AnimationController.cpp: 13 (WebCore::AnimationControllerPrivate::updateAnimations): 14 (WebCore::AnimationControllerPrivate::updateAnimationTimer): 15 (WebCore::AnimationControllerPrivate::fireEventsAndUpdateStyle): 16 (WebCore::AnimationControllerPrivate::animationFrameCallbackFired): 17 (WebCore::AnimationController::updateAnimations): 18 (WebCore::AnimationController::serviceAnimations): 19 * page/animation/AnimationController.h: 20 * page/animation/AnimationControllerPrivate.h: 21 1 22 2012-02-13 Patrick Gansterer <paroga@webkit.org> 2 23 -
trunk/Source/WebCore/page/FrameView.cpp
r107472 r107575 2114 2114 void FrameView::serviceScriptedAnimations(DOMTimeStamp time) 2115 2115 { 2116 Vector<AnimationController*> animations; 2117 for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext()) 2118 frame->animation()->serviceAnimations(); 2119 2116 2120 Vector<RefPtr<Document> > documents; 2117 2118 2121 for (Frame* frame = m_frame.get(); frame; frame = frame->tree()->traverseNext()) 2119 2122 documents.append(frame->document()); -
trunk/Source/WebCore/page/animation/AnimationController.cpp
r95901 r107575 36 36 #include "EventNames.h" 37 37 #include "Frame.h" 38 #include "FrameView.h" 38 39 #include "RenderView.h" 39 40 #include "WebKitAnimationEvent.h" … … 45 46 namespace WebCore { 46 47 47 // FIXME: Why isn't this set to 60fps or something?48 48 static const double cAnimationTimerDelay = 0.025; 49 49 static const double cBeginAnimationUpdateTimeNotSet = -1; … … 85 85 } 86 86 87 void AnimationControllerPrivate::updateAnimationTimer(bool callSetChanged/* = false*/)88 { 89 double needsService = -1;87 double AnimationControllerPrivate::updateAnimations(SetChanged callSetChanged/* = DoNotCallSetChanged*/) 88 { 89 double timeToNextService = -1; 90 90 bool calledSetChanged = false; 91 91 … … 95 95 if (!compAnim->suspended() && compAnim->hasAnimations()) { 96 96 double t = compAnim->timeToNextService(); 97 if (t != -1 && (t < needsService || needsService == -1))98 needsService = t;99 if ( needsService == 0) {100 if (callSetChanged ) {97 if (t != -1 && (t < timeToNextService || timeToNextService == -1)) 98 timeToNextService = t; 99 if (!timeToNextService) { 100 if (callSetChanged == CallSetChanged) { 101 101 Node* node = it->first->node(); 102 102 ASSERT(!node || (node->document() && !node->document()->inPageCache())); … … 109 109 } 110 110 } 111 111 112 112 if (calledSetChanged) 113 113 m_frame->document()->updateStyleIfNeeded(); 114 114 115 return timeToNextService; 116 } 117 118 void AnimationControllerPrivate::updateAnimationTimer(SetChanged callSetChanged/* = DoNotCallSetChanged*/) 119 { 120 double timeToNextService = updateAnimations(callSetChanged); 121 115 122 // If we want service immediately, we start a repeating timer to reduce the overhead of starting 116 if ( needsService == 0) {123 if (!timeToNextService) { 117 124 if (!m_animationTimer.isActive() || m_animationTimer.repeatInterval() == 0) 118 125 m_animationTimer.startRepeating(cAnimationTimerDelay); 119 126 return; 120 127 } 121 128 122 129 // If we don't need service, we want to make sure the timer is no longer running 123 if ( needsService < 0) {130 if (timeToNextService < 0) { 124 131 if (m_animationTimer.isActive()) 125 132 m_animationTimer.stop(); 126 133 return; 127 134 } 128 135 129 136 // Otherwise, we want to start a one-shot timer so we get here again 130 137 if (m_animationTimer.isActive()) 131 138 m_animationTimer.stop(); 132 m_animationTimer.startOneShot( needsService);139 m_animationTimer.startOneShot(timeToNextService); 133 140 } 134 141 … … 144 151 145 152 bool updateStyle = !m_eventsToDispatch.isEmpty() || !m_nodeChangesToDispatch.isEmpty(); 146 153 147 154 // fire all the events 148 155 Vector<EventToDispatch> eventsToDispatch = m_eventsToDispatch; … … 155 162 it->element->dispatchEvent(WebKitAnimationEvent::create(it->eventType, it->name, it->elapsedTime)); 156 163 } 157 164 158 165 // call setChanged on all the elements 159 166 Vector<RefPtr<Node> >::const_iterator nodeChangesToDispatchEnd = m_nodeChangesToDispatch.end(); 160 167 for (Vector<RefPtr<Node> >::const_iterator it = m_nodeChangesToDispatch.begin(); it != nodeChangesToDispatchEnd; ++it) 161 168 (*it)->setNeedsStyleRecalc(SyntheticStyleChange); 162 169 163 170 m_nodeChangesToDispatch.clear(); 164 171 165 172 if (updateStyle && m_frame) 166 173 m_frame->document()->updateStyleIfNeeded(); … … 195 202 } 196 203 204 #if ENABLE(REQUEST_ANIMATION_FRAME) 205 void AnimationControllerPrivate::animationFrameCallbackFired() 206 { 207 double timeToNextService = updateAnimations(CallSetChanged); 208 209 if (timeToNextService >= 0) 210 m_frame->document()->view()->scheduleAnimation(); 211 } 212 #endif 213 197 214 void AnimationControllerPrivate::animationTimerFired(Timer<AnimationControllerPrivate>*) 198 215 { … … 203 220 // When the timer fires, all we do is call setChanged on all DOM nodes with running animations and then do an immediate 204 221 // updateStyleIfNeeded. It will then call back to us with new information. 205 updateAnimationTimer( true);222 updateAnimationTimer(CallSetChanged); 206 223 207 224 // Fire events right away, to avoid a flash of unanimated style after an animation completes, and before … … 500 517 RefPtr<RenderStyle> blendedStyle = rendererAnimations->animate(renderer, oldStyle, newStyle); 501 518 502 if (renderer->parent() || newStyle->animations() || (oldStyle && oldStyle->animations())) 519 if (renderer->parent() || newStyle->animations() || (oldStyle && oldStyle->animations())) { 503 520 m_data->updateAnimationTimer(); 521 #if ENABLE(REQUEST_ANIMATION_FRAME) 522 if (FrameView* view = renderer->document()->view()) 523 view->scheduleAnimation(); 524 #endif 525 } 504 526 505 527 if (blendedStyle != newStyle) { … … 558 580 } 559 581 582 #if ENABLE(REQUEST_ANIMATION_FRAME) 583 void AnimationController::serviceAnimations() 584 { 585 m_data->animationFrameCallbackFired(); 586 } 587 #endif 588 560 589 void AnimationController::suspendAnimationsForDocument(Document* document) 561 590 { -
trunk/Source/WebCore/page/animation/AnimationController.h
r93481 r107575 67 67 void suspendAnimations(); 68 68 void resumeAnimations(); 69 #if ENABLE(REQUEST_ANIMATION_FRAME) 70 void serviceAnimations(); 71 #endif 69 72 70 73 void suspendAnimationsForDocument(Document*); -
trunk/Source/WebCore/page/animation/AnimationControllerPrivate.h
r95901 r107575 52 52 class WebKitAnimationList; 53 53 54 enum SetChanged { 55 DoNotCallSetChanged = 0, 56 CallSetChanged = 1 57 }; 58 54 59 class AnimationControllerPrivate { 55 60 WTF_MAKE_NONCOPYABLE(AnimationControllerPrivate); WTF_MAKE_FAST_ALLOCATED; … … 58 63 ~AnimationControllerPrivate(); 59 64 60 void updateAnimationTimer(bool callSetChanged = false); 65 // Returns the time until the next animation needs to be serviced, or -1 if there are none. 66 double updateAnimations(SetChanged callSetChanged = DoNotCallSetChanged); 67 void updateAnimationTimer(SetChanged callSetChanged = DoNotCallSetChanged); 61 68 62 69 PassRefPtr<CompositeAnimation> accessCompositeAnimation(RenderObject*); … … 72 79 void suspendAnimations(); 73 80 void resumeAnimations(); 81 #if ENABLE(REQUEST_ANIMATION_FRAME) 82 void animationFrameCallbackFired(); 83 #endif 74 84 75 85 void suspendAnimationsForDocument(Document*);
Note: See TracChangeset
for help on using the changeset viewer.