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

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

Issue 1577843002: Fix SVG sizing in crossfaded images (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adjust test to make it more obvious when it fails Created 4 years, 11 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 d9d4263a4ba97c8631f16d0dba6cebb98f6e5ea7..459ea952645656ff98eb95947d59ce90de48acef 100644
--- a/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp
+++ b/third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp
@@ -28,6 +28,7 @@
#include "core/css/CSSImageValue.h"
#include "core/layout/LayoutObject.h"
#include "core/style/StyleFetchedImage.h"
+#include "core/svg/graphics/SVGImageForContainer.h"
#include "platform/graphics/CrossfadeGeneratedImage.h"
#include "wtf/text/StringBuilder.h"
@@ -215,7 +216,18 @@ PassRefPtr<Image> CSSCrossfadeValue::image(const LayoutObject* layoutObject, con
if (!fromImage || !toImage)
return Image::nullImage();
- m_generatedImage = CrossfadeGeneratedImage::create(fromImage, toImage, m_percentageValue->getFloatValue(), fixedSize(layoutObject), size);
+ RefPtr<Image> fromImageRef(fromImage);
+ RefPtr<Image> toImageRef(toImage);
+
+ // TODO(davve): Pass along proper URL to the SVG wrappers
+
+ if (fromImage->isSVGImage())
+ fromImageRef = SVGImageForContainer::create(toSVGImage(fromImage), size, 1, KURL());
+
+ if (toImage->isSVGImage())
+ toImageRef = SVGImageForContainer::create(toSVGImage(toImage), size, 1, KURL());
+
+ m_generatedImage = CrossfadeGeneratedImage::create(fromImageRef, toImageRef, m_percentageValue->getFloatValue(), fixedSize(layoutObject), size);
return m_generatedImage.release();
}

Powered by Google App Engine
This is Rietveld 408576698