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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return toCSSImageValue(value)->knownToBeOpaque(layoutObject); | 53 return toCSSImageValue(value)->knownToBeOpaque(layoutObject); |
54 | 54 |
55 if (value->isImageGeneratorValue()) | 55 if (value->isImageGeneratorValue()) |
56 return toCSSImageGeneratorValue(value)->knownToBeOpaque(layoutObject); | 56 return toCSSImageGeneratorValue(value)->knownToBeOpaque(layoutObject); |
57 | 57 |
58 ASSERT_NOT_REACHED(); | 58 ASSERT_NOT_REACHED(); |
59 | 59 |
60 return false; | 60 return false; |
61 } | 61 } |
62 | 62 |
63 static ImageResource* cachedImageForCSSValue(CSSValue* value, Document* document
) | 63 static ImageResource* cachedImageForCSSValue(CSSValue* value, const Document& do
cument) |
64 { | 64 { |
65 if (!value) | 65 if (!value) |
66 return nullptr; | 66 return nullptr; |
67 | 67 |
68 if (value->isImageValue()) { | 68 if (value->isImageValue()) { |
69 StyleImage* styleImageResource = toCSSImageValue(value)->cacheImage(docu
ment); | 69 StyleImage* styleImageResource = toCSSImageValue(value)->cacheImage(docu
ment); |
70 if (!styleImageResource) | 70 if (!styleImageResource) |
71 return nullptr; | 71 return nullptr; |
72 | 72 |
73 return styleImageResource->cachedImage(); | 73 return styleImageResource->cachedImage(); |
74 } | 74 } |
75 | 75 |
76 if (value->isImageGeneratorValue()) { | 76 if (value->isImageGeneratorValue()) { |
77 toCSSImageGeneratorValue(value)->loadSubimages(document); | 77 toCSSImageGeneratorValue(value)->loadSubimages(document); |
78 // FIXME: Handle CSSImageGeneratorValue (and thus cross-fades with gradi
ents and canvas). | 78 // FIXME: Handle CSSImageGeneratorValue (and thus cross-fades with gradi
ents and canvas). |
79 return nullptr; | 79 return nullptr; |
80 } | 80 } |
81 | 81 |
82 ASSERT_NOT_REACHED(); | 82 ASSERT_NOT_REACHED(); |
83 | 83 |
84 return nullptr; | 84 return nullptr; |
85 } | 85 } |
86 | 86 |
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.doc
ument()); | 89 ImageResource* cachedImage = cachedImageForCSSValue(value, layoutObject.docu
ment()); |
90 | 90 |
91 if (!cachedImage || cachedImage->errorOccurred() || cachedImage->getImage()-
>isNull()) | 91 if (!cachedImage || cachedImage->errorOccurred() || cachedImage->getImage()-
>isNull()) |
92 return nullptr; | 92 return nullptr; |
93 | 93 |
94 return cachedImage->getImage(); | 94 return cachedImage->getImage(); |
95 } | 95 } |
96 | 96 |
97 static KURL urlForCSSValue(const CSSValue* value) | 97 static KURL urlForCSSValue(const CSSValue* value) |
98 { | 98 { |
99 if (!value->isImageValue()) | 99 if (!value->isImageValue()) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 bool CSSCrossfadeValue::isPending() const | 186 bool CSSCrossfadeValue::isPending() const |
187 { | 187 { |
188 return subimageIsPending(m_fromValue.get()) || subimageIsPending(m_toValue.g
et()); | 188 return subimageIsPending(m_fromValue.get()) || subimageIsPending(m_toValue.g
et()); |
189 } | 189 } |
190 | 190 |
191 bool CSSCrossfadeValue::knownToBeOpaque(const LayoutObject& layoutObject) const | 191 bool CSSCrossfadeValue::knownToBeOpaque(const LayoutObject& layoutObject) const |
192 { | 192 { |
193 return subimageKnownToBeOpaque(m_fromValue.get(), layoutObject) && subimageK
nownToBeOpaque(m_toValue.get(), layoutObject); | 193 return subimageKnownToBeOpaque(m_fromValue.get(), layoutObject) && subimageK
nownToBeOpaque(m_toValue.get(), layoutObject); |
194 } | 194 } |
195 | 195 |
196 void CSSCrossfadeValue::loadSubimages(Document* document) | 196 void CSSCrossfadeValue::loadSubimages(const Document& document) |
197 { | 197 { |
198 ImageResource* oldCachedFromImage = m_cachedFromImage; | 198 ImageResource* oldCachedFromImage = m_cachedFromImage; |
199 ImageResource* oldCachedToImage = m_cachedToImage; | 199 ImageResource* oldCachedToImage = m_cachedToImage; |
200 | 200 |
201 m_cachedFromImage = cachedImageForCSSValue(m_fromValue.get(), document); | 201 m_cachedFromImage = cachedImageForCSSValue(m_fromValue.get(), document); |
202 m_cachedToImage = cachedImageForCSSValue(m_toValue.get(), document); | 202 m_cachedToImage = cachedImageForCSSValue(m_toValue.get(), document); |
203 | 203 |
204 if (m_cachedFromImage != oldCachedFromImage) { | 204 if (m_cachedFromImage != oldCachedFromImage) { |
205 if (oldCachedFromImage) | 205 if (oldCachedFromImage) |
206 oldCachedFromImage->removeObserver(&m_crossfadeSubimageObserver); | 206 oldCachedFromImage->removeObserver(&m_crossfadeSubimageObserver); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 visitor->trace(m_fromValue); | 292 visitor->trace(m_fromValue); |
293 visitor->trace(m_toValue); | 293 visitor->trace(m_toValue); |
294 visitor->trace(m_percentageValue); | 294 visitor->trace(m_percentageValue); |
295 visitor->trace(m_cachedFromImage); | 295 visitor->trace(m_cachedFromImage); |
296 visitor->trace(m_cachedToImage); | 296 visitor->trace(m_cachedToImage); |
297 visitor->trace(m_crossfadeSubimageObserver); | 297 visitor->trace(m_crossfadeSubimageObserver); |
298 CSSImageGeneratorValue::traceAfterDispatch(visitor); | 298 CSSImageGeneratorValue::traceAfterDispatch(visitor); |
299 } | 299 } |
300 | 300 |
301 } // namespace blink | 301 } // namespace blink |
OLD | NEW |