From f8e64cb389e828b3458537dc22b072ec2a9ff916 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Wed, 15 Aug 2018 11:54:27 +0100 Subject: [PATCH] Bug 1492432. Remove PaintingPropertyDescriptor parameter from SVGObserverUtils::GetPaintServer. r=longsonr Differential Revision: https://phabricator.services.mozilla.com/D6250 --HG-- extra : rebase_source : 3f9c4a0252ba62db90c908f4021072a22097ec55 --- layout/svg/SVGContextPaint.cpp | 11 +++-------- layout/svg/SVGObserverUtils.cpp | 9 ++++++--- layout/svg/SVGObserverUtils.h | 13 ++++++------- layout/svg/nsSVGUtils.cpp | 6 ++---- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/layout/svg/SVGContextPaint.cpp b/layout/svg/SVGContextPaint.cpp index 35d055bf5f64..0600484cd7be 100644 --- a/layout/svg/SVGContextPaint.cpp +++ b/layout/svg/SVGContextPaint.cpp @@ -90,8 +90,6 @@ SVGContextPaint::IsAllowedForImageFromURI(nsIURI* aURI) * @param aOuterContextPaint pattern information from the outer text context * @param aTargetPaint where to store the current pattern information * @param aFillOrStroke member pointer to the paint we are setting up - * @param aProperty the frame property descriptor of the fill or stroke paint - * server frame */ static void SetupInheritablePaint(const DrawTarget* aDrawTarget, @@ -101,12 +99,11 @@ SetupInheritablePaint(const DrawTarget* aDrawTarget, SVGContextPaint* aOuterContextPaint, SVGContextPaintImpl::Paint& aTargetPaint, nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, - SVGObserverUtils::PaintingPropertyDescriptor aProperty, imgDrawingParams& aImgParams) { const nsStyleSVG *style = aFrame->StyleSVG(); nsSVGPaintServerFrame *ps = - SVGObserverUtils::GetPaintServer(aFrame, aFillOrStroke, aProperty); + SVGObserverUtils::GetPaintServer(aFrame, aFillOrStroke); if (ps) { RefPtr pattern = @@ -167,7 +164,7 @@ SVGContextPaintImpl::Init(const DrawTarget* aDrawTarget, SetupInheritablePaint(aDrawTarget, aContextMatrix, aFrame, opacity, aOuterContextPaint, mFillPaint, &nsStyleSVG::mFill, - SVGObserverUtils::FillProperty(), aImgParams); + aImgParams); SetFillOpacity(opacity); @@ -184,9 +181,7 @@ SVGContextPaintImpl::Init(const DrawTarget* aDrawTarget, SetupInheritablePaint(aDrawTarget, aContextMatrix, aFrame, opacity, aOuterContextPaint, mStrokePaint, - &nsStyleSVG::mStroke, - SVGObserverUtils::StrokeProperty(), - aImgParams); + &nsStyleSVG::mStroke, aImgParams); SetStrokeOpacity(opacity); diff --git a/layout/svg/SVGObserverUtils.cpp b/layout/svg/SVGObserverUtils.cpp index 416da6cf9bec..d20c63793d92 100644 --- a/layout/svg/SVGObserverUtils.cpp +++ b/layout/svg/SVGObserverUtils.cpp @@ -646,8 +646,7 @@ SVGObserverUtils::GetEffectProperties(nsIFrame* aFrame) nsSVGPaintServerFrame * SVGObserverUtils::GetPaintServer(nsIFrame* aTargetFrame, - nsStyleSVGPaint nsStyleSVG::* aPaint, - PaintingPropertyDescriptor aType) + nsStyleSVGPaint nsStyleSVG::* aPaint) { // If we're looking at a frame within SVG text, then we need to look up // to find the right frame to get the painting property off. We should at @@ -668,8 +667,12 @@ SVGObserverUtils::GetPaintServer(nsIFrame* aTargetFrame, RefPtr paintServerURL = SVGObserverUtils::GetPaintURI(frame, aPaint); + MOZ_ASSERT(aPaint == &nsStyleSVG::mFill || aPaint == &nsStyleSVG::mStroke); + PaintingPropertyDescriptor propDesc = (aPaint == &nsStyleSVG::mFill) ? + SVGObserverUtils::FillProperty() : + SVGObserverUtils::StrokeProperty(); nsSVGPaintingProperty *property = - SVGObserverUtils::GetPaintingProperty(paintServerURL, frame, aType); + SVGObserverUtils::GetPaintingProperty(paintServerURL, frame, propDesc); if (!property) return nullptr; nsIFrame* result = property->GetReferencedFrame(); diff --git a/layout/svg/SVGObserverUtils.h b/layout/svg/SVGObserverUtils.h index 38f313647b3a..fc4e4c343da0 100644 --- a/layout/svg/SVGObserverUtils.h +++ b/layout/svg/SVGObserverUtils.h @@ -534,13 +534,6 @@ public: NS_DECLARE_FRAME_PROPERTY_DELETABLE(BackgroundImageProperty, URIObserverHashtable) - /** - * Get the paint server for a aTargetFrame. - */ - static nsSVGPaintServerFrame *GetPaintServer(nsIFrame* aTargetFrame, - nsStyleSVGPaint nsStyleSVG::* aPaint, - PaintingPropertyDescriptor aProperty); - struct EffectProperties { SVGFilterObserverListForCSSProp* mFilterObservers; SVGMaskObserverList* mMaskObservers; @@ -684,6 +677,12 @@ public: static void InvalidateDirectRenderingObservers(Element* aElement, uint32_t aFlags = 0); static void InvalidateDirectRenderingObservers(nsIFrame* aFrame, uint32_t aFlags = 0); + /** + * Get the paint server for a aTargetFrame. + */ + static nsSVGPaintServerFrame *GetPaintServer(nsIFrame* aTargetFrame, + nsStyleSVGPaint nsStyleSVG::* aPaint); + /** * Get an SVGMarkerObserver for the frame, creating a fresh one if necessary */ diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp index 5dc166950041..64a3da024d1f 100644 --- a/layout/svg/nsSVGUtils.cpp +++ b/layout/svg/nsSVGUtils.cpp @@ -1500,8 +1500,7 @@ nsSVGUtils::MakeFillPatternFor(nsIFrame* aFrame, const DrawTarget* dt = aContext->GetDrawTarget(); nsSVGPaintServerFrame *ps = - SVGObserverUtils::GetPaintServer(aFrame, &nsStyleSVG::mFill, - SVGObserverUtils::FillProperty()); + SVGObserverUtils::GetPaintServer(aFrame, &nsStyleSVG::mFill); if (ps) { RefPtr pattern = @@ -1576,8 +1575,7 @@ nsSVGUtils::MakeStrokePatternFor(nsIFrame* aFrame, const DrawTarget* dt = aContext->GetDrawTarget(); nsSVGPaintServerFrame *ps = - SVGObserverUtils::GetPaintServer(aFrame, &nsStyleSVG::mStroke, - SVGObserverUtils::StrokeProperty()); + SVGObserverUtils::GetPaintServer(aFrame, &nsStyleSVG::mStroke); if (ps) { RefPtr pattern =