From 33ff412f21dc67f2f45a6f53c36e7e6dce9563b9 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Fri, 3 Feb 2017 22:21:29 +0000 Subject: [PATCH] Bug 1058040, part 14 - Have nsImageBoxFrame pass context paint to VectorImage. r=dholbert --- layout/xul/nsImageBoxFrame.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/layout/xul/nsImageBoxFrame.cpp b/layout/xul/nsImageBoxFrame.cpp index aa27b1d9f050..bab24227ec7b 100644 --- a/layout/xul/nsImageBoxFrame.cpp +++ b/layout/xul/nsImageBoxFrame.cpp @@ -52,6 +52,7 @@ #include "mozilla/EventDispatcher.h" #include "mozilla/Maybe.h" #include "SVGImageContext.h" +#include "Units.h" #define ONLOAD_CALLED_TOO_EARLY 1 @@ -404,13 +405,19 @@ nsImageBoxFrame::PaintImage(nsRenderingContext& aRenderingContext, anchorPoint.ptr()); } + Maybe 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); }