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

Unified Diff: Source/core/paint/ImagePainter.cpp

Issue 1339183003: NOT FOR LANDING Experiment with allocating SVGImageForContainer on demand (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 3 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
« no previous file with comments | « Source/core/paint/BoxPainter.cpp ('k') | Source/core/paint/NinePieceImagePainter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()));
« no previous file with comments | « Source/core/paint/BoxPainter.cpp ('k') | Source/core/paint/NinePieceImagePainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698