Bug 1390088 - Part 3. Declare some locale nsSVGLength2 references as const in nsSVGOuterSVGFrame.cpp. r=jwatt

This patch has no direct relation with this bug. When tracing the code, I noticed
those local nsSVGLength2 variables can be declared as const reference.

MozReview-Commit-ID: 6gkdlpv8W7H

--HG--
extra : rebase_source : 0b875b0a375e9254eec3d1c569274fae8edfdcfe
This commit is contained in:
cku 2017-08-21 16:25:24 +08:00
parent 250c4094f7
commit 842790520f

View File

@ -213,8 +213,10 @@ nsSVGOuterSVGFrame::GetIntrinsicSize()
IntrinsicSize intrinsicSize;
SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent);
nsSVGLength2 &width = content->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
nsSVGLength2 &height = content->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
const nsSVGLength2& width =
content->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
const nsSVGLength2& height =
content->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
if (!width.IsPercentage()) {
nscoord val = nsPresContext::CSSPixelsToAppUnits(width.GetAnimValue(content));
@ -239,8 +241,10 @@ nsSVGOuterSVGFrame::GetIntrinsicRatio()
// rect: http://www.w3.org/TR/SVGMobile12/coords.html#IntrinsicSizing
SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent);
nsSVGLength2 &width = content->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
nsSVGLength2 &height = content->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
const nsSVGLength2& width =
content->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
const nsSVGLength2& height =
content->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
if (!width.IsPercentage() && !height.IsPercentage()) {
nsSize ratio(NSToCoordRoundWithClamp(width.GetAnimValue(content)),
@ -322,7 +326,7 @@ nsSVGOuterSVGFrame::ComputeSize(gfxContext *aRenderingContext,
SVGSVGElement* content = static_cast<SVGSVGElement*>(mContent);
nsSVGLength2 &width =
const nsSVGLength2& width =
content->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
if (width.IsPercentage()) {
MOZ_ASSERT(intrinsicSize.width.GetUnit() == eStyleUnit_None,
@ -332,7 +336,7 @@ nsSVGOuterSVGFrame::ComputeSize(gfxContext *aRenderingContext,
intrinsicSize.width.SetCoordValue(val * cbSize.Width(aWM));
}
nsSVGLength2 &height =
const nsSVGLength2& height =
content->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
NS_ASSERTION(aCBSize.BSize(aWM) != NS_AUTOHEIGHT,
"root should not have auto-height containing block");
@ -963,8 +967,8 @@ nsSVGOuterSVGFrame::IsRootOfImage()
bool
nsSVGOuterSVGFrame::VerticalScrollbarNotNeeded() const
{
nsSVGLength2 &height = static_cast<SVGSVGElement*>(mContent)->
mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
const nsSVGLength2& height = static_cast<SVGSVGElement*>(mContent)->
mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
return height.IsPercentage() && height.GetBaseValInSpecifiedUnits() <= 100;
}