commit de638bb57abff3e1263cdc57626b65096af3b150
parent 4124fd802938422e842a5a641f97565fde707e8d
Author: Andrew McCreight <continuation@gmail.com>
Date: Tue, 7 Oct 2025 22:22:08 +0000
Bug 1992422 - part 3: Eliminate mNumRows and mNumCols. r=layout-reviewers,emilio
Now that these two data members are set in exactly one place after
initialization, we can see that they always have the same value as the length
of mRowSizes and mColSizes, so remove the members. Hopefully the extra overhead
from the integer conversions isn't relevant.
Differential Revision: https://phabricator.services.mozilla.com/D267674
Diffstat:
2 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/layout/generic/nsFrameSetFrame.cpp b/layout/generic/nsFrameSetFrame.cpp
@@ -161,8 +161,6 @@ bool nsHTMLFramesetFrame::gDragInProgress = false;
nsHTMLFramesetFrame::nsHTMLFramesetFrame(ComputedStyle* aStyle,
nsPresContext* aPresContext)
: nsContainerFrame(aStyle, aPresContext, kClassID) {
- mNumRows = 0;
- mNumCols = 0;
mEdgeVisibility = 0;
mParentFrameborder = eFrameborder_Yes; // default
mParentBorderWidth = -1; // default not set
@@ -211,16 +209,14 @@ void nsHTMLFramesetFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
auto rowSpecs = ourContent->GetRowSpec();
auto colSpecs = ourContent->GetColSpec();
- mNumRows = CheckedInt<int32_t>(rowSpecs.Length()).value();
- mNumCols = CheckedInt<int32_t>(colSpecs.Length()).value();
static_assert(
NS_MAX_FRAMESET_SPEC_COUNT < UINT_MAX / sizeof(nscoord),
"Maximum value of NumRows() and NumCols() is NS_MAX_FRAMESET_SPEC_COUNT");
mRowSizes.Clear();
- mRowSizes.SetLength(NumRows());
+ mRowSizes.SetLength(rowSpecs.Length());
mColSizes.Clear();
- mColSizes.SetLength(NumCols());
+ mColSizes.SetLength(colSpecs.Length());
static_assert(
NS_MAX_FRAMESET_SPEC_COUNT < INT32_MAX / NS_MAX_FRAMESET_SPEC_COUNT,
@@ -1154,9 +1150,13 @@ void nsHTMLFramesetFrame::SetBorderResize(
}
}
-int32_t nsHTMLFramesetFrame::NumRows() const { return mNumRows; }
+int32_t nsHTMLFramesetFrame::NumRows() const {
+ return CheckedInt<int32_t>(mRowSizes.Length()).value();
+}
-int32_t nsHTMLFramesetFrame::NumCols() const { return mNumCols; }
+int32_t nsHTMLFramesetFrame::NumCols() const {
+ return CheckedInt<int32_t>(mColSizes.Length()).value();
+}
void nsHTMLFramesetFrame::StartMouseDrag(nsPresContext* aPresContext,
nsHTMLFramesetBorderFrame* aBorder,
diff --git a/layout/generic/nsFrameSetFrame.h b/layout/generic/nsFrameSetFrame.h
@@ -185,8 +185,6 @@ class nsHTMLFramesetFrame final : public nsContainerFrame {
nsTArray<nscoord> mRowSizes; // currently computed row sizes
nsTArray<nscoord> mColSizes; // currently computed col sizes
mozilla::LayoutDeviceIntPoint mFirstDragPoint;
- int32_t mNumRows;
- int32_t mNumCols;
int32_t mNonBorderChildCount;
int32_t mNonBlankChildCount;
int32_t mEdgeVisibility;