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

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: 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..bc4561ab32e7d6e0c8347d664a61f29bd8420650 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
fs 2016/01/11 15:26:46 Should be possible to dig out from m_{from,to}Valu
davve 2016/01/11 16:02:43 Follow-up planned.
+
+ if (fromImage->isSVGImage())
+ fromImageRef = SVGImageForContainer::create(toSVGImage(fromImage), size, 1.0, KURL());
fs 2016/01/11 15:26:46 Nit: 1.0 -> 1 (or 1.0f since it's a float)
davve 2016/01/11 16:02:43 Done.
+
+ if (toImage->isSVGImage())
+ toImageRef = SVGImageForContainer::create(toSVGImage(toImage), size, 1.0, 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