Bug 1341881. Don't do sync decode for SVG <image> elements images. r=aosmond
authorTimothy Nikkel <tnikkel@gmail.com>
Wed, 22 Feb 2017 18:58:42 -0600
changeset 373469 c61b11debf423499104a9c547590850f63a56fa4
parent 373468 f608a5a5d8e2472396a0f4cd04778730866b8ae0
child 373470 abc0e81104d5467d095d44f01042f9abce5cd633
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
Bug 1341881. Don't do sync decode for SVG <image> elements images. r=aosmond 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.