Bug 1273363 - Fix -Wshadow warnings in layout/svg/. r=dholbert

layout/svg/SVGTextFrame.cpp:4198:28 [-Wshadow] declaration shadows a local variable
layout/svg/nsSVGClipPathFrame.cpp:388:18 [-Wshadow] declaration shadows a local variable
layout/svg/nsSVGIntegrationUtils.cpp:562:15 [-Wshadow] declaration shadows a local variable
layout/svg/nsSVGIntegrationUtils.cpp:586:26 [-Wshadow] declaration shadows a local variable
layout/svg/nsSVGIntegrationUtils.cpp:620:15 [-Wshadow] declaration shadows a local variable

--HG--
extra : rebase_source : d8652b0c6bc2532119f351d7b0dc860987b32677
This commit is contained in:
Chris Peterson 2016-05-16 22:02:08 -07:00
parent 8e4bbffa0c
commit 89c0478b18
4 changed files with 23 additions and 25 deletions

View File

@ -4176,8 +4176,8 @@ SVGTextFrame::GetSubStringLength(nsIContent* aContent,
// Find each rendered run that intersects with the range defined
// by charnum/nchars.
nscoord textLength = 0;
TextRenderedRunIterator it(this, TextRenderedRunIterator::eAllFrames);
TextRenderedRun run = it.Current();
TextRenderedRunIterator runIter(this, TextRenderedRunIterator::eAllFrames);
TextRenderedRun run = runIter.Current();
while (run.mFrame) {
// If this rendered run is past the substring we are interested in, we
// are done.
@ -4195,16 +4195,16 @@ SVGTextFrame::GetSubStringLength(nsIContent* aContent,
// Convert offset into an index into the frame.
offset += run.mTextFrameContentOffset - run.mTextElementCharIndex;
gfxSkipCharsIterator it =
gfxSkipCharsIterator skipCharsIter =
run.mFrame->EnsureTextRun(nsTextFrame::eInflated);
gfxTextRun* textRun = run.mFrame->GetTextRun(nsTextFrame::eInflated);
Range range = ConvertOriginalToSkipped(it, offset, length);
Range range = ConvertOriginalToSkipped(skipCharsIter, offset, length);
// Accumulate the advance.
textLength += textRun->GetAdvanceWidth(range, nullptr);
}
run = it.Next();
run = runIter.Next();
}
nsPresContext* presContext = PresContext();
@ -5720,4 +5720,3 @@ SVGTextFrame::TransformFrameRectFromTextChild(const nsRect& aRect,
return result - framePosition;
}

View File

@ -69,6 +69,3 @@ LOCAL_INCLUDES += [
RESOURCE_FILES += [
'svg.css',
]
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wno-error=shadow']

View File

@ -380,25 +380,27 @@ nsSVGClipPathFrame::IsValid()
for (nsIFrame* kid = mFrames.FirstChild(); kid;
kid = kid->GetNextSibling()) {
nsIAtom *type = kid->GetType();
nsIAtom* kidType = kid->GetType();
if (type == nsGkAtoms::svgUseFrame) {
if (kidType == nsGkAtoms::svgUseFrame) {
for (nsIFrame* grandKid : kid->PrincipalChildList()) {
nsIAtom *type = grandKid->GetType();
nsIAtom* grandKidType = grandKid->GetType();
if (type != nsGkAtoms::svgPathGeometryFrame &&
type != nsGkAtoms::svgTextFrame) {
if (grandKidType != nsGkAtoms::svgPathGeometryFrame &&
grandKidType != nsGkAtoms::svgTextFrame) {
return false;
}
}
continue;
}
if (type != nsGkAtoms::svgPathGeometryFrame &&
type != nsGkAtoms::svgTextFrame) {
if (kidType != nsGkAtoms::svgPathGeometryFrame &&
kidType != nsGkAtoms::svgTextFrame) {
return false;
}
}
return true;
}

View File

@ -541,9 +541,9 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(gfxContext& aContext,
complexEffects = true;
aContext.Save();
nsRect clipRect =
nsRect overflowClipRect =
aFrame->GetVisualOverflowRectRelativeToSelf() + toUserSpace;
aContext.Clip(NSRectToSnappedRect(clipRect,
aContext.Clip(NSRectToSnappedRect(overflowClipRect,
aFrame->PresContext()->AppUnitsPerDevPixel(),
*drawTarget));
@ -571,26 +571,26 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(gfxContext& aContext,
// Mask composition result on CoreGraphic::A8 surface is not correct
// when mask-mode is not add(source over). Switch to skia when CG backend
// detected.
RefPtr<DrawTarget> targetDT =
RefPtr<DrawTarget> maskTargetDT =
(aContext.GetDrawTarget()->GetBackendType() == BackendType::COREGRAPHICS) ?
Factory::CreateDrawTarget(BackendType::SKIA, drawRect.Size(),
SurfaceFormat::A8) :
aContext.GetDrawTarget()->CreateSimilarDrawTarget(drawRect.Size(),
SurfaceFormat::A8);
if (!targetDT || !targetDT->IsValid()) {
if (!maskTargetDT || !maskTargetDT->IsValid()) {
aContext.Restore();
return;
}
RefPtr<gfxContext> target = gfxContext::ForDrawTarget(targetDT);
MOZ_ASSERT(target); // alrady checked the draw target above
target->SetMatrix(matrixAutoSaveRestore.Matrix() * gfxMatrix::Translation(-drawRect.TopLeft()));
RefPtr<gfxContext> maskTarget = gfxContext::ForDrawTarget(maskTargetDT);
MOZ_ASSERT(maskTarget); // already checked the draw target above
maskTarget->SetMatrix(matrixAutoSaveRestore.Matrix() * gfxMatrix::Translation(-drawRect.TopLeft()));
// Compose all mask-images onto maskSurface.
uint32_t flags = aBuilder->GetBackgroundPaintFlags() |
nsCSSRendering::PAINTBG_MASK_IMAGE;
nsRenderingContext rc(target);
nsRenderingContext rc(maskTarget);
// FIXME We should use the return value, see bug 1258510.
Unused << nsCSSRendering::PaintBackgroundWithSC(aFrame->PresContext(),
rc,
@ -600,7 +600,7 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(gfxContext& aContext,
firstFrame->StyleContext(),
*aFrame->StyleBorder(),
flags);
maskSurface = targetDT->Snapshot();
maskSurface = maskTargetDT->Snapshot();
// Compute mask transform.
Matrix mat = ToMatrix(aContext.CurrentMatrix());