 Chromium Code Reviews
 Chromium Code Reviews Issue 1120963003:
  Implements getImageAnimationPolicy() at ImageLoader.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 1120963003:
  Implements getImageAnimationPolicy() at ImageLoader.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 
| 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 
| 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 
| 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 
| 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 
| 7 | 7 | 
| 8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or | 
| 9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public | 
| 10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either | 
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 { | 96 { | 
| 97 if (m_data && !m_image && !errorOccurred()) { | 97 if (m_data && !m_image && !errorOccurred()) { | 
| 98 createImage(); | 98 createImage(); | 
| 99 m_image->setData(m_data, true); | 99 m_image->setData(m_data, true); | 
| 100 } | 100 } | 
| 101 | 101 | 
| 102 ASSERT(c->resourceClientType() == ImageResourceClient::expectedType()); | 102 ASSERT(c->resourceClientType() == ImageResourceClient::expectedType()); | 
| 103 if (m_image && !m_image->isNull()) | 103 if (m_image && !m_image->isNull()) | 
| 104 static_cast<ImageResourceClient*>(c)->imageChanged(this); | 104 static_cast<ImageResourceClient*>(c)->imageChanged(this); | 
| 105 | 105 | 
| 106 if (m_image && m_image->animationPolicy() == ImageAnimationPolicyInvalid) | |
| 107 updateImageAnimationPolicy(); | |
| 106 Resource::didAddClient(c); | 108 Resource::didAddClient(c); | 
| 107 } | 109 } | 
| 108 | 110 | 
| 109 void ImageResource::didRemoveClient(ResourceClient* c) | 111 void ImageResource::didRemoveClient(ResourceClient* c) | 
| 110 { | 112 { | 
| 111 ASSERT(c); | 113 ASSERT(c); | 
| 112 ASSERT(c->resourceClientType() == ImageResourceClient::expectedType()); | 114 ASSERT(c->resourceClientType() == ImageResourceClient::expectedType()); | 
| 113 if (m_imageForContainerMap) | 115 if (m_imageForContainerMap) | 
| 114 m_imageForContainerMap->remove(static_cast<ImageResourceClient*>(c)); | 116 m_imageForContainerMap->remove(static_cast<ImageResourceClient*>(c)); | 
| 115 | 117 | 
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 426 if (!image || image != m_image) | 428 if (!image || image != m_image) | 
| 427 return; | 429 return; | 
| 428 notifyObservers(); | 430 notifyObservers(); | 
| 429 } | 431 } | 
| 430 | 432 | 
| 431 void ImageResource::updateImageAnimationPolicy() | 433 void ImageResource::updateImageAnimationPolicy() | 
| 432 { | 434 { | 
| 433 if (!m_image) | 435 if (!m_image) | 
| 434 return; | 436 return; | 
| 435 | 437 | 
| 436 ImageAnimationPolicy newPolicy = ImageAnimationPolicyAllowed; | 438 ImageAnimationPolicy newPolicy = ImageAnimationPolicyInvalid; | 
| 437 ResourceClientWalker<ImageResourceClient> w(m_clients); | 439 ResourceClientWalker<ImageResourceClient> w(m_clients); | 
| 438 while (ImageResourceClient* c = w.next()) { | 440 while (ImageResourceClient* c = w.next()) { | 
| 439 if (c->getImageAnimationPolicy(this, newPolicy)) | 441 if (c->getImageAnimationPolicy(this, newPolicy)) | 
| 440 break; | 442 break; | 
| 441 } | 443 } | 
| 
Mike West
2015/05/01 22:43:23
Nit: Can you `ASSERT(new_policy != ImageAnimationP
 | |
| 442 | 444 | 
| 443 if (m_image->animationPolicy() != newPolicy) { | 445 if (m_image->animationPolicy() != newPolicy) { | 
| 444 m_image->resetAnimation(); | 446 m_image->resetAnimation(); | 
| 445 m_image->setAnimationPolicy(newPolicy); | 447 m_image->setAnimationPolicy(newPolicy); | 
| 446 } | 448 } | 
| 447 } | 449 } | 
| 448 | 450 | 
| 449 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect ) | 451 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect ) | 
| 450 { | 452 { | 
| 451 if (!image || image != m_image) | 453 if (!image || image != m_image) | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 if (node && isHTMLImageElement(node)) { | 512 if (node && isHTMLImageElement(node)) { | 
| 511 const AtomicString& urlString = toHTMLImageElement(node)->imageSourceURL (); | 513 const AtomicString& urlString = toHTMLImageElement(node)->imageSourceURL (); | 
| 512 KURL url = node->document().completeURL(urlString); | 514 KURL url = node->document().completeURL(urlString); | 
| 513 imageForContainer->setURL(url); | 515 imageForContainer->setURL(url); | 
| 514 } | 516 } | 
| 515 | 517 | 
| 516 return imageForContainer.get(); | 518 return imageForContainer.get(); | 
| 517 } | 519 } | 
| 518 | 520 | 
| 519 } // namespace blink | 521 } // namespace blink | 
| OLD | NEW |