Bug 1341881. Don't do sync decode for SVG <image> elements images. r=aosmond a=gchang
authorTimothy Nikkel <tnikkel@gmail.com>
Wed, 22 Feb 2017 18:58:42 -0600
changeset 359444 66e711359af5799d9f133f59fab3d730cf8a20cb
parent 359443 1e60fbfb7a056a09a5a7c91591f0d17326c9b604
child 359445 eeeb9c132d0ed10d0f76f51a4b25cfb2f76bd671
push id10801
push usercbook@mozilla.com
push dateFri, 24 Feb 2017 11:37:55 +0000
treeherdermozilla-aurora@66e711359af5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaosmond, gchang
Bug 1341881. Don't do sync decode for SVG <image> elements images. r=aosmond a=gchang SVG <image> elements have approximately the same level of visibility tracking as regular html <img>s so we shouldn't need to do sync decode. It shows up in some profiles. The comment being removed was written a long time ago, before image visibility tracking for one. We could even go a step further and ask for no sync decoding at all, but one step at a time to make sure this doesn't cause any regressions.
--- a/layout/svg/nsSVGImageFrame.cpp
+++ b/layout/svg/nsSVGImageFrame.cpp
@@ -384,21 +384,17 @@ nsSVGImageFrame::PaintSVG(gfxContext& aC
       dirtyRect = ToAppUnits(*aDirtyRect, appUnitsPerDevPx);
       // Adjust dirtyRect to match our local coordinate system.
       nsRect rootRect =
         nsSVGUtils::TransformFrameRectToOuterSVG(mRect, aTransform,
-    // XXXbholley - I don't think huge images in SVGs are common enough to
-    // warrant worrying about the responsiveness impact of doing synchronous
-    // decodes. The extra code complexity of determinining when we want to
-    // force sync probably just isn't worth it, so always pass FLAG_SYNC_DECODE
-    uint32_t drawFlags = imgIContainer::FLAG_SYNC_DECODE;
+    uint32_t drawFlags = imgIContainer::FLAG_SYNC_DECODE_IF_FAST;
     if (mImageContainer->GetType() == imgIContainer::TYPE_VECTOR) {
       // Package up the attributes of this image element which can override the
       // attributes of mImageContainer's internal SVG document.  The 'width' &
       // 'height' values we're passing in here are in CSS units (though they
       // come from width/height *attributes* in SVG). They influence the region
       // of the SVG image's internal document that is visible, in combination
       // with preserveAspectRatio and viewBox.