| 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 f6da1bc6dc0161c5e9b47fcef3d879af9bf922b4..7118746d4f600518142fd978de34961c18fa0bd6 100644
|
| --- a/third_party/WebKit/Source/core/paint/SVGImagePainter.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/SVGImagePainter.cpp
|
| @@ -5,6 +5,7 @@
|
| #include "config.h"
|
| #include "core/paint/SVGImagePainter.h"
|
|
|
| +#include "core/html/parser/HTMLParserIdioms.h"
|
| #include "core/layout/ImageQualityController.h"
|
| #include "core/layout/LayoutImageResource.h"
|
| #include "core/layout/svg/LayoutSVGImage.h"
|
| @@ -15,6 +16,7 @@
|
| #include "core/paint/SVGPaintContext.h"
|
| #include "core/paint/TransformRecorder.h"
|
| #include "core/svg/SVGImageElement.h"
|
| +#include "core/svg/graphics/SVGImageForContainer.h"
|
| #include "platform/graphics/GraphicsContext.h"
|
| #include "third_party/skia/include/core/SkPicture.h"
|
|
|
| @@ -51,11 +53,23 @@ void SVGImagePainter::paint(const PaintInfo& paintInfo)
|
|
|
| void SVGImagePainter::paintForeground(const PaintInfo& paintInfo)
|
| {
|
| - RefPtr<Image> image = m_layoutSVGImage.imageResource()->image();
|
| + const LayoutImageResource* imageResource = m_layoutSVGImage.imageResource();
|
| + ImageResource* cachedImage = imageResource->cachedImage();
|
| + IntSize imageViewportSize;
|
| + if (cachedImage)
|
| + imageViewportSize = expandedIntSize(m_layoutSVGImage.computeImageViewportSize(*cachedImage));
|
| + if (imageViewportSize.isEmpty())
|
| + return;
|
| + SVGImageElement* imageElement = toSVGImageElement(m_layoutSVGImage.element());
|
| + KURL url;
|
| + AtomicString urlString = imageElement->imageSourceURL();
|
| + if (!urlString.isEmpty())
|
| + url = imageElement->document().completeURL(stripLeadingAndTrailingHTMLSpaces(urlString));
|
| +
|
| + RefPtr<Image> image = imageResource->image(imageViewportSize, m_layoutSVGImage.style()->effectiveZoom(), url);
|
| FloatRect destRect = m_layoutSVGImage.objectBoundingBox();
|
| FloatRect srcRect(0, 0, image->width(), image->height());
|
|
|
| - SVGImageElement* imageElement = toSVGImageElement(m_layoutSVGImage.element());
|
| imageElement->preserveAspectRatio()->currentValue()->transformRect(destRect, srcRect);
|
|
|
| InterpolationQuality interpolationQuality = InterpolationDefault;
|
|
|