Bug 1358690, part 2 - Support context paint in SVG when drawn as a CSS background image. r=dholbert

This commit is contained in:
Jonathan Watt 2017-03-28 12:07:39 +01:00
parent 78700a27ae
commit 37da8dc765
3 changed files with 8 additions and 4 deletions

View File

@ -6786,6 +6786,7 @@ nsLayoutUtils::ComputeSizeForDrawingWithFallback(imgIContainer* aImage,
/* static */ DrawResult
nsLayoutUtils::DrawBackgroundImage(gfxContext& aContext,
nsIFrame* aForFrame,
nsPresContext* aPresContext,
imgIContainer* aImage,
const CSSIntSize& aImageSize,
@ -6802,7 +6803,8 @@ nsLayoutUtils::DrawBackgroundImage(gfxContext& aContext,
PROFILER_LABEL("layout", "nsLayoutUtils::DrawBackgroundImage",
js::ProfileEntry::Category::GRAPHICS);
const Maybe<SVGImageContext> svgContext(Some(SVGImageContext(Some(aImageSize))));
Maybe<SVGImageContext> svgContext(Some(SVGImageContext(Some(aImageSize))));
SVGImageContext::MaybeStoreContextPaint(svgContext, aForFrame, aImage);
/* Fast path when there is no need for image spacing */
if (aRepeatSize.width == aDest.width && aRepeatSize.height == aDest.height) {

View File

@ -1774,9 +1774,10 @@ public:
* Draw a background image. The image's dimensions are as specified in aDest;
* the image itself is not consulted to determine a size.
* See https://wiki.mozilla.org/Gecko:Image_Snapping_and_Rendering
* @param aRenderingContext Where to draw the image, set up with an
* @param aContext The context to draw to, already set up with an
* appropriate scale and transform for drawing in
* app units.
* @param aForFrame The nsIFrame that we're drawing this image for.
* @param aImage The image.
* @param aImageSize The unscaled size of the image being drawn.
* (This might be the image's size if no scaling
@ -1798,6 +1799,7 @@ public:
* @param aExtendMode How to extend the image over the dest rect.
*/
static DrawResult DrawBackgroundImage(gfxContext& aContext,
nsIFrame* aForFrame,
nsPresContext* aPresContext,
imgIContainer* aImage,
const CSSIntSize& aImageSize,

View File

@ -513,7 +513,7 @@ nsImageRenderer::Draw(nsPresContext* aPresContext,
CSSIntSize imageSize(nsPresContext::AppUnitsToIntCSSPixels(mSize.width),
nsPresContext::AppUnitsToIntCSSPixels(mSize.height));
result =
nsLayoutUtils::DrawBackgroundImage(*ctx,
nsLayoutUtils::DrawBackgroundImage(*ctx, mForFrame,
aPresContext,
mImageContainer, imageSize,
samplingFilter,
@ -920,7 +920,7 @@ nsImageRenderer::DrawBorderImageComponent(nsPresContext* aPresContext,
nsRect tile = ComputeTile(fillRect, aHFill, aVFill, aUnitSize, repeatSize);
CSSIntSize imageSize(srcRect.width, srcRect.height);
return nsLayoutUtils::DrawBackgroundImage(*aRenderingContext.ThebesContext(),
aPresContext,
mForFrame, aPresContext,
subImage, imageSize, samplingFilter,
tile, fillRect, repeatSize,
tile.TopLeft(), aDirtyRect,