Bug 1058040, part 13 - Have nsImageBoxFrame pass context paint to VectorImage. r=dholbert
☠☠ backed out by 296647884376 ☠ ☠
authorJonathan Watt <jwatt@jwatt.org>
Fri, 27 Jan 2017 02:22:44 +0000
changeset 374573 e77029e048140ddfc860b422ec34a03a8d411b16
parent 374572 588c44c7a96616073364b7b10324f57604ef72f9
child 374574 c688b2234591df521e868c5938d63d63135ab272
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)
reviewersdholbert
bugs1058040
milestone54.0a1
Bug 1058040, part 13 - Have nsImageBoxFrame pass context paint to VectorImage. r=dholbert
layout/xul/nsImageBoxFrame.cpp
--- a/layout/xul/nsImageBoxFrame.cpp
+++ b/layout/xul/nsImageBoxFrame.cpp
@@ -47,16 +47,17 @@
 #include "nsIContent.h"
 
 #include "nsContentUtils.h"
 
 #include "mozilla/BasicEvents.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/Maybe.h"
 #include "SVGImageContext.h"
+#include "Units.h"
 
 #define ONLOAD_CALLED_TOO_EARLY 1
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::image;
 using namespace mozilla::layers;
 
@@ -399,23 +400,29 @@ nsImageBoxFrame::PaintImage(nsRenderingC
     anchorPoint.emplace();
     dest = nsLayoutUtils::ComputeObjectDestRect(constraintRect,
                                                 intrinsicSize,
                                                 intrinsicRatio,
                                                 StylePosition(),
                                                 anchorPoint.ptr());
   }
 
+  Maybe<SVGImageContext> svgContext;
+  if (imgCon->GetType() == imgIContainer::TYPE_VECTOR) {
+    // We avoid this overhead for raster images.
+    svgContext.emplace();
+    svgContext->MaybeStoreContextPaint(this);
+  }
 
   return nsLayoutUtils::DrawSingleImage(
            *aRenderingContext.ThebesContext(),
            PresContext(), imgCon,
            nsLayoutUtils::GetSamplingFilterForFrame(this),
            dest, dirty,
-           /* no SVGImageContext */ Nothing(), aFlags,
+           svgContext, aFlags,
            anchorPoint.ptrOr(nullptr),
            hasSubRect ? &mSubRect : nullptr);
 }
 
 void nsDisplayXULImage::Paint(nsDisplayListBuilder* aBuilder,
                               nsRenderingContext* aCtx)
 {
   // Even though we call StartDecoding when we get a new image we pass