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

Side by Side Diff: Source/platform/graphics/BitmapImage.cpp

Issue 777013003: Reset animation state when animation policy is changed. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | no next file » | 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) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 m_repetitionCount = m_source.repetitionCount(); 436 m_repetitionCount = m_source.repetitionCount();
437 m_repetitionCountStatus = (imageKnownToBeComplete || m_repetitionCount = = cAnimationNone) ? Certain : Uncertain; 437 m_repetitionCountStatus = (imageKnownToBeComplete || m_repetitionCount = = cAnimationNone) ? Certain : Uncertain;
438 } 438 }
439 return m_repetitionCount; 439 return m_repetitionCount;
440 } 440 }
441 441
442 bool BitmapImage::shouldAnimate() 442 bool BitmapImage::shouldAnimate()
443 { 443 {
444 bool animated = repetitionCount(false) != cAnimationNone && !m_animationFini shed && imageObserver(); 444 bool animated = repetitionCount(false) != cAnimationNone && !m_animationFini shed && imageObserver();
445 if (imageObserver()) { 445 if (imageObserver()) {
446 ImageAnimationPolicy oldPolicy = m_animationPolicy;
446 imageObserver()->imageAnimationPolicy(this, m_animationPolicy); 447 imageObserver()->imageAnimationPolicy(this, m_animationPolicy);
448 if (oldPolicy != m_animationPolicy)
449 resetAnimation();
447 if (animated && m_animationPolicy == ImageAnimationPolicyNoAnimation) 450 if (animated && m_animationPolicy == ImageAnimationPolicyNoAnimation)
448 animated = false; 451 animated = false;
449 } 452 }
450 return animated; 453 return animated;
451 } 454 }
452 455
453 void BitmapImage::startAnimation(CatchUpAnimation catchUpIfNecessary) 456 void BitmapImage::startAnimation(CatchUpAnimation catchUpIfNecessary)
454 { 457 {
455 if (m_frameTimer || !shouldAnimate() || frameCount() <= 1) 458 if (m_frameTimer || !shouldAnimate() || frameCount() <= 1)
456 return; 459 return;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 656
654 return m_isSolidColor && !m_currentFrame; 657 return m_isSolidColor && !m_currentFrame;
655 } 658 }
656 659
657 Color BitmapImage::solidColor() const 660 Color BitmapImage::solidColor() const
658 { 661 {
659 return m_solidColor; 662 return m_solidColor;
660 } 663 }
661 664
662 } // namespace blink 665 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698