OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 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 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "core/css/CSSCrossfadeValue.h" | 26 #include "core/css/CSSCrossfadeValue.h" |
27 | 27 |
28 #include "core/css/CSSImageValue.h" | 28 #include "core/css/CSSImageValue.h" |
29 #include "core/layout/LayoutObject.h" | 29 #include "core/layout/LayoutObject.h" |
30 #include "core/style/StyleFetchedImage.h" | 30 #include "core/style/StyleFetchedImage.h" |
| 31 #include "core/svg/graphics/SVGImageForContainer.h" |
31 #include "platform/graphics/CrossfadeGeneratedImage.h" | 32 #include "platform/graphics/CrossfadeGeneratedImage.h" |
32 #include "wtf/text/StringBuilder.h" | 33 #include "wtf/text/StringBuilder.h" |
33 | 34 |
34 namespace blink { | 35 namespace blink { |
35 | 36 |
36 static bool subimageIsPending(CSSValue* value) | 37 static bool subimageIsPending(CSSValue* value) |
37 { | 38 { |
38 if (value->isImageValue()) | 39 if (value->isImageValue()) |
39 return toCSSImageValue(value)->isCachePending(); | 40 return toCSSImageValue(value)->isCachePending(); |
40 | 41 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 { | 209 { |
209 if (size.isEmpty()) | 210 if (size.isEmpty()) |
210 return nullptr; | 211 return nullptr; |
211 | 212 |
212 Image* fromImage = renderableImageForCSSValue(m_fromValue.get(), layoutObjec
t); | 213 Image* fromImage = renderableImageForCSSValue(m_fromValue.get(), layoutObjec
t); |
213 Image* toImage = renderableImageForCSSValue(m_toValue.get(), layoutObject); | 214 Image* toImage = renderableImageForCSSValue(m_toValue.get(), layoutObject); |
214 | 215 |
215 if (!fromImage || !toImage) | 216 if (!fromImage || !toImage) |
216 return Image::nullImage(); | 217 return Image::nullImage(); |
217 | 218 |
218 m_generatedImage = CrossfadeGeneratedImage::create(fromImage, toImage, m_per
centageValue->getFloatValue(), fixedSize(layoutObject), size); | 219 RefPtr<Image> fromImageRef(fromImage); |
| 220 RefPtr<Image> toImageRef(toImage); |
| 221 |
| 222 // TODO(davve): Pass along proper URL to the SVG wrappers |
| 223 |
| 224 if (fromImage->isSVGImage()) |
| 225 fromImageRef = SVGImageForContainer::create(toSVGImage(fromImage), size,
1, KURL()); |
| 226 |
| 227 if (toImage->isSVGImage()) |
| 228 toImageRef = SVGImageForContainer::create(toSVGImage(toImage), size, 1,
KURL()); |
| 229 |
| 230 m_generatedImage = CrossfadeGeneratedImage::create(fromImageRef, toImageRef,
m_percentageValue->getFloatValue(), fixedSize(layoutObject), size); |
219 | 231 |
220 return m_generatedImage.release(); | 232 return m_generatedImage.release(); |
221 } | 233 } |
222 | 234 |
223 void CSSCrossfadeValue::crossfadeChanged(const IntRect&) | 235 void CSSCrossfadeValue::crossfadeChanged(const IntRect&) |
224 { | 236 { |
225 for (const auto& curr : clients()) { | 237 for (const auto& curr : clients()) { |
226 LayoutObject* client = const_cast<LayoutObject*>(curr.key); | 238 LayoutObject* client = const_cast<LayoutObject*>(curr.key); |
227 client->imageChanged(static_cast<WrappedImagePtr>(this)); | 239 client->imageChanged(static_cast<WrappedImagePtr>(this)); |
228 } | 240 } |
(...skipping 24 matching lines...) Expand all Loading... |
253 DEFINE_TRACE_AFTER_DISPATCH(CSSCrossfadeValue) | 265 DEFINE_TRACE_AFTER_DISPATCH(CSSCrossfadeValue) |
254 { | 266 { |
255 visitor->trace(m_fromValue); | 267 visitor->trace(m_fromValue); |
256 visitor->trace(m_toValue); | 268 visitor->trace(m_toValue); |
257 visitor->trace(m_percentageValue); | 269 visitor->trace(m_percentageValue); |
258 visitor->trace(m_crossfadeSubimageObserver); | 270 visitor->trace(m_crossfadeSubimageObserver); |
259 CSSImageGeneratorValue::traceAfterDispatch(visitor); | 271 CSSImageGeneratorValue::traceAfterDispatch(visitor); |
260 } | 272 } |
261 | 273 |
262 } // namespace blink | 274 } // namespace blink |
OLD | NEW |