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

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

Issue 1991513003: Lock animated property type of result animation during processing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lock-animated-property-in
Patch Set: Update comment and mention bug. Created 4 years, 7 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 471
472 SVGSMILElement* resultElement = nullptr; 472 SVGSMILElement* resultElement = nullptr;
473 for (const auto& itAnimation : scheduledAnimationsInSameGroup) { 473 for (const auto& itAnimation : scheduledAnimationsInSameGroup) {
474 SVGSMILElement* animation = itAnimation.get(); 474 SVGSMILElement* animation = itAnimation.get();
475 ASSERT(animation->timeContainer() == this); 475 ASSERT(animation->timeContainer() == this);
476 ASSERT(animation->targetElement()); 476 ASSERT(animation->targetElement());
477 ASSERT(animation->hasValidAttributeName()); 477 ASSERT(animation->hasValidAttributeName());
478 ASSERT(animation->hasValidAttributeType()); 478 ASSERT(animation->hasValidAttributeType());
479 479
480 // Results are accumulated to the first animation that animates and contributes to a particular element/attribute pair. 480 // Results are accumulated to the first animation that animates and contributes to a particular element/attribute pair.
481 if (!resultElement) 481 if (!resultElement) {
482 resultElement = animation; 482 resultElement = animation;
483 resultElement->lockAnimatedType();
484 }
483 485
484 // This will calculate the contribution from the animation and add i t to the resultElement. 486 // This will calculate the contribution from the animation and add i t to the resultElement.
485 if (!animation->progress(elapsed, resultElement, seekToTime) && resu ltElement == animation) { 487 if (!animation->progress(elapsed, resultElement, seekToTime) && resu ltElement == animation) {
488 resultElement->unlockAnimatedType();
486 resultElement->clearAnimatedType(); 489 resultElement->clearAnimatedType();
487 resultElement = nullptr; 490 resultElement = nullptr;
488 } 491 }
489 492
490 SMILTime nextFireTime = animation->nextProgressTime(); 493 SMILTime nextFireTime = animation->nextProgressTime();
491 if (nextFireTime.isFinite()) 494 if (nextFireTime.isFinite())
492 earliestFireTime = std::min(nextFireTime, earliestFireTime); 495 earliestFireTime = std::min(nextFireTime, earliestFireTime);
493 } 496 }
494 497
495 if (resultElement) 498 if (resultElement) {
496 animationsToApply.append(resultElement); 499 animationsToApply.append(resultElement);
500 resultElement->unlockAnimatedType();
501 }
497 } 502 }
498 m_scheduledAnimations.removeAll(invalidKeys); 503 m_scheduledAnimations.removeAll(invalidKeys);
499 504
500 std::sort(animationsToApply.begin(), animationsToApply.end(), PriorityCompar e(elapsed)); 505 std::sort(animationsToApply.begin(), animationsToApply.end(), PriorityCompar e(elapsed));
501 506
502 unsigned animationsToApplySize = animationsToApply.size(); 507 unsigned animationsToApplySize = animationsToApply.size();
503 if (!animationsToApplySize) { 508 if (!animationsToApplySize) {
504 #if ENABLE(ASSERT) 509 #if ENABLE(ASSERT)
505 m_preventScheduledAnimationsChanges = false; 510 m_preventScheduledAnimationsChanges = false;
506 #endif 511 #endif
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 setElapsed(elapsed().value() + initialFrameDelay); 543 setElapsed(elapsed().value() + initialFrameDelay);
539 } 544 }
540 545
541 DEFINE_TRACE(SMILTimeContainer) 546 DEFINE_TRACE(SMILTimeContainer)
542 { 547 {
543 visitor->trace(m_scheduledAnimations); 548 visitor->trace(m_scheduledAnimations);
544 visitor->trace(m_ownerSVGElement); 549 visitor->trace(m_ownerSVGElement);
545 } 550 }
546 551
547 } // namespace blink 552 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698