Changeset 155100 in webkit for trunk/Source/WebCore/css/CSSCrossfadeValue.cpp
- Timestamp:
- Sep 4, 2013, 11:50:05 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/css/CSSCrossfadeValue.cpp
r155060 r155100 1 1 /* 2 2 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 3 4 * 4 5 * Redistribution and use in source and binary forms, with or without … … 27 28 #include "CSSCrossfadeValue.h" 28 29 30 #include "AnimationUtilities.h" 29 31 #include "CSSImageValue.h" 30 32 #include "CachedResourceLoader.h" … … 37 39 38 40 namespace WebCore { 41 42 static inline double blendFunc(double from, double to, double progress) 43 { 44 return blend(from, to, progress); 45 } 39 46 40 47 static bool subimageKnownToBeOpaque(CSSValue* value, const RenderObject* renderer) … … 179 186 } 180 187 188 PassRefPtr<CSSCrossfadeValue> CSSCrossfadeValue::blend(const CSSCrossfadeValue& from, double progress) const 189 { 190 ASSERT(equalInputImages(from)); 191 RefPtr<StyleCachedImage> toStyledImage = StyleCachedImage::create(m_cachedToImage.get()); 192 RefPtr<StyleCachedImage> fromStyledImage = StyleCachedImage::create(m_cachedFromImage.get()); 193 194 RefPtr<CSSImageValue> fromImageValue = CSSImageValue::create(m_cachedFromImage->url(), fromStyledImage.get()); 195 RefPtr<CSSImageValue> toImageValue = CSSImageValue::create(m_cachedToImage->url(), toStyledImage.get()); 196 197 RefPtr<CSSCrossfadeValue> crossfadeValue = CSSCrossfadeValue::create(fromImageValue, toImageValue); 198 199 double fromPercentage = from.m_percentageValue->getDoubleValue(); 200 if (from.m_percentageValue->isPercentage()) 201 fromPercentage /= 100.0; 202 double toPercentage = m_percentageValue->getDoubleValue(); 203 if (m_percentageValue->isPercentage()) 204 toPercentage /= 100.0; 205 crossfadeValue->setPercentage(CSSPrimitiveValue::create(blendFunc(fromPercentage, toPercentage, progress), CSSPrimitiveValue::CSS_NUMBER)); 206 return crossfadeValue.release(); 207 } 208 181 209 bool CSSCrossfadeValue::equals(const CSSCrossfadeValue& other) const 182 210 { 211 return equalInputImages(other) 212 && compareCSSValuePtr(m_percentageValue, other.m_percentageValue); 213 } 214 215 216 bool CSSCrossfadeValue::equalInputImages(const CSSCrossfadeValue& other) const 217 { 183 218 return compareCSSValuePtr(m_fromValue, other.m_fromValue) 184 && compareCSSValuePtr(m_toValue, other.m_toValue) 185 && compareCSSValuePtr(m_percentageValue, other.m_percentageValue); 219 && compareCSSValuePtr(m_toValue, other.m_toValue); 186 220 } 187 221
Note:
See TracChangeset
for help on using the changeset viewer.