commit fa4a1ac0315dbfe708504a1331f6bb18ad423bb1
parent f39c46c151458e5d0106f1e995571421d0db558d
Author: Timothy Nikkel <tnikkel@gmail.com>
Date: Fri, 24 Oct 2025 07:08:53 +0000
Bug 1995180. Remove some extra rect creation when calling nsLayoutUtils::RoundGfxRectToAppRect. r=gfx-reviewers,firefox-svg-reviewers,lsalzman,longsonr
Differential Revision: https://phabricator.services.mozilla.com/D269159
Diffstat:
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
@@ -1854,7 +1854,7 @@ nsRect nsLayoutUtils::MatrixTransformRect(const nsRect& aBounds,
image = aMatrix.TransformAndClipBounds(image, maxBounds);
- return RoundGfxRectToAppRect(ThebesRect(image), aFactor);
+ return RoundGfxRectToAppRect(image, aFactor);
}
nsRect nsLayoutUtils::MatrixTransformRect(const nsRect& aBounds,
@@ -1873,7 +1873,7 @@ nsRect nsLayoutUtils::MatrixTransformRect(const nsRect& aBounds,
image = aMatrix.TransformAndClipBounds(image, maxBounds);
- return RoundGfxRectToAppRect(ThebesRect(image), aFactor);
+ return RoundGfxRectToAppRect(image, aFactor);
}
nsPoint nsLayoutUtils::MatrixTransformPoint(const nsPoint& aPoint,
diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp
@@ -7514,8 +7514,7 @@ bool nsDisplayTransform::UntransformRect(const nsRect& aTransformedBounds,
NSAppUnitsToFloatPixels(aChildBounds.height, aAppUnitsPerPixel));
result = inverse->ProjectRectBounds(result, childGfxBounds);
- *aOutRect = nsLayoutUtils::RoundGfxRectToAppRect(ThebesRect(result),
- aAppUnitsPerPixel);
+ *aOutRect = nsLayoutUtils::RoundGfxRectToAppRect(result, aAppUnitsPerPixel);
return true;
}
@@ -7543,7 +7542,7 @@ bool nsDisplayTransform::UntransformRect(nsDisplayListBuilder* aBuilder,
/* We want to untransform the matrix, so invert the transformation first! */
result = GetInverseTransform().ProjectRectBounds(result, childGfxBounds);
- *aOutRect = nsLayoutUtils::RoundGfxRectToAppRect(ThebesRect(result), factor);
+ *aOutRect = nsLayoutUtils::RoundGfxRectToAppRect(result, factor);
return true;
}
diff --git a/layout/svg/SVGGeometryFrame.cpp b/layout/svg/SVGGeometryFrame.cpp
@@ -283,8 +283,9 @@ void SVGGeometryFrame::ReflowSVG() {
flags |= SVGUtils::eBBoxIncludeStrokeGeometry;
}
- gfxRect extent = GetBBoxContribution({}, flags).ToThebesRect();
- mRect = nsLayoutUtils::RoundGfxRectToAppRect(extent, AppUnitsPerCSSPixel());
+ SVGBBox extent = GetBBoxContribution({}, flags).ToThebesRect();
+ mRect = nsLayoutUtils::RoundGfxRectToAppRect((const Rect&)extent,
+ AppUnitsPerCSSPixel());
if (HasAnyStateBits(NS_FRAME_FIRST_REFLOW)) {
// Make sure we have our filter property (if any) before calling
diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp
@@ -3371,7 +3371,7 @@ void SVGTextFrame::ReflowSVG() {
if (r.IsEmpty()) {
mRect.SetEmpty();
} else {
- mRect = nsLayoutUtils::RoundGfxRectToAppRect(r.ToThebesRect(),
+ mRect = nsLayoutUtils::RoundGfxRectToAppRect((const Rect&)r,
AppUnitsPerCSSPixel());
// Due to rounding issues when we have a transform applied, we sometimes