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

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

Issue 2408913002: Push hasValidAttributeName/Type down into SVGAnimateElement (Closed)
Patch Set: Created 4 years, 2 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 cancelAnimationPolicyTimer(); 64 cancelAnimationPolicyTimer();
65 ASSERT(!m_wakeupTimer.isActive()); 65 ASSERT(!m_wakeupTimer.isActive());
66 #if ENABLE(ASSERT) 66 #if ENABLE(ASSERT)
67 ASSERT(!m_preventScheduledAnimationsChanges); 67 ASSERT(!m_preventScheduledAnimationsChanges);
68 #endif 68 #endif
69 } 69 }
70 70
71 void SMILTimeContainer::schedule(SVGSMILElement* animation, 71 void SMILTimeContainer::schedule(SVGSMILElement* animation,
72 SVGElement* target, 72 SVGElement* target,
73 const QualifiedName& attributeName) { 73 const QualifiedName& attributeName) {
74 ASSERT(animation->timeContainer() == this); 74 DCHECK_EQ(animation->timeContainer(), this);
75 ASSERT(target); 75 DCHECK(target);
76 ASSERT(animation->hasValidAttributeName()); 76 DCHECK(animation->hasValidTarget());
77 ASSERT(animation->hasValidAttributeType());
78 ASSERT(animation->inActiveDocument());
79 77
80 #if ENABLE(ASSERT) 78 #if ENABLE(ASSERT)
81 ASSERT(!m_preventScheduledAnimationsChanges); 79 ASSERT(!m_preventScheduledAnimationsChanges);
82 #endif 80 #endif
83 81
84 ElementAttributePair key(target, attributeName); 82 ElementAttributePair key(target, attributeName);
85 Member<AnimationsLinkedHashSet>& scheduled = 83 Member<AnimationsLinkedHashSet>& scheduled =
86 m_scheduledAnimations.add(key, nullptr).storedValue->value; 84 m_scheduledAnimations.add(key, nullptr).storedValue->value;
87 if (!scheduled) 85 if (!scheduled)
88 scheduled = new AnimationsLinkedHashSet; 86 scheduled = new AnimationsLinkedHashSet;
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 // priority. In case of a tie, document order decides. 449 // priority. In case of a tie, document order decides.
452 // FIXME: This should also consider timing relationships between the 450 // FIXME: This should also consider timing relationships between the
453 // elements. Dependents have higher priority. 451 // elements. Dependents have higher priority.
454 copyToVector(*entry.value, scheduledAnimationsInSameGroup); 452 copyToVector(*entry.value, scheduledAnimationsInSameGroup);
455 std::sort(scheduledAnimationsInSameGroup.begin(), 453 std::sort(scheduledAnimationsInSameGroup.begin(),
456 scheduledAnimationsInSameGroup.end(), PriorityCompare(elapsed)); 454 scheduledAnimationsInSameGroup.end(), PriorityCompare(elapsed));
457 455
458 AnimationsVector sandwich; 456 AnimationsVector sandwich;
459 for (const auto& itAnimation : scheduledAnimationsInSameGroup) { 457 for (const auto& itAnimation : scheduledAnimationsInSameGroup) {
460 SVGSMILElement* animation = itAnimation.get(); 458 SVGSMILElement* animation = itAnimation.get();
461 ASSERT(animation->timeContainer() == this); 459 DCHECK_EQ(animation->timeContainer(), this);
462 ASSERT(animation->targetElement()); 460 DCHECK(animation->hasValidTarget());
463 ASSERT(animation->hasValidAttributeName());
464 ASSERT(animation->hasValidAttributeType());
465 461
466 // This will calculate the contribution from the animation and update 462 // This will calculate the contribution from the animation and update
467 // timing. 463 // timing.
468 if (animation->progress(elapsed, seekToTime)) { 464 if (animation->progress(elapsed, seekToTime)) {
469 sandwich.append(animation); 465 sandwich.append(animation);
470 } else { 466 } else {
471 animation->clearAnimatedType(); 467 animation->clearAnimatedType();
472 } 468 }
473 469
474 SMILTime nextFireTime = animation->nextProgressTime(); 470 SMILTime nextFireTime = animation->nextProgressTime();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 void SMILTimeContainer::advanceFrameForTesting() { 531 void SMILTimeContainer::advanceFrameForTesting() {
536 setElapsed(elapsed() + initialFrameDelay); 532 setElapsed(elapsed() + initialFrameDelay);
537 } 533 }
538 534
539 DEFINE_TRACE(SMILTimeContainer) { 535 DEFINE_TRACE(SMILTimeContainer) {
540 visitor->trace(m_scheduledAnimations); 536 visitor->trace(m_scheduledAnimations);
541 visitor->trace(m_ownerSVGElement); 537 visitor->trace(m_ownerSVGElement);
542 } 538 }
543 539
544 } // namespace blink 540 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698