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

Unified Diff: third_party/WebKit/Source/core/paint/SVGImagePainter.cpp

Issue 1720853002: Remove Image::computeIntrinsicDimensions() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-and-use-updateconcretesize-upload
Patch Set: Use SVGImage::concreteObjectSize Created 4 years, 10 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/paint/SVGImagePainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/SVGImagePainter.cpp b/third_party/WebKit/Source/core/paint/SVGImagePainter.cpp
index e118d126d9a5c90a8f76791d3b56e613b3648bfb..0b1ff4ed0b05f07e732b53f42bd8b3c7c350def9 100644
--- a/third_party/WebKit/Source/core/paint/SVGImagePainter.cpp
+++ b/third_party/WebKit/Source/core/paint/SVGImagePainter.cpp
@@ -14,6 +14,7 @@
#include "core/paint/SVGPaintContext.h"
#include "core/paint/TransformRecorder.h"
#include "core/svg/SVGImageElement.h"
+#include "core/svg/graphics/SVGImage.h"
#include "platform/graphics/GraphicsContext.h"
#include "third_party/skia/include/core/SkPicture.h"
@@ -80,14 +81,16 @@ FloatSize SVGImagePainter::computeImageViewportSize() const
ImageResource* cachedImage = m_layoutSVGImage.imageResource()->cachedImage();
- // Images with preserveAspectRatio=none should force non-uniform
- // scaling. This can be achieved by setting the image's container size to
- // its viewport size (i.e. if a viewBox is available - use that - else use intrinsic size.)
- // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The 'preserveAspectRatio' attribute.
- FloatSize intrinsicSize;
- FloatSize intrinsicRatio;
- cachedImage->computeIntrinsicDimensions(intrinsicSize, intrinsicRatio);
- return intrinsicRatio;
+ // Images with preserveAspectRatio=none should force non-uniform scaling. This can be achieved
+ // by setting the image's container size to its viewport size (i.e. concrete object size
+ // returned by the default sizing algorithm.) See
+ // https://www.w3.org/TR/SVG/single-page.html#coords-PreserveAspectRatioAttribute and
+ // https://drafts.csswg.org/css-images-3/#default-sizing.
+
+ if (cachedImage->image()->isSVGImage())
+ return toSVGImage(cachedImage->image())->concreteObjectSize(m_layoutSVGImage.objectBoundingBox().size());
+
+ return FloatSize(cachedImage->imageSize(DoNotRespectImageOrientation, 1));
fs 2016/03/04 15:10:10 Any reason in particular to use imageSize() here a
davve 2016/03/04 15:22:41 None other than vague plans to look over (and poss
fs 2016/03/04 15:29:05 Yeah, I don't really mind if you want to play it o
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.cpp ('k') | third_party/WebKit/Source/core/style/StyleFetchedImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698