Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1129)

Unified Diff: third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp

Issue 1756763004: Merge image sizing algorithms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unused variable 'styleImage' in release Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp b/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp
index f85265358a5405f7a6885c2e1d332eba7dbabdf5..9f3d85c56235e3a0c061547d004b3b5f548b7891 100644
--- a/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp
+++ b/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp
@@ -159,7 +159,7 @@ PassRefPtrWillBeRawPtr<CSSCrossfadeValue> CSSCrossfadeValue::valueWithURLsMadeAb
return CSSCrossfadeValue::create(fromValue.release(), toValue.release(), m_percentageValue);
}
-IntSize CSSCrossfadeValue::fixedSize(const LayoutObject* layoutObject)
+IntSize CSSCrossfadeValue::fixedSize(const LayoutObject* layoutObject, const FloatSize& defaultObjectSize)
{
Image* fromImage = renderableImageForCSSValue(m_fromValue.get(), layoutObject);
Image* toImage = renderableImageForCSSValue(m_toValue.get(), layoutObject);
@@ -170,6 +170,12 @@ IntSize CSSCrossfadeValue::fixedSize(const LayoutObject* layoutObject)
IntSize fromImageSize = fromImage->size();
IntSize toImageSize = toImage->size();
+ if (fromImage->isSVGImage())
+ fromImageSize = roundedIntSize(toSVGImage(fromImage)->concreteObjectSize(defaultObjectSize));
+
+ if (toImage->isSVGImage())
+ toImageSize = roundedIntSize(toSVGImage(toImage)->concreteObjectSize(defaultObjectSize));
+
// Rounding issues can cause transitions between images of equal size to return
// a different fixed size; avoid performing the interpolation if the images are the same size.
if (fromImageSize == toImageSize)
@@ -237,7 +243,7 @@ PassRefPtr<Image> CSSCrossfadeValue::image(const LayoutObject* layoutObject, con
if (toImage->isSVGImage())
toImageRef = SVGImageForContainer::create(toSVGImage(toImage), size, 1, urlForCSSValue(m_toValue.get()));
- m_generatedImage = CrossfadeGeneratedImage::create(fromImageRef, toImageRef, m_percentageValue->getFloatValue(), fixedSize(layoutObject), size);
+ m_generatedImage = CrossfadeGeneratedImage::create(fromImageRef, toImageRef, m_percentageValue->getFloatValue(), fixedSize(layoutObject, FloatSize(size)), size);
return m_generatedImage.release();
}
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSCrossfadeValue.h ('k') | third_party/WebKit/Source/core/css/CSSImageGeneratorValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698