| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 2 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 ASSERT(client); | 55 ASSERT(client); |
| 56 ASSERT(!containerSize.isEmpty()); | 56 ASSERT(!containerSize.isEmpty()); |
| 57 ASSERT(containerZoom); | 57 ASSERT(containerZoom); |
| 58 | 58 |
| 59 FloatSize containerSizeWithoutZoom(containerSize); | 59 FloatSize containerSizeWithoutZoom(containerSize); |
| 60 containerSizeWithoutZoom.scale(1 / containerZoom); | 60 containerSizeWithoutZoom.scale(1 / containerZoom); |
| 61 | 61 |
| 62 m_imageForContainerMap.set(client, SVGImageForContainer::create(m_svgImage,
containerSizeWithoutZoom, containerZoom)); | 62 m_imageForContainerMap.set(client, SVGImageForContainer::create(m_svgImage,
containerSizeWithoutZoom, containerZoom)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 IntSize SVGImageCache::imageSizeForRenderer(const RenderObject* renderer) const | 65 IntSize SVGImageCache::imageSizeForRenderer(const LayoutObject* renderer) const |
| 66 { | 66 { |
| 67 IntSize imageSize = m_svgImage->size(); | 67 IntSize imageSize = m_svgImage->size(); |
| 68 if (!renderer) | 68 if (!renderer) |
| 69 return imageSize; | 69 return imageSize; |
| 70 | 70 |
| 71 ImageForContainerMap::const_iterator it = m_imageForContainerMap.find(render
er); | 71 ImageForContainerMap::const_iterator it = m_imageForContainerMap.find(render
er); |
| 72 if (it == m_imageForContainerMap.end()) | 72 if (it == m_imageForContainerMap.end()) |
| 73 return imageSize; | 73 return imageSize; |
| 74 | 74 |
| 75 RefPtr<SVGImageForContainer> imageForContainer = it->value; | 75 RefPtr<SVGImageForContainer> imageForContainer = it->value; |
| 76 ASSERT(!imageForContainer->size().isEmpty()); | 76 ASSERT(!imageForContainer->size().isEmpty()); |
| 77 return imageForContainer->size(); | 77 return imageForContainer->size(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 // FIXME: This doesn't take into account the animation timeline so animations wi
ll not | 80 // FIXME: This doesn't take into account the animation timeline so animations wi
ll not |
| 81 // restart on page load, nor will two animations in different pages have differe
nt timelines. | 81 // restart on page load, nor will two animations in different pages have differe
nt timelines. |
| 82 Image* SVGImageCache::imageForRenderer(const RenderObject* renderer) | 82 Image* SVGImageCache::imageForRenderer(const LayoutObject* renderer) |
| 83 { | 83 { |
| 84 if (!renderer) | 84 if (!renderer) |
| 85 return Image::nullImage(); | 85 return Image::nullImage(); |
| 86 | 86 |
| 87 ImageForContainerMap::iterator it = m_imageForContainerMap.find(renderer); | 87 ImageForContainerMap::iterator it = m_imageForContainerMap.find(renderer); |
| 88 if (it == m_imageForContainerMap.end()) | 88 if (it == m_imageForContainerMap.end()) |
| 89 return Image::nullImage(); | 89 return Image::nullImage(); |
| 90 | 90 |
| 91 RefPtr<SVGImageForContainer> imageForContainer = it->value; | 91 RefPtr<SVGImageForContainer> imageForContainer = it->value; |
| 92 ASSERT(!imageForContainer->size().isEmpty()); | 92 ASSERT(!imageForContainer->size().isEmpty()); |
| 93 | 93 |
| 94 Node* node = renderer->node(); | 94 Node* node = renderer->node(); |
| 95 if (node && isHTMLImageElement(node)) { | 95 if (node && isHTMLImageElement(node)) { |
| 96 const AtomicString& urlString = toHTMLImageElement(node)->imageSourceURL
(); | 96 const AtomicString& urlString = toHTMLImageElement(node)->imageSourceURL
(); |
| 97 KURL url = node->document().completeURL(urlString); | 97 KURL url = node->document().completeURL(urlString); |
| 98 imageForContainer->setURL(url); | 98 imageForContainer->setURL(url); |
| 99 } | 99 } |
| 100 | 100 |
| 101 return imageForContainer.get(); | 101 return imageForContainer.get(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace blink | 104 } // namespace blink |
| OLD | NEW |