Skip to content

Commit

Permalink
Bug 1652430 - Fix some clang warnings in SVG r=dholbert
Browse files Browse the repository at this point in the history
  • Loading branch information
longsonr committed Jul 13, 2020
1 parent 8d34f79 commit c4aad00
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion dom/svg/SVGContentUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ float SVGContentUtils::CoordToFloat(SVGElement* aContent,
return CSSCoord(ctx ? ctx->GetLength(SVGContentUtils::XY) : 0.0f);
});
if (aLength.IsCalc()) {
auto& calc = aLength.AsCalc();
const auto& calc = aLength.AsCalc();
if (calc.clamping_mode == StyleAllowedNumericType::NonNegative) {
result = std::max(result, 0.0f);
} else {
Expand Down
4 changes: 2 additions & 2 deletions layout/svg/CSSClipPathInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace mozilla {
/* static*/
void CSSClipPathInstance::ApplyBasicShapeOrPathClip(
gfxContext& aContext, nsIFrame* aFrame, const gfxMatrix& aTransform) {
auto& clipPathStyle = aFrame->StyleSVGReset()->mClipPath;
const auto& clipPathStyle = aFrame->StyleSVGReset()->mClipPath;
MOZ_ASSERT(clipPathStyle.IsShape() || clipPathStyle.IsBox() ||
clipPathStyle.IsPath(),
"This is used with basic-shape, geometry-box, and path() only");
Expand All @@ -48,7 +48,7 @@ void CSSClipPathInstance::ApplyBasicShapeOrPathClip(
/* static*/
bool CSSClipPathInstance::HitTestBasicShapeOrPathClip(nsIFrame* aFrame,
const gfxPoint& aPoint) {
auto& clipPathStyle = aFrame->StyleSVGReset()->mClipPath;
const auto& clipPathStyle = aFrame->StyleSVGReset()->mClipPath;
MOZ_ASSERT(!clipPathStyle.IsNone(), "unexpected none value");
// In the future CSSClipPathInstance may handle <clipPath> references as
// well. For the time being return early.
Expand Down
2 changes: 1 addition & 1 deletion layout/svg/SVGClipPathFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ SVGBBox SVGClipPathFrame::GetBBoxForClipPathFrame(const SVGBBox& aBBox,

bool SVGClipPathFrame::IsSVGTransformed(Matrix* aOwnTransforms,
Matrix* aFromParentTransforms) const {
auto e = static_cast<SVGElement const*>(GetContent());
const auto* e = static_cast<SVGElement const*>(GetContent());
Matrix m = ToMatrix(e->PrependLocalTransformsTo({}, eUserSpaceToParent));

if (m.IsIdentity()) {
Expand Down
3 changes: 2 additions & 1 deletion layout/svg/SVGContextPaint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ SVGContextPaint* SVGContextPaint::GetContextPaint(nsIContent* aContent) {
return nullptr;
}

auto* contextPaint = ownerDoc->AsSVGDocument()->GetCurrentContextPaint();
const auto* contextPaint =
ownerDoc->AsSVGDocument()->GetCurrentContextPaint();
MOZ_ASSERT_IF(contextPaint, ownerDoc->IsBeingUsedAsImage());

// XXX The SVGContextPaint that SVGDocument keeps around is const. We could
Expand Down
6 changes: 3 additions & 3 deletions layout/svg/SVGGeometryFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void DisplaySVGGeometry::Paint(nsDisplayListBuilder* aBuilder,
void DisplaySVGGeometry::ComputeInvalidationRegion(
nsDisplayListBuilder* aBuilder, const nsDisplayItemGeometry* aGeometry,
nsRegion* aInvalidRegion) const {
auto geometry =
const auto* geometry =
static_cast<const nsDisplayItemGenericImageGeometry*>(aGeometry);

if (aBuilder->ShouldSyncDecodeImages() &&
Expand Down Expand Up @@ -141,7 +141,7 @@ void SVGGeometryFrame::DidSetComputedStyle(ComputedStyle* aOldComputedStyle) {
SVGGeometryElement* element =
static_cast<SVGGeometryElement*>(GetContent());

auto* oldStyleSVG = aOldComputedStyle->StyleSVG();
const auto* oldStyleSVG = aOldComputedStyle->StyleSVG();
if (!SVGContentUtils::ShapeTypeHasNoCorners(GetContent())) {
if (StyleSVG()->mStrokeLinecap != oldStyleSVG->mStrokeLinecap &&
element->IsSVGElement(nsGkAtoms::path)) {
Expand Down Expand Up @@ -729,7 +729,7 @@ void SVGGeometryFrame::Render(gfxContext* aContext, uint32_t aRenderComponents,
void SVGGeometryFrame::PaintMarkers(gfxContext& aContext,
const gfxMatrix& aTransform,
imgDrawingParams& aImgParams) {
auto element = static_cast<SVGGeometryElement*>(GetContent());
auto* element = static_cast<SVGGeometryElement*>(GetContent());

if (element->IsMarkable()) {
SVGMarkerFrame* markerFrames[SVGMark::eTypeCount];
Expand Down
4 changes: 2 additions & 2 deletions layout/svg/SVGGradientFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ already_AddRefed<gfxPattern> SVGGradientFrame::GetPaintServerPattern(
}

if (nStops == 1 || GradientVectorLengthIsZero()) {
auto lastStopFrame = stopFrames[nStops - 1];
auto svgReset = lastStopFrame->StyleSVGReset();
auto* lastStopFrame = stopFrames[nStops - 1];
const auto* svgReset = lastStopFrame->StyleSVGReset();
// The gradient paints a single colour, using the stop-color of the last
// gradient step if there are more than one.
float stopOpacity = svgReset->mStopOpacity;
Expand Down
4 changes: 2 additions & 2 deletions layout/svg/SVGObserverUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ class URLAndReferrerInfoHashKey : public PLDHashEntryHdr {
using KeyType = const URLAndReferrerInfo*;
using KeyTypePointer = const URLAndReferrerInfo*;

explicit URLAndReferrerInfoHashKey(const URLAndReferrerInfo* aKey)
explicit URLAndReferrerInfoHashKey(const URLAndReferrerInfo* aKey) noexcept
: mKey(aKey) {
MOZ_COUNT_CTOR(URLAndReferrerInfoHashKey);
}
URLAndReferrerInfoHashKey(URLAndReferrerInfoHashKey&& aToMove)
URLAndReferrerInfoHashKey(URLAndReferrerInfoHashKey&& aToMove) noexcept
: PLDHashEntryHdr(std::move(aToMove)), mKey(std::move(aToMove.mKey)) {
MOZ_COUNT_CTOR(URLAndReferrerInfoHashKey);
}
Expand Down
2 changes: 1 addition & 1 deletion layout/svg/SVGOuterSVGFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ void nsDisplayOuterSVG::ComputeInvalidationRegion(
nsDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
aInvalidRegion->Or(*aInvalidRegion, result);

auto geometry =
const auto* geometry =
static_cast<const nsDisplayItemGenericImageGeometry*>(aGeometry);

if (aBuilder->ShouldSyncDecodeImages() &&
Expand Down
2 changes: 1 addition & 1 deletion layout/svg/SVGUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ gfxRect SVGUtils::GetClipRectForFrame(nsIFrame* aFrame, float aX, float aY,
return gfxRect(aX, aY, aWidth, aHeight);
}

auto& rect = effects->mClip.AsRect();
const auto& rect = effects->mClip.AsRect();
nsRect coordClipRect = rect.ToLayoutRect();
nsIntRect clipPxRect = coordClipRect.ToOutsidePixels(
aFrame->PresContext()->AppUnitsPerDevPixel());
Expand Down

0 comments on commit c4aad00

Please sign in to comment.