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

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

Issue 1996363003: Avoid calling updateAllLifecyclePhasesExceptPaint in SVGImage if not needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
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 525ee8c9a0279b03e1184b6255214832ca2158ff..2589760bc1b4aeddd209a304bb03908c75d61205 100644
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
@@ -338,11 +338,17 @@ void SVGImage::drawInternal(SkCanvas* canvas, const SkPaint& paint, const FloatR
RespectImageOrientationEnum, ImageClampingMode, const KURL& url)
{
FrameView* view = frameView();
- view->resize(containerSize());
+ bool needsLifecycleUpdateForResize = 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(url);
+ bool needsLifecycleUpdateForUrl = view->processUrlFragment(url);
+
+ bool needsLifecycleUpdate = needsLifecycleUpdateForResize || needsLifecycleUpdateForUrl;
+
+ // This is the lifecycle for the SVG document, not what HTML document might contain it.
+ if (needsLifecycleUpdate)
+ view->updateAllLifecyclePhasesExceptPaint();
fs 2016/05/23 21:25:56 Maybe add some assert too to verify lifecycle assu
SkPictureBuilder imagePicture(dstRect);
{
@@ -357,7 +363,6 @@ void SVGImage::drawInternal(SkCanvas* canvas, const SkPaint& paint, const FloatR
transform.scale(scale.width(), scale.height());
TransformRecorder transformRecorder(imagePicture.context(), imagePicture, transform);
- view->updateAllLifecyclePhasesExceptPaint();
view->paint(imagePicture.context(), CullRect(enclosingIntRect(srcRect)));
ASSERT(!view->needsLayout());
}

Powered by Google App Engine
This is Rietveld 408576698