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

Unified Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 1458083002: Support fragment URLs for more kinds of SVG images (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplification wasn't simple enough Created 5 years, 1 month 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/svg/graphics/SVGImage.cpp
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
index 4e15438852088bdfa88c01423270ceaecc7e7ba9..927986bc8376e9671343adef1612b45012348416 100644
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
@@ -194,7 +194,7 @@ IntSize SVGImage::containerSize() const
}
void SVGImage::drawForContainer(SkCanvas* canvas, const SkPaint& paint, const FloatSize containerSize, float zoom, const FloatRect& dstRect,
- const FloatRect& srcRect)
+ const FloatRect& srcRect, const KURL& url)
{
if (!m_page)
return;
@@ -213,7 +213,7 @@ void SVGImage::drawForContainer(SkCanvas* canvas, const SkPaint& paint, const Fl
adjustedSrcSize.scale(roundedContainerSize.width() / containerSize.width(), roundedContainerSize.height() / containerSize.height());
scaledSrc.setSize(adjustedSrcSize);
- draw(canvas, paint, dstRect, scaledSrc, DoNotRespectImageOrientation, ClampImageToSourceRect);
+ drawInternal(canvas, paint, dstRect, scaledSrc, DoNotRespectImageOrientation, ClampImageToSourceRect, url);
}
PassRefPtr<SkImage> SVGImage::imageForCurrentFrame()
@@ -223,7 +223,7 @@ PassRefPtr<SkImage> SVGImage::imageForCurrentFrame()
SkPictureRecorder recorder;
SkCanvas* canvas = recorder.beginRecording(width(), height());
- drawForContainer(canvas, SkPaint(), FloatSize(size()), 1, rect(), rect());
+ drawForContainer(canvas, SkPaint(), FloatSize(size()), 1, rect(), rect(), KURL());
RefPtr<SkPicture> picture = adoptRef(recorder.endRecording());
return adoptRef(
@@ -233,7 +233,7 @@ PassRefPtr<SkImage> SVGImage::imageForCurrentFrame()
void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize containerSize,
float zoom, const FloatRect& srcRect, const FloatSize& tileScale, const FloatPoint& phase,
SkXfermode::Mode compositeOp, const FloatRect& dstRect,
- const IntSize& repeatSpacing)
+ const IntSize& repeatSpacing, const KURL& url)
{
// Tile adjusted for scaling/stretch.
FloatRect tile(srcRect);
@@ -250,7 +250,7 @@ void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize
if (tile != spacedTile)
patternPicture.context().clip(tile);
SkPaint paint;
- drawForContainer(patternPicture.context().canvas(), paint, containerSize, zoom, tile, srcRect);
+ drawForContainer(patternPicture.context().canvas(), paint, containerSize, zoom, tile, srcRect, url);
}
RefPtr<const SkPicture> tilePicture = patternPicture.endRecording();
@@ -281,17 +281,24 @@ static bool drawNeedsLayer(const SkPaint& paint)
return false;
}
-void SVGImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode)
+void SVGImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect& dstRect, const FloatRect& srcRect,
+ RespectImageOrientationEnum shouldRespectImageOrientation, ImageClampingMode clampMode)
{
if (!m_page)
return;
+ drawInternal(canvas, paint, dstRect, srcRect, shouldRespectImageOrientation, clampMode, KURL());
+}
+
+void SVGImage::drawInternal(SkCanvas* canvas, const SkPaint& paint, const FloatRect& dstRect, const FloatRect& srcRect,
+ RespectImageOrientationEnum, ImageClampingMode, const KURL& url)
+{
FrameView* view = frameView();
view->resize(containerSize());
// Always call processUrlFragment, even if the url is empty, because
// there may have been a previous url/fragment that needs to be reset.
- view->processUrlFragment(m_url);
+ view->processUrlFragment(url);
SkPictureBuilder imagePicture(dstRect);
{

Powered by Google App Engine
This is Rietveld 408576698