| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 result.appendLiteral(", "); | 97 result.appendLiteral(", "); |
| 98 result.append(m_toValue.cssText()); | 98 result.append(m_toValue.cssText()); |
| 99 result.appendLiteral(", "); | 99 result.appendLiteral(", "); |
| 100 result.append(m_percentageValue->cssText()); | 100 result.append(m_percentageValue->cssText()); |
| 101 result.append(')'); | 101 result.append(')'); |
| 102 return result.toString(); | 102 return result.toString(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 IntSize CSSCrossfadeValue::fixedSize(const LayoutObject* layoutObject) | 105 IntSize CSSCrossfadeValue::fixedSize(const LayoutObject* layoutObject) |
| 106 { | 106 { |
| 107 float percentage = m_percentageValue->getFloatValue(); | 107 float percentage = toCSSPrimitiveValue(*m_percentageValue).getFloatValue(); |
| 108 float inversePercentage = 1 - percentage; | 108 float inversePercentage = 1 - percentage; |
| 109 | 109 |
| 110 Document* document = &layoutObject->document(); | 110 Document* document = &layoutObject->document(); |
| 111 ImageResource* cachedFromImage = cachedImageForCSSValue(m_fromValue, documen
t); | 111 ImageResource* cachedFromImage = cachedImageForCSSValue(m_fromValue, documen
t); |
| 112 ImageResource* cachedToImage = cachedImageForCSSValue(m_toValue, document); | 112 ImageResource* cachedToImage = cachedImageForCSSValue(m_toValue, document); |
| 113 | 113 |
| 114 if (!cachedFromImage || !cachedToImage) | 114 if (!cachedFromImage || !cachedToImage) |
| 115 return IntSize(); | 115 return IntSize(); |
| 116 | 116 |
| 117 IntSize fromImageSize = cachedFromImage->imageForLayoutObject(layoutObject)-
>size(); | 117 IntSize fromImageSize = cachedFromImage->imageForLayoutObject(layoutObject)-
>size(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 if (!cachedFromImage || !cachedToImage) | 173 if (!cachedFromImage || !cachedToImage) |
| 174 return Image::nullImage(); | 174 return Image::nullImage(); |
| 175 | 175 |
| 176 Image* fromImage = cachedFromImage->imageForLayoutObject(layoutObject); | 176 Image* fromImage = cachedFromImage->imageForLayoutObject(layoutObject); |
| 177 Image* toImage = cachedToImage->imageForLayoutObject(layoutObject); | 177 Image* toImage = cachedToImage->imageForLayoutObject(layoutObject); |
| 178 | 178 |
| 179 if (!fromImage || !toImage) | 179 if (!fromImage || !toImage) |
| 180 return Image::nullImage(); | 180 return Image::nullImage(); |
| 181 | 181 |
| 182 m_generatedImage = CrossfadeGeneratedImage::create(fromImage, toImage, m_per
centageValue->getFloatValue(), fixedSize(layoutObject), size); | 182 m_generatedImage = CrossfadeGeneratedImage::create(fromImage, toImage, toCSS
PrimitiveValue(*m_percentageValue).getFloatValue(), fixedSize(layoutObject), siz
e); |
| 183 | 183 |
| 184 return m_generatedImage.release(); | 184 return m_generatedImage.release(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void CSSCrossfadeValue::crossfadeChanged(const IntRect&) | 187 void CSSCrossfadeValue::crossfadeChanged(const IntRect&) |
| 188 { | 188 { |
| 189 for (const auto& curr : clients()) { | 189 for (const auto& curr : clients()) { |
| 190 LayoutObject* client = const_cast<LayoutObject*>(curr.key); | 190 LayoutObject* client = const_cast<LayoutObject*>(curr.key); |
| 191 client->imageChanged(static_cast<WrappedImagePtr>(this)); | 191 client->imageChanged(static_cast<WrappedImagePtr>(this)); |
| 192 } | 192 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 204 return true; | 204 return true; |
| 205 if (m_cachedToImage && m_cachedToImage->loadFailedOrCanceled()) | 205 if (m_cachedToImage && m_cachedToImage->loadFailedOrCanceled()) |
| 206 return true; | 206 return true; |
| 207 return false; | 207 return false; |
| 208 } | 208 } |
| 209 | 209 |
| 210 bool CSSCrossfadeValue::equals(const CSSCrossfadeValue& other) const | 210 bool CSSCrossfadeValue::equals(const CSSCrossfadeValue& other) const |
| 211 { | 211 { |
| 212 return m_fromValue.equals(other.m_fromValue) | 212 return m_fromValue.equals(other.m_fromValue) |
| 213 && m_toValue.equals(other.m_toValue) | 213 && m_toValue.equals(other.m_toValue) |
| 214 && compareCSSValuePtr(m_percentageValue, other.m_percentageValue); | 214 && m_percentageValue == other.m_percentageValue; |
| 215 } | 215 } |
| 216 | 216 |
| 217 DEFINE_TRACE_AFTER_DISPATCH(CSSCrossfadeValue) | 217 DEFINE_TRACE_AFTER_DISPATCH(CSSCrossfadeValue) |
| 218 { | 218 { |
| 219 visitor->trace(m_fromValue); | 219 visitor->trace(m_fromValue); |
| 220 visitor->trace(m_toValue); | 220 visitor->trace(m_toValue); |
| 221 visitor->trace(m_percentageValue); | 221 visitor->trace(m_percentageValue); |
| 222 CSSImageGeneratorValue::traceAfterDispatch(visitor); | 222 CSSImageGeneratorValue::traceAfterDispatch(visitor); |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace blink | 225 } // namespace blink |
| OLD | NEW |