Chromium Code Reviews| 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 |