Index: Source/core/paint/ImagePainter.cpp |
diff --git a/Source/core/paint/ImagePainter.cpp b/Source/core/paint/ImagePainter.cpp |
index b0373f82b4d9cd09feeaae1d5ee050dbcac19dde..41a8cc00c6530098fc48b87a61064931e139aeaf 100644 |
--- a/Source/core/paint/ImagePainter.cpp |
+++ b/Source/core/paint/ImagePainter.cpp |
@@ -11,6 +11,7 @@ |
#include "core/frame/LocalFrame.h" |
#include "core/html/HTMLAreaElement.h" |
#include "core/html/HTMLImageElement.h" |
+#include "core/html/parser/HTMLParserIdioms.h" |
#include "core/layout/LayoutImage.h" |
#include "core/layout/LayoutReplaced.h" |
#include "core/layout/TextRunConstructor.h" |
@@ -18,9 +19,11 @@ |
#include "core/paint/BoxPainter.h" |
#include "core/paint/LayoutObjectDrawingRecorder.h" |
#include "core/paint/PaintInfo.h" |
+#include "core/svg/graphics/SVGImageForContainer.h" |
#include "platform/geometry/LayoutPoint.h" |
#include "platform/graphics/Path.h" |
#include "platform/graphics/paint/ClipRecorder.h" |
+#include "platform/weborigin/KURL.h" |
namespace blink { |
@@ -132,6 +135,19 @@ void ImagePainter::paintIntoRect(GraphicsContext* context, const LayoutRect& rec |
if (!image || image->isNull()) |
return; |
+ if (image->isSVGImage()) { |
+ LayoutRect containerRect = m_layoutImage.replacedContentRect(); |
+ IntSize containerSize(containerRect.width(), containerRect.height()); |
+ KURL url; |
+ Node* node = m_layoutImage.node(); |
+ if (node && node->isHTMLElement()) { |
+ AtomicString urlString = toHTMLElement(node)->imageSourceURL(); |
+ if (!urlString.isEmpty()) |
+ url = node->document().completeURL(stripLeadingAndTrailingHTMLSpaces(urlString)); |
+ } |
+ image = SVGImageForContainer::create(toSVGImage(image.get()), containerSize, m_layoutImage.style()->effectiveZoom(), url); |
+ } |
+ |
// FIXME: why is interpolation quality selection not included in the Instrumentation reported cost of drawing an image? |
InterpolationQuality interpolationQuality = BoxPainter::chooseInterpolationQuality(m_layoutImage, context, image.get(), image.get(), LayoutSize(alignedRect.size())); |