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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 static Image* renderableImageForCSSValue(CSSValue* value, const LayoutObject* la
youtObject) | 87 static Image* renderableImageForCSSValue(CSSValue* value, const LayoutObject* la
youtObject) |
88 { | 88 { |
89 ImageResource* cachedImage = cachedImageForCSSValue(value, &layoutObject->do
cument()); | 89 ImageResource* cachedImage = cachedImageForCSSValue(value, &layoutObject->do
cument()); |
90 | 90 |
91 if (!cachedImage || !cachedImage->canRender()) | 91 if (!cachedImage || !cachedImage->canRender()) |
92 return nullptr; | 92 return nullptr; |
93 | 93 |
94 return cachedImage->image(); | 94 return cachedImage->image(); |
95 } | 95 } |
96 | 96 |
| 97 static KURL urlForCSSValue(const CSSValue* value) |
| 98 { |
| 99 if (!value->isImageValue()) |
| 100 return KURL(); |
| 101 |
| 102 return KURL(ParsedURLString, toCSSImageValue(*value).url()); |
| 103 } |
| 104 |
97 CSSCrossfadeValue::CSSCrossfadeValue(PassRefPtrWillBeRawPtr<CSSValue> fromValue,
PassRefPtrWillBeRawPtr<CSSValue> toValue, PassRefPtrWillBeRawPtr<CSSPrimitiveVa
lue> percentageValue) | 105 CSSCrossfadeValue::CSSCrossfadeValue(PassRefPtrWillBeRawPtr<CSSValue> fromValue,
PassRefPtrWillBeRawPtr<CSSValue> toValue, PassRefPtrWillBeRawPtr<CSSPrimitiveVa
lue> percentageValue) |
98 : CSSImageGeneratorValue(CrossfadeClass) | 106 : CSSImageGeneratorValue(CrossfadeClass) |
99 , m_fromValue(fromValue) | 107 , m_fromValue(fromValue) |
100 , m_toValue(toValue) | 108 , m_toValue(toValue) |
101 , m_percentageValue(percentageValue) | 109 , m_percentageValue(percentageValue) |
102 , m_cachedFromImage(nullptr) | 110 , m_cachedFromImage(nullptr) |
103 , m_cachedToImage(nullptr) | 111 , m_cachedToImage(nullptr) |
104 , m_crossfadeSubimageObserver(this) | 112 , m_crossfadeSubimageObserver(this) |
105 { | 113 { |
106 #if ENABLE(OILPAN) | 114 #if ENABLE(OILPAN) |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 220 |
213 Image* fromImage = renderableImageForCSSValue(m_fromValue.get(), layoutObjec
t); | 221 Image* fromImage = renderableImageForCSSValue(m_fromValue.get(), layoutObjec
t); |
214 Image* toImage = renderableImageForCSSValue(m_toValue.get(), layoutObject); | 222 Image* toImage = renderableImageForCSSValue(m_toValue.get(), layoutObject); |
215 | 223 |
216 if (!fromImage || !toImage) | 224 if (!fromImage || !toImage) |
217 return Image::nullImage(); | 225 return Image::nullImage(); |
218 | 226 |
219 RefPtr<Image> fromImageRef(fromImage); | 227 RefPtr<Image> fromImageRef(fromImage); |
220 RefPtr<Image> toImageRef(toImage); | 228 RefPtr<Image> toImageRef(toImage); |
221 | 229 |
222 // TODO(davve): Pass along proper URL to the SVG wrappers | |
223 | |
224 if (fromImage->isSVGImage()) | 230 if (fromImage->isSVGImage()) |
225 fromImageRef = SVGImageForContainer::create(toSVGImage(fromImage), size,
1, KURL()); | 231 fromImageRef = SVGImageForContainer::create(toSVGImage(fromImage), size,
1, urlForCSSValue(m_fromValue.get())); |
226 | 232 |
227 if (toImage->isSVGImage()) | 233 if (toImage->isSVGImage()) |
228 toImageRef = SVGImageForContainer::create(toSVGImage(toImage), size, 1,
KURL()); | 234 toImageRef = SVGImageForContainer::create(toSVGImage(toImage), size, 1,
urlForCSSValue(m_toValue.get())); |
229 | 235 |
230 m_generatedImage = CrossfadeGeneratedImage::create(fromImageRef, toImageRef,
m_percentageValue->getFloatValue(), fixedSize(layoutObject), size); | 236 m_generatedImage = CrossfadeGeneratedImage::create(fromImageRef, toImageRef,
m_percentageValue->getFloatValue(), fixedSize(layoutObject), size); |
231 | 237 |
232 return m_generatedImage.release(); | 238 return m_generatedImage.release(); |
233 } | 239 } |
234 | 240 |
235 void CSSCrossfadeValue::crossfadeChanged(const IntRect&) | 241 void CSSCrossfadeValue::crossfadeChanged(const IntRect&) |
236 { | 242 { |
237 for (const auto& curr : clients()) { | 243 for (const auto& curr : clients()) { |
238 LayoutObject* client = const_cast<LayoutObject*>(curr.key); | 244 LayoutObject* client = const_cast<LayoutObject*>(curr.key); |
(...skipping 26 matching lines...) Expand all Loading... |
265 DEFINE_TRACE_AFTER_DISPATCH(CSSCrossfadeValue) | 271 DEFINE_TRACE_AFTER_DISPATCH(CSSCrossfadeValue) |
266 { | 272 { |
267 visitor->trace(m_fromValue); | 273 visitor->trace(m_fromValue); |
268 visitor->trace(m_toValue); | 274 visitor->trace(m_toValue); |
269 visitor->trace(m_percentageValue); | 275 visitor->trace(m_percentageValue); |
270 visitor->trace(m_crossfadeSubimageObserver); | 276 visitor->trace(m_crossfadeSubimageObserver); |
271 CSSImageGeneratorValue::traceAfterDispatch(visitor); | 277 CSSImageGeneratorValue::traceAfterDispatch(visitor); |
272 } | 278 } |
273 | 279 |
274 } // namespace blink | 280 } // namespace blink |
OLD | NEW |