Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: Source/core/animation/css/CSSAnimations.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/accessibility/AccessibilityTable.cpp ('k') | Source/core/css/CSSCanvasValue.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 OwnPtr<CSSAnimationUpdate> update = m_pendingUpdate.release(); 215 OwnPtr<CSSAnimationUpdate> update = m_pendingUpdate.release();
216 216
217 for (Vector<AtomicString>::const_iterator iter = update->cancelledAnimationN ames().begin(); iter != update->cancelledAnimationNames().end(); ++iter) 217 for (Vector<AtomicString>::const_iterator iter = update->cancelledAnimationN ames().begin(); iter != update->cancelledAnimationNames().end(); ++iter)
218 m_animations.take(*iter)->cancel(); 218 m_animations.take(*iter)->cancel();
219 219
220 // FIXME: Apply updates to play-state. 220 // FIXME: Apply updates to play-state.
221 221
222 for (Vector<CSSAnimationUpdate::NewAnimation>::const_iterator iter = update- >newAnimations().begin(); iter != update->newAnimations().end(); ++iter) { 222 for (Vector<CSSAnimationUpdate::NewAnimation>::const_iterator iter = update- >newAnimations().begin(); iter != update->newAnimations().end(); ++iter) {
223 OwnPtr<CSSAnimations::EventDelegate> eventDelegate = adoptPtr(new EventD elegate(element, iter->name)); 223 OwnPtr<CSSAnimations::EventDelegate> eventDelegate = adoptPtr(new EventD elegate(element, iter->name));
224 RefPtr<Animation> animation = Animation::create(element, iter->animation ->effect(), iter->animation->specified(), eventDelegate.release()); 224 RefPtr<Animation> animation = Animation::create(element, iter->animation ->effect(), iter->animation->specified(), eventDelegate.release());
225 RefPtr<Player> player = element->document()->timeline()->play(animation. get()); 225 RefPtr<Player> player = element->document().timeline()->play(animation.g et());
226 m_animations.set(iter->name, player.get()); 226 m_animations.set(iter->name, player.get());
227 } 227 }
228 } 228 }
229 229
230 void CSSAnimations::cancel() 230 void CSSAnimations::cancel()
231 { 231 {
232 for (AnimationMap::iterator iter = m_animations.begin(); iter != m_animation s.end(); ++iter) 232 for (AnimationMap::iterator iter = m_animations.begin(); iter != m_animation s.end(); ++iter)
233 iter->value->cancel(); 233 iter->value->cancel();
234 234
235 m_animations.clear(); 235 m_animations.clear();
236 m_pendingUpdate = nullptr; 236 m_pendingUpdate = nullptr;
237 } 237 }
238 238
239 void CSSAnimations::EventDelegate::maybeDispatch(Document::ListenerType listener Type, AtomicString& eventName, double elapsedTime) 239 void CSSAnimations::EventDelegate::maybeDispatch(Document::ListenerType listener Type, AtomicString& eventName, double elapsedTime)
240 { 240 {
241 if (m_target->document()->hasListenerType(listenerType)) 241 if (m_target->document().hasListenerType(listenerType))
242 m_target->document()->timeline()->addEventToDispatch(m_target, WebKitAni mationEvent::create(eventName, m_name, elapsedTime)); 242 m_target->document().timeline()->addEventToDispatch(m_target, WebKitAnim ationEvent::create(eventName, m_name, elapsedTime));
243 } 243 }
244 244
245 void CSSAnimations::EventDelegate::onEventCondition(const TimedItem* timedItem, bool isFirstSample, TimedItem::Phase previousPhase, double previousIteration) 245 void CSSAnimations::EventDelegate::onEventCondition(const TimedItem* timedItem, bool isFirstSample, TimedItem::Phase previousPhase, double previousIteration)
246 { 246 {
247 // Events for a single document are queued and dispatched as a group at 247 // Events for a single document are queued and dispatched as a group at
248 // the end of DocumentTimeline::serviceAnimations. 248 // the end of DocumentTimeline::serviceAnimations.
249 // FIXME: Events which are queued outside of serviceAnimations should 249 // FIXME: Events which are queued outside of serviceAnimations should
250 // trigger a timer to dispatch when control is released. 250 // trigger a timer to dispatch when control is released.
251 const TimedItem::Phase currentPhase = timedItem->phase(); 251 const TimedItem::Phase currentPhase = timedItem->phase();
252 const double currentIteration = timedItem->currentIteration(); 252 const double currentIteration = timedItem->currentIteration();
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 case CSSPropertyWordSpacing: 379 case CSSPropertyWordSpacing:
380 case CSSPropertyZIndex: 380 case CSSPropertyZIndex:
381 case CSSPropertyZoom: 381 case CSSPropertyZoom:
382 return true; 382 return true;
383 default: 383 default:
384 return false; 384 return false;
385 } 385 }
386 } 386 }
387 387
388 } // namespace WebCore 388 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/accessibility/AccessibilityTable.cpp ('k') | Source/core/css/CSSCanvasValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698