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 f82b56dc81efe442ce2add2a307ffd6110df9e8e..d74e9a25c615f59bd393dd962ccfab2e4c3bda3f 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& urlWithFragment) |
{ |
if (!m_page) |
return; |
@@ -213,7 +213,9 @@ 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); |
+ frameView()->processUrlFragment(urlWithFragment); |
+ |
+ drawInternal(canvas, paint, dstRect, scaledSrc, DoNotRespectImageOrientation, ClampImageToSourceRect); |
} |
PassRefPtr<SkImage> SVGImage::imageForCurrentFrame() |
@@ -223,7 +225,7 @@ PassRefPtr<SkImage> SVGImage::imageForCurrentFrame() |
SkPictureRecorder recorder; |
SkCanvas* canvas = recorder.beginRecording(width(), height()); |
- drawForContainer(canvas, SkPaint(), size(), 1, rect(), rect()); |
+ drawForContainer(canvas, SkPaint(), size(), 1, rect(), rect(), KURL()); |
RefPtr<SkPicture> picture = adoptRef(recorder.endRecording()); |
return adoptRef( |
@@ -233,7 +235,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& urlWithFragment) |
{ |
// Tile adjusted for scaling/stretch. |
FloatRect tile(srcRect); |
@@ -250,7 +252,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, urlWithFragment); |
} |
RefPtr<const SkPicture> tilePicture = patternPicture.endRecording(); |
@@ -281,18 +283,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; |
+ // Reset any previous URL fragment identifier. |
+ frameView()->processUrlFragment(KURL()); |
+ |
+ drawInternal(canvas, paint, dstRect, srcRect, shouldRespectImageOrientation, clampMode); |
+} |
+ |
+void SVGImage::drawInternal(SkCanvas* canvas, const SkPaint& paint, const FloatRect& dstRect, const FloatRect& srcRect, |
+ RespectImageOrientationEnum, ImageClampingMode) |
+{ |
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); |
- |
SkPictureBuilder imagePicture(dstRect); |
{ |
ClipRecorder clipRecorder(imagePicture.context(), *this, DisplayItem::ClipNodeImage, LayoutRect(enclosingIntRect(dstRect))); |
@@ -506,4 +514,9 @@ String SVGImage::filenameExtension() const |
return "svg"; |
} |
+IntSize SVGImage::size() const |
+{ |
+ return m_intrinsicSize; |
+} |
+ |
} |