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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 StyleImage* styleImageResource = | 68 StyleImage* styleImageResource = |
69 toCSSImageValue(value)->cacheImage(document); | 69 toCSSImageValue(value)->cacheImage(document); |
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 gradients
and canvas). | 78 // FIXME: Handle CSSImageGeneratorValue (and thus cross-fades with gradients |
| 79 // and canvas). |
79 return nullptr; | 80 return nullptr; |
80 } | 81 } |
81 | 82 |
82 ASSERT_NOT_REACHED(); | 83 ASSERT_NOT_REACHED(); |
83 | 84 |
84 return nullptr; | 85 return nullptr; |
85 } | 86 } |
86 | 87 |
87 static Image* renderableImageForCSSValue(CSSValue* value, | 88 static Image* renderableImageForCSSValue(CSSValue* value, |
88 const LayoutObject& layoutObject) { | 89 const LayoutObject& layoutObject) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 IntSize toImageSize = toImage->size(); | 165 IntSize toImageSize = toImage->size(); |
165 | 166 |
166 if (fromImage->isSVGImage()) | 167 if (fromImage->isSVGImage()) |
167 fromImageSize = roundedIntSize( | 168 fromImageSize = roundedIntSize( |
168 toSVGImage(fromImage)->concreteObjectSize(defaultObjectSize)); | 169 toSVGImage(fromImage)->concreteObjectSize(defaultObjectSize)); |
169 | 170 |
170 if (toImage->isSVGImage()) | 171 if (toImage->isSVGImage()) |
171 toImageSize = roundedIntSize( | 172 toImageSize = roundedIntSize( |
172 toSVGImage(toImage)->concreteObjectSize(defaultObjectSize)); | 173 toSVGImage(toImage)->concreteObjectSize(defaultObjectSize)); |
173 | 174 |
174 // Rounding issues can cause transitions between images of equal size to retur
n | 175 // Rounding issues can cause transitions between images of equal size to |
175 // a different fixed size; avoid performing the interpolation if the images ar
e the same size. | 176 // return a different fixed size; avoid performing the interpolation if the |
| 177 // images are the same size. |
176 if (fromImageSize == toImageSize) | 178 if (fromImageSize == toImageSize) |
177 return fromImageSize; | 179 return fromImageSize; |
178 | 180 |
179 float percentage = m_percentageValue->getFloatValue(); | 181 float percentage = m_percentageValue->getFloatValue(); |
180 float inversePercentage = 1 - percentage; | 182 float inversePercentage = 1 - percentage; |
181 | 183 |
182 return IntSize(fromImageSize.width() * inversePercentage + | 184 return IntSize(fromImageSize.width() * inversePercentage + |
183 toImageSize.width() * percentage, | 185 toImageSize.width() * percentage, |
184 fromImageSize.height() * inversePercentage + | 186 fromImageSize.height() * inversePercentage + |
185 toImageSize.height() * percentage); | 187 toImageSize.height() * percentage); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 visitor->trace(m_fromValue); | 296 visitor->trace(m_fromValue); |
295 visitor->trace(m_toValue); | 297 visitor->trace(m_toValue); |
296 visitor->trace(m_percentageValue); | 298 visitor->trace(m_percentageValue); |
297 visitor->trace(m_cachedFromImage); | 299 visitor->trace(m_cachedFromImage); |
298 visitor->trace(m_cachedToImage); | 300 visitor->trace(m_cachedToImage); |
299 visitor->trace(m_crossfadeSubimageObserver); | 301 visitor->trace(m_crossfadeSubimageObserver); |
300 CSSImageGeneratorValue::traceAfterDispatch(visitor); | 302 CSSImageGeneratorValue::traceAfterDispatch(visitor); |
301 } | 303 } |
302 | 304 |
303 } // namespace blink | 305 } // namespace blink |
OLD | NEW |