diff --git a/dom/svg/SVGSVGElement.cpp b/dom/svg/SVGSVGElement.cpp index cd7ba4b98473..d7b53660c764 100644 --- a/dom/svg/SVGSVGElement.cpp +++ b/dom/svg/SVGSVGElement.cpp @@ -183,7 +183,6 @@ SVGSVGElement::SVGSVGElement(already_AddRefed& aNodeInfo aFromParser == FROM_PARSER_FRAGMENT || aFromParser == FROM_PARSER_XSLT), mImageNeedsTransformInvalidation(false), - mIsPaintingSVGImageElement(false), mHasChildrenOnlyTransform(false) { } @@ -1061,14 +1060,9 @@ SVGSVGElement::HasViewBoxRect() const bool SVGSVGElement::ShouldSynthesizeViewBox() const { - MOZ_ASSERT(!HasViewBoxRect(), - "Should only be called if we lack a viewBox"); + MOZ_ASSERT(!HasViewBoxRect(), "Should only be called if we lack a viewBox"); - nsIDocument* doc = GetUncomposedDoc(); - return doc && - doc->IsBeingUsedAsImage() && - !mIsPaintingSVGImageElement && - !GetParent(); + return IsRoot() && OwnerDoc()->IsBeingUsedAsImage(); } bool @@ -1108,12 +1102,6 @@ SVGSVGElement::ClearPreserveAspectRatioProperty() return valPtr; } -void -SVGSVGElement::SetIsPaintingForSVGImageElement(bool aIsPaintingSVGImageElement) -{ - mIsPaintingSVGImageElement = aIsPaintingSVGImageElement; -} - void SVGSVGElement:: SetImageOverridePreserveAspectRatio(const SVGPreserveAspectRatio& aPAR) diff --git a/dom/svg/SVGSVGElement.h b/dom/svg/SVGSVGElement.h index d8aa70aa506e..95f12fb6b2f0 100644 --- a/dom/svg/SVGSVGElement.h +++ b/dom/svg/SVGSVGElement.h @@ -317,8 +317,6 @@ private: const SVGPreserveAspectRatio* GetPreserveAspectRatioProperty() const; bool ClearPreserveAspectRatioProperty(); - void SetIsPaintingForSVGImageElement(bool aIsPaintingSVGImageElement); - bool IsRoot() const { NS_ASSERTION((IsInUncomposedDoc() && !GetParent()) == (OwnerDoc() && (OwnerDoc()->GetRootElement() == this)), @@ -420,7 +418,6 @@ private: // to manually kick off animation when they are bound to the tree. bool mStartAnimationOnBindToTree; bool mImageNeedsTransformInvalidation; - bool mIsPaintingSVGImageElement; bool mHasChildrenOnlyTransform; }; @@ -447,8 +444,6 @@ public: // and overflow properties here, too. See bug 272288 comment 36. mRootElem->SetImageOverridePreserveAspectRatio( *aSVGContext->GetPreserveAspectRatio()); - mRootElem->SetIsPaintingForSVGImageElement( - aSVGContext->IsPaintingForSVGImageElement()); } mOriginalTime = mRootElem->GetCurrentTime(); @@ -460,7 +455,6 @@ public: mRootElem->SetCurrentTime(mOriginalTime); if (mHaveOverrides) { mRootElem->ClearImageOverridePreserveAspectRatio(); - mRootElem->SetIsPaintingForSVGImageElement(false); } } diff --git a/layout/svg/SVGImageContext.h b/layout/svg/SVGImageContext.h index 8c9727f7b2b3..7cb96d11d67d 100644 --- a/layout/svg/SVGImageContext.h +++ b/layout/svg/SVGImageContext.h @@ -23,9 +23,7 @@ namespace mozilla { class SVGImageContext { public: - SVGImageContext() - : mIsPaintingSVGImageElement(false) - { } + SVGImageContext() {} /** * Currently it seems that the aViewportSize parameter ends up being used @@ -42,16 +40,11 @@ public: * in order to get the size that's created for |fallbackContext|. At some * point we need to clean this code up, make our abstractions clear, create * that utility and stop using Maybe for this parameter. - * - * Note: 'aIsPaintingSVGImageElement' should be used to indicate whether - * the SVG image in question is being painted for an SVG element. */ explicit SVGImageContext(const Maybe& aViewportSize, - const Maybe& aPreserveAspectRatio = Nothing(), - bool aIsPaintingSVGImageElement = false) + const Maybe& aPreserveAspectRatio = Nothing()) : mViewportSize(aViewportSize) , mPreserveAspectRatio(aPreserveAspectRatio) - , mIsPaintingSVGImageElement(aIsPaintingSVGImageElement) { } static void MaybeInitAndStoreContextPaint(Maybe& aContext, @@ -78,10 +71,6 @@ public: return mContextPaint.get(); } - bool IsPaintingForSVGImageElement() const { - return mIsPaintingSVGImageElement; - } - bool operator==(const SVGImageContext& aOther) const { bool contextPaintIsEqual = // neither have context paint, or they have the same object: @@ -92,8 +81,7 @@ public: return contextPaintIsEqual && mViewportSize == aOther.mViewportSize && - mPreserveAspectRatio == aOther.mPreserveAspectRatio && - mIsPaintingSVGImageElement == aOther.mIsPaintingSVGImageElement; + mPreserveAspectRatio == aOther.mPreserveAspectRatio; } bool operator!=(const SVGImageContext& aOther) const { @@ -107,8 +95,7 @@ public: } return HashGeneric(hash, mViewportSize.map(HashSize).valueOr(0), - mPreserveAspectRatio.map(HashPAR).valueOr(0), - mIsPaintingSVGImageElement); + mPreserveAspectRatio.map(HashPAR).valueOr(0)); } private: @@ -123,7 +110,6 @@ private: RefPtr mContextPaint; Maybe mViewportSize; Maybe mPreserveAspectRatio; - bool mIsPaintingSVGImageElement; }; } // namespace mozilla diff --git a/layout/svg/nsSVGImageFrame.cpp b/layout/svg/nsSVGImageFrame.cpp index 9b00e21bc8c1..80f66a2f51bb 100644 --- a/layout/svg/nsSVGImageFrame.cpp +++ b/layout/svg/nsSVGImageFrame.cpp @@ -406,8 +406,7 @@ nsSVGImageFrame::PaintSVG(gfxContext& aContext, // with preserveAspectRatio and viewBox. const Maybe context( Some(SVGImageContext(Some(CSSIntSize::Truncate(width, height)), - Some(imgElem->mPreserveAspectRatio.GetAnimValue()), - /* aIsPaintingSVGImageElement */ true))); + Some(imgElem->mPreserveAspectRatio.GetAnimValue())))); // For the actual draw operation to draw crisply (and at the right size), // our destination rect needs to be |width|x|height|, *in dev pixels*.