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

Side by Side Diff: Source/core/svg/animation/SMILTimeContainer.cpp

Issue 99533004: [SVG] Implement 'discard' element (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 , m_timer(this, &SMILTimeContainer::timerFired) 47 , m_timer(this, &SMILTimeContainer::timerFired)
48 , m_ownerSVGElement(owner) 48 , m_ownerSVGElement(owner)
49 #ifndef NDEBUG 49 #ifndef NDEBUG
50 , m_preventScheduledAnimationsChanges(false) 50 , m_preventScheduledAnimationsChanges(false)
51 #endif 51 #endif
52 { 52 {
53 } 53 }
54 54
55 SMILTimeContainer::~SMILTimeContainer() 55 SMILTimeContainer::~SMILTimeContainer()
56 { 56 {
57 m_timer.stop();
58 ASSERT(!m_timer.isActive());
57 #ifndef NDEBUG 59 #ifndef NDEBUG
58 ASSERT(!m_preventScheduledAnimationsChanges); 60 ASSERT(!m_preventScheduledAnimationsChanges);
59 #endif 61 #endif
60 } 62 }
61 63
62 void SMILTimeContainer::schedule(SVGSMILElement* animation, SVGElement* target, const QualifiedName& attributeName) 64 void SMILTimeContainer::schedule(SVGSMILElement* animation, SVGElement* target, const QualifiedName& attributeName)
63 { 65 {
64 ASSERT(animation->timeContainer() == this); 66 ASSERT(animation->timeContainer() == this);
65 ASSERT(target); 67 ASSERT(target);
66 ASSERT(animation->hasValidAttributeName()); 68 ASSERT(animation->hasValidAttributeName());
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 void SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime) 259 void SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime)
258 { 260 {
259 SMILTime earliestFireTime = SMILTime::unresolved(); 261 SMILTime earliestFireTime = SMILTime::unresolved();
260 262
261 #ifndef NDEBUG 263 #ifndef NDEBUG
262 // This boolean will catch any attempts to schedule/unschedule scheduledAnim ations during this critical section. 264 // This boolean will catch any attempts to schedule/unschedule scheduledAnim ations during this critical section.
263 // Similarly, any elements removed will unschedule themselves, so this will catch modification of animationsToApply. 265 // Similarly, any elements removed will unschedule themselves, so this will catch modification of animationsToApply.
264 m_preventScheduledAnimationsChanges = true; 266 m_preventScheduledAnimationsChanges = true;
265 #endif 267 #endif
266 268
267 AnimationsVector animationsToApply; 269 Vector< RefPtr<SVGSMILElement> > animationsToApply;
Inactive 2014/01/11 16:31:26 We usually add an extra white space only on the ri
pavane 2014/01/11 17:14:18 Done.
268 GroupedAnimationsMap::iterator end = m_scheduledAnimations.end(); 270 GroupedAnimationsMap::iterator end = m_scheduledAnimations.end();
269 for (GroupedAnimationsMap::iterator it = m_scheduledAnimations.begin(); it ! = end; ++it) { 271 for (GroupedAnimationsMap::iterator it = m_scheduledAnimations.begin(); it ! = end; ++it) {
270 AnimationsVector* scheduled = it->value.get(); 272 AnimationsVector* scheduled = it->value.get();
271 273
272 // Sort according to priority. Elements with later begin time have highe r priority. 274 // Sort according to priority. Elements with later begin time have highe r priority.
273 // In case of a tie, document order decides. 275 // In case of a tie, document order decides.
274 // FIXME: This should also consider timing relationships between the ele ments. Dependents 276 // FIXME: This should also consider timing relationships between the ele ments. Dependents
275 // have higher priority. 277 // have higher priority.
276 sortByPriority(*scheduled, elapsed); 278 sortByPriority(*scheduled, elapsed);
277 279
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 316
315 // Apply results to target elements. 317 // Apply results to target elements.
316 for (unsigned i = 0; i < animationsToApplySize; ++i) 318 for (unsigned i = 0; i < animationsToApplySize; ++i)
317 animationsToApply[i]->applyResultsToTarget(); 319 animationsToApply[i]->applyResultsToTarget();
318 320
319 #ifndef NDEBUG 321 #ifndef NDEBUG
320 m_preventScheduledAnimationsChanges = false; 322 m_preventScheduledAnimationsChanges = false;
321 #endif 323 #endif
322 324
323 startTimer(earliestFireTime, animationFrameDelay); 325 startTimer(earliestFireTime, animationFrameDelay);
326
327 for (unsigned n = 0; n < animationsToApplySize; ++n) {
Inactive 2014/01/11 16:31:26 Any reason you're not using i as loop counter, lik
pavane 2014/01/11 17:14:18 No specific reason. :) Done.
328 if (animationsToApply[n]->inDocument() && animationsToApply[n]->isSVGDis cardElement()) {
329 RefPtr<SVGSMILElement> animDiscard = animationsToApply[n];
330 RefPtr<SVGElement> targetElement = animDiscard->targetElement();
331 if (targetElement && targetElement->inDocument()) {
332 targetElement->remove(IGNORE_EXCEPTION);
333 ASSERT(!targetElement->inDocument());
334 }
335
336 if (animDiscard->inDocument()) {
337 animDiscard->remove(IGNORE_EXCEPTION);
338 ASSERT(!animDiscard->inDocument());
339 }
340 }
341 }
324 } 342 }
325 343
326 } 344 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698