OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 10 matching lines...) Expand all Loading... |
21 * | 21 * |
22 */ | 22 */ |
23 | 23 |
24 #include "config.h" | 24 #include "config.h" |
25 #include "core/style/StyleFetchedImage.h" | 25 #include "core/style/StyleFetchedImage.h" |
26 | 26 |
27 #include "core/css/CSSImageValue.h" | 27 #include "core/css/CSSImageValue.h" |
28 #include "core/fetch/ImageResource.h" | 28 #include "core/fetch/ImageResource.h" |
29 #include "core/layout/LayoutObject.h" | 29 #include "core/layout/LayoutObject.h" |
30 #include "core/svg/graphics/SVGImage.h" | 30 #include "core/svg/graphics/SVGImage.h" |
| 31 #include "core/svg/graphics/SVGImageForContainer.h" |
31 | 32 |
32 namespace blink { | 33 namespace blink { |
33 | 34 |
34 StyleFetchedImage::StyleFetchedImage(ImageResource* image, Document* document) | 35 StyleFetchedImage::StyleFetchedImage(ImageResource* image, Document* document) |
35 : m_image(image) | 36 : m_image(image) |
36 , m_document(document) | 37 , m_document(document) |
37 { | 38 { |
38 m_isImageResource = true; | 39 m_isImageResource = true; |
39 m_image->addClient(this); | 40 m_image->addClient(this); |
40 } | 41 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 void StyleFetchedImage::computeIntrinsicDimensions(const LayoutObject*, Length&
intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) | 98 void StyleFetchedImage::computeIntrinsicDimensions(const LayoutObject*, Length&
intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) |
98 { | 99 { |
99 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrins
icRatio); | 100 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrins
icRatio); |
100 } | 101 } |
101 | 102 |
102 bool StyleFetchedImage::usesImageContainerSize() const | 103 bool StyleFetchedImage::usesImageContainerSize() const |
103 { | 104 { |
104 return m_image->usesImageContainerSize(); | 105 return m_image->usesImageContainerSize(); |
105 } | 106 } |
106 | 107 |
107 void StyleFetchedImage::setContainerSizeForLayoutObject(const LayoutObject* layo
utObject, const IntSize& imageContainerSize, float imageContainerZoomFactor) | |
108 { | |
109 m_image->setContainerSizeForLayoutObject(layoutObject, imageContainerSize, i
mageContainerZoomFactor); | |
110 } | |
111 | |
112 void StyleFetchedImage::addClient(LayoutObject* layoutObject) | 108 void StyleFetchedImage::addClient(LayoutObject* layoutObject) |
113 { | 109 { |
114 m_image->addClient(layoutObject); | 110 m_image->addClient(layoutObject); |
115 } | 111 } |
116 | 112 |
117 void StyleFetchedImage::removeClient(LayoutObject* layoutObject) | 113 void StyleFetchedImage::removeClient(LayoutObject* layoutObject) |
118 { | 114 { |
119 m_image->removeClient(layoutObject); | 115 m_image->removeClient(layoutObject); |
120 } | 116 } |
121 | 117 |
122 void StyleFetchedImage::notifyFinished(Resource* resource) | 118 void StyleFetchedImage::notifyFinished(Resource* resource) |
123 { | 119 { |
124 if (m_document && m_image && m_image->image() && m_image->image()->isSVGImag
e()) | 120 if (m_document && m_image && m_image->image() && m_image->image()->isSVGImag
e()) |
125 toSVGImage(m_image->image())->updateUseCounters(*m_document); | 121 toSVGImage(m_image->image())->updateUseCounters(*m_document); |
126 // Oilpan: do not prolong the Document's lifetime. | 122 // Oilpan: do not prolong the Document's lifetime. |
127 m_document.clear(); | 123 m_document.clear(); |
128 } | 124 } |
129 | 125 |
130 PassRefPtr<Image> StyleFetchedImage::image(const LayoutObject* layoutObject, con
st IntSize&) const | 126 PassRefPtr<Image> StyleFetchedImage::image(const LayoutObject*, const IntSize& c
ontainerSize, float zoom) const |
131 { | 127 { |
132 return m_image->imageForLayoutObject(layoutObject); | 128 RefPtr<Image> image = m_image->image(); |
| 129 if (image->isSVGImage()) |
| 130 return SVGImageForContainer::create(toSVGImage(image.get()), containerSi
ze, zoom); |
| 131 return image; |
133 } | 132 } |
134 | 133 |
135 bool StyleFetchedImage::knownToBeOpaque(const LayoutObject* layoutObject) const | 134 bool StyleFetchedImage::knownToBeOpaque(const LayoutObject* layoutObject) const |
136 { | 135 { |
137 return m_image->currentFrameKnownToBeOpaque(layoutObject); | 136 return m_image->currentFrameKnownToBeOpaque(layoutObject); |
138 } | 137 } |
139 | 138 |
140 DEFINE_TRACE(StyleFetchedImage) | 139 DEFINE_TRACE(StyleFetchedImage) |
141 { | 140 { |
142 visitor->trace(m_document); | 141 visitor->trace(m_document); |
143 StyleImage::trace(visitor); | 142 StyleImage::trace(visitor); |
144 } | 143 } |
145 | 144 |
146 } | 145 } |
OLD | NEW |