OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 11 matching lines...) Expand all Loading... |
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/style/StyleFetchedImageSet.h" | 27 #include "core/style/StyleFetchedImageSet.h" |
28 | 28 |
29 #include "core/css/CSSImageSetValue.h" | 29 #include "core/css/CSSImageSetValue.h" |
30 #include "core/fetch/ImageResource.h" | 30 #include "core/fetch/ImageResource.h" |
31 #include "core/layout/LayoutObject.h" | 31 #include "core/layout/LayoutObject.h" |
| 32 #include "core/svg/graphics/SVGImageForContainer.h" |
32 | 33 |
33 namespace blink { | 34 namespace blink { |
34 | 35 |
35 StyleFetchedImageSet::StyleFetchedImageSet(ImageResource* image, float imageScal
eFactor, CSSImageSetValue* value) | 36 StyleFetchedImageSet::StyleFetchedImageSet(ImageResource* image, float imageScal
eFactor, CSSImageSetValue* value) |
36 : m_bestFitImage(image) | 37 : m_bestFitImage(image) |
37 , m_imageScaleFactor(imageScaleFactor) | 38 , m_imageScaleFactor(imageScaleFactor) |
38 , m_imageSetValue(value) | 39 , m_imageSetValue(value) |
39 { | 40 { |
40 m_isImageResourceSet = true; | 41 m_isImageResourceSet = true; |
41 m_bestFitImage->addClient(this); | 42 m_bestFitImage->addClient(this); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 void StyleFetchedImageSet::computeIntrinsicDimensions(const LayoutObject*, Lengt
h& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) | 103 void StyleFetchedImageSet::computeIntrinsicDimensions(const LayoutObject*, Lengt
h& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) |
103 { | 104 { |
104 m_bestFitImage->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight,
intrinsicRatio); | 105 m_bestFitImage->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight,
intrinsicRatio); |
105 } | 106 } |
106 | 107 |
107 bool StyleFetchedImageSet::usesImageContainerSize() const | 108 bool StyleFetchedImageSet::usesImageContainerSize() const |
108 { | 109 { |
109 return m_bestFitImage->usesImageContainerSize(); | 110 return m_bestFitImage->usesImageContainerSize(); |
110 } | 111 } |
111 | 112 |
112 void StyleFetchedImageSet::setContainerSizeForLayoutObject(const LayoutObject* l
ayoutObject, const IntSize& imageContainerSize, float imageContainerZoomFactor) | |
113 { | |
114 m_bestFitImage->setContainerSizeForLayoutObject(layoutObject, imageContainer
Size, imageContainerZoomFactor); | |
115 } | |
116 | |
117 void StyleFetchedImageSet::addClient(LayoutObject* layoutObject) | 113 void StyleFetchedImageSet::addClient(LayoutObject* layoutObject) |
118 { | 114 { |
119 m_bestFitImage->addClient(layoutObject); | 115 m_bestFitImage->addClient(layoutObject); |
120 } | 116 } |
121 | 117 |
122 void StyleFetchedImageSet::removeClient(LayoutObject* layoutObject) | 118 void StyleFetchedImageSet::removeClient(LayoutObject* layoutObject) |
123 { | 119 { |
124 m_bestFitImage->removeClient(layoutObject); | 120 m_bestFitImage->removeClient(layoutObject); |
125 } | 121 } |
126 | 122 |
127 PassRefPtr<Image> StyleFetchedImageSet::image(const LayoutObject* layoutObject,
const IntSize&) const | 123 PassRefPtr<Image> StyleFetchedImageSet::image(const LayoutObject*, const IntSize
& containerSize, float zoom) const |
128 { | 124 { |
129 return m_bestFitImage->imageForLayoutObject(layoutObject); | 125 RefPtr<Image> image = m_bestFitImage->image(); |
| 126 if (image && image->isSVGImage()) |
| 127 return SVGImageForContainer::create(toSVGImage(image.get()), containerSi
ze, zoom); |
| 128 return image; |
130 } | 129 } |
131 | 130 |
132 bool StyleFetchedImageSet::knownToBeOpaque(const LayoutObject* layoutObject) con
st | 131 bool StyleFetchedImageSet::knownToBeOpaque(const LayoutObject* layoutObject) con
st |
133 { | 132 { |
134 return m_bestFitImage->currentFrameKnownToBeOpaque(layoutObject); | 133 return m_bestFitImage->currentFrameKnownToBeOpaque(layoutObject); |
135 } | 134 } |
136 | 135 |
137 DEFINE_TRACE(StyleFetchedImageSet) | 136 DEFINE_TRACE(StyleFetchedImageSet) |
138 { | 137 { |
139 visitor->trace(m_imageSetValue); | 138 visitor->trace(m_imageSetValue); |
140 StyleImage::trace(visitor); | 139 StyleImage::trace(visitor); |
141 } | 140 } |
142 | 141 |
143 } // namespace blink | 142 } // namespace blink |
OLD | NEW |