OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |