summaryrefslogtreecommitdiffstats
path: root/layout
diff options
context:
space:
mode:
authorMoonchild <git-repo@palemoon.org>2020-02-17 12:40:36 +0100
committerGitHub <noreply@github.com>2020-02-17 12:40:36 +0100
commita4ab3fc59dcd26d527716ae8ed23adf9148cb699 (patch)
treef5c0845fac59471189d20e88617531dcdb1b79dd /layout
parente8417acbff563634f11f25461d953b951caac056 (diff)
parentd4098037a4a6bee464fde4b70644e730e13b487f (diff)
downloadUXP-a4ab3fc59dcd26d527716ae8ed23adf9148cb699.tar
UXP-a4ab3fc59dcd26d527716ae8ed23adf9148cb699.tar.gz
UXP-a4ab3fc59dcd26d527716ae8ed23adf9148cb699.tar.lz
UXP-a4ab3fc59dcd26d527716ae8ed23adf9148cb699.tar.xz
UXP-a4ab3fc59dcd26d527716ae8ed23adf9148cb699.zip
Merge pull request #1447 from win7-7/optimization-4-pr
Speed up nsTableColFrame::GetColIndex
Diffstat (limited to 'layout')
-rw-r--r--layout/generic/nsSelection.cpp22
-rw-r--r--layout/mathml/nsMathMLmtableFrame.cpp20
-rw-r--r--layout/tables/nsCellMap.cpp8
-rw-r--r--layout/tables/nsITableCellLayout.h6
-rw-r--r--layout/tables/nsTableCellFrame.cpp51
-rw-r--r--layout/tables/nsTableCellFrame.h20
-rw-r--r--layout/tables/nsTableFrame.cpp41
-rw-r--r--layout/tables/nsTableRowFrame.cpp26
-rw-r--r--layout/tables/nsTableRowGroupFrame.cpp6
9 files changed, 77 insertions, 123 deletions
diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp
index ff75ab85d..f2959dc9d 100644
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -2882,16 +2882,15 @@ nsFrameSelection::UnselectCells(nsIContent *aTableContent,
nsTableCellFrame* cellFrame =
tableFrame->GetCellFrameAt(curRowIndex, curColIndex);
- int32_t origRowIndex, origColIndex;
- cellFrame->GetRowIndex(origRowIndex);
- cellFrame->GetColIndex(origColIndex);
+ uint32_t origRowIndex = cellFrame->RowIndex();
+ uint32_t origColIndex = cellFrame->ColIndex();
uint32_t actualRowSpan =
tableFrame->GetEffectiveRowSpanAt(origRowIndex, origColIndex);
uint32_t actualColSpan =
tableFrame->GetEffectiveColSpanAt(curRowIndex, curColIndex);
- if (origRowIndex <= maxRowIndex && maxRowIndex >= 0 &&
+ if (origRowIndex <= static_cast<uint32_t>(maxRowIndex) && maxRowIndex >= 0 &&
origRowIndex + actualRowSpan - 1 >= static_cast<uint32_t>(minRowIndex) &&
- origColIndex <= maxColIndex && maxColIndex >= 0 &&
+ origColIndex <= static_cast<uint32_t>(maxColIndex) && maxColIndex >= 0 &&
origColIndex + actualColSpan - 1 >= static_cast<uint32_t>(minColIndex)) {
mDomSelections[index]->RemoveRange(range);
@@ -2925,33 +2924,32 @@ nsFrameSelection::AddCellsToSelection(nsIContent *aTableContent,
return NS_ERROR_FAILURE;
nsresult result = NS_OK;
- int32_t row = aStartRowIndex;
+ uint32_t row = aStartRowIndex;
while(true)
{
- int32_t col = aStartColumnIndex;
+ uint32_t col = aStartColumnIndex;
while(true)
{
nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(row, col);
// Skip cells that are spanned from previous locations or are already selected
if (cellFrame) {
- int32_t origRow, origCol;
- cellFrame->GetRowIndex(origRow);
- cellFrame->GetColIndex(origCol);
+ uint32_t origRow = cellFrame->RowIndex();
+ uint32_t origCol = cellFrame->ColIndex();
if (origRow == row && origCol == col && !cellFrame->IsSelected()) {
result = SelectCellElement(cellFrame->GetContent());
if (NS_FAILED(result)) return result;
}
}
// Done when we reach end column
- if (col == aEndColumnIndex) break;
+ if (col == static_cast<uint32_t>(aEndColumnIndex)) break;
if (aStartColumnIndex < aEndColumnIndex)
col ++;
else
col--;
}
- if (row == aEndRowIndex) break;
+ if (row == static_cast<uint32_t>(aEndRowIndex)) break;
if (aStartRowIndex < aEndRowIndex)
row++;
diff --git a/layout/mathml/nsMathMLmtableFrame.cpp b/layout/mathml/nsMathMLmtableFrame.cpp
index 1ff8a28ef..4bd7d4395 100644
--- a/layout/mathml/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/nsMathMLmtableFrame.cpp
@@ -183,10 +183,8 @@ static void
ApplyBorderToStyle(const nsMathMLmtdFrame* aFrame,
nsStyleBorder& aStyleBorder)
{
- int32_t rowIndex;
- int32_t columnIndex;
- aFrame->GetRowIndex(rowIndex);
- aFrame->GetColIndex(columnIndex);
+ uint32_t rowIndex = aFrame->RowIndex();
+ uint32_t columnIndex = aFrame->ColIndex();
nscoord borderWidth =
aFrame->PresContext()->GetBorderWidthTable()[NS_STYLE_BORDER_WIDTH_THIN];
@@ -201,7 +199,7 @@ ApplyBorderToStyle(const nsMathMLmtdFrame* aFrame,
if (rowIndex > 0 && rowLinesList) {
// If the row number is greater than the number of provided rowline
// values, we simply repeat the last value.
- int32_t listLength = rowLinesList->Length();
+ uint32_t listLength = rowLinesList->Length();
if (rowIndex < listLength) {
aStyleBorder.SetBorderStyle(NS_SIDE_TOP,
rowLinesList->ElementAt(rowIndex - 1));
@@ -216,7 +214,7 @@ ApplyBorderToStyle(const nsMathMLmtdFrame* aFrame,
if (columnIndex > 0 && columnLinesList) {
// If the column number is greater than the number of provided columline
// values, we simply repeat the last value.
- int32_t listLength = columnLinesList->Length();
+ uint32_t listLength = columnLinesList->Length();
if (columnIndex < listLength) {
aStyleBorder.SetBorderStyle(NS_SIDE_LEFT,
columnLinesList->ElementAt(columnIndex - 1));
@@ -1202,12 +1200,11 @@ nsMathMLmtdFrame::GetVerticalAlign() const
nsTArray<int8_t>* alignmentList = FindCellProperty(this, RowAlignProperty());
if (alignmentList) {
- int32_t rowIndex;
- GetRowIndex(rowIndex);
+ uint32_t rowIndex = RowIndex();
// If the row number is greater than the number of provided rowalign values,
// we simply repeat the last value.
- if (rowIndex < (int32_t)alignmentList->Length())
+ if (rowIndex < alignmentList->Length())
alignment = alignmentList->ElementAt(rowIndex);
else
alignment = alignmentList->ElementAt(alignmentList->Length() - 1);
@@ -1294,12 +1291,11 @@ nsStyleText* nsMathMLmtdInnerFrame::StyleTextForLineLayout()
if (alignmentList) {
nsMathMLmtdFrame* cellFrame = (nsMathMLmtdFrame*)GetParent();
- int32_t columnIndex;
- cellFrame->GetColIndex(columnIndex);
+ uint32_t columnIndex = cellFrame->ColIndex();
// If the column number is greater than the number of provided columalign
// values, we simply repeat the last value.
- if (columnIndex < (int32_t)alignmentList->Length())
+ if (columnIndex < alignmentList->Length())
alignment = alignmentList->ElementAt(columnIndex);
else
alignment = alignmentList->ElementAt(alignmentList->Length() - 1);
diff --git a/layout/tables/nsCellMap.cpp b/layout/tables/nsCellMap.cpp
index bdd12cf70..4852a4bdd 100644
--- a/layout/tables/nsCellMap.cpp
+++ b/layout/tables/nsCellMap.cpp
@@ -2431,9 +2431,8 @@ void nsCellMap::Dump(bool aIsBorderCollapse) const
if (cd) {
if (cd->IsOrig()) {
nsTableCellFrame* cellFrame = cd->GetCellFrame();
- int32_t cellFrameColIndex;
- cellFrame->GetColIndex(cellFrameColIndex);
- printf("C%d,%d=%p(%d) ", rIndex, colIndex, (void*)cellFrame,
+ uint32_t cellFrameColIndex = cellFrame->ColIndex();
+ printf("C%d,%d=%p(%u) ", rIndex, colIndex, (void*)cellFrame,
cellFrameColIndex);
cellCount++;
}
@@ -2520,8 +2519,7 @@ nsCellMap::GetCellInfoAt(const nsTableCellMap& aMap,
cellFrame = GetCellFrame(aRowX, aColX, *data, true);
}
if (cellFrame && aColSpan) {
- int32_t initialColIndex;
- cellFrame->GetColIndex(initialColIndex);
+ uint32_t initialColIndex = cellFrame->ColIndex();
*aColSpan = GetEffectiveColSpan(aMap, aRowX, initialColIndex);
}
}
diff --git a/layout/tables/nsITableCellLayout.h b/layout/tables/nsITableCellLayout.h
index a366b150e..fdf693b06 100644
--- a/layout/tables/nsITableCellLayout.h
+++ b/layout/tables/nsITableCellLayout.h
@@ -14,6 +14,7 @@
/**
* nsITableCellLayout
* interface for layout objects that act like table cells.
+ * XXX: This interface should really go away...
*
* @author sclark
*/
@@ -26,11 +27,6 @@ public:
/** return the mapped cell's row and column indexes (starting at 0 for each) */
NS_IMETHOD GetCellIndexes(int32_t &aRowIndex, int32_t &aColIndex)=0;
- /** return the mapped cell's row index (starting at 0 for the first row) */
- virtual nsresult GetRowIndex(int32_t &aRowIndex) const = 0;
-
- /** return the mapped cell's column index (starting at 0 for the first column) */
- virtual nsresult GetColIndex(int32_t &aColIndex) const = 0;
};
#endif
diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp
index cd846efa2..8b811df1e 100644
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -74,8 +74,7 @@ nsTableCellFrame::Init(nsIContent* aContent,
if (aPrevInFlow) {
// Set the column index
nsTableCellFrame* cellFrame = (nsTableCellFrame*)aPrevInFlow;
- int32_t colIndex;
- cellFrame->GetColIndex(colIndex);
+ uint32_t colIndex = cellFrame->ColIndex();
SetColIndex(colIndex);
}
}
@@ -169,34 +168,6 @@ nsTableCellFrame::NeedsToObserve(const ReflowInput& aReflowInput)
}
nsresult
-nsTableCellFrame::GetRowIndex(int32_t &aRowIndex) const
-{
- nsresult result;
- nsTableRowFrame* row = static_cast<nsTableRowFrame*>(GetParent());
- if (row) {
- aRowIndex = row->GetRowIndex();
- result = NS_OK;
- }
- else {
- aRowIndex = 0;
- result = NS_ERROR_NOT_INITIALIZED;
- }
- return result;
-}
-
-nsresult
-nsTableCellFrame::GetColIndex(int32_t &aColIndex) const
-{
- if (GetPrevInFlow()) {
- return static_cast<nsTableCellFrame*>(FirstInFlow())->GetColIndex(aColIndex);
- }
- else {
- aColIndex = mColIndex;
- return NS_OK;
- }
-}
-
-nsresult
nsTableCellFrame::AttributeChanged(int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
@@ -224,13 +195,13 @@ nsTableCellFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
nsTableFrame* tableFrame = GetTableFrame();
if (tableFrame->IsBorderCollapse() &&
tableFrame->BCRecalcNeeded(aOldStyleContext, StyleContext())) {
- int32_t colIndex, rowIndex;
- GetColIndex(colIndex);
- GetRowIndex(rowIndex);
+ uint32_t colIndex = ColIndex();
+ uint32_t rowIndex = RowIndex();
// row span needs to be clamped as we do not create rows in the cellmap
// which do not have cells originating in them
TableArea damageArea(colIndex, rowIndex, GetColSpan(),
- std::min(GetRowSpan(), tableFrame->GetRowCount() - rowIndex));
+ std::min(static_cast<uint32_t>(GetRowSpan()),
+ tableFrame->GetRowCount() - rowIndex));
tableFrame->AddBCDamageArea(damageArea);
}
}
@@ -820,14 +791,13 @@ CalcUnpaginatedBSize(nsTableCellFrame& aCellFrame,
nsTableRowGroupFrame* firstRGInFlow =
static_cast<nsTableRowGroupFrame*>(row->GetParent());
- int32_t rowIndex;
- firstCellInFlow->GetRowIndex(rowIndex);
+ uint32_t rowIndex = firstCellInFlow->RowIndex();
int32_t rowSpan = aTableFrame.GetEffectiveRowSpan(*firstCellInFlow);
nscoord computedBSize = firstTableInFlow->GetRowSpacing(rowIndex,
rowIndex + rowSpan - 1);
computedBSize -= aBlockDirBorderPadding;
- int32_t rowX;
+ uint32_t rowX;
for (row = firstRGInFlow->GetFirstRow(), rowX = 0; row; row = row->GetNextRow(), rowX++) {
if (rowX > rowIndex + rowSpan - 1) {
break;
@@ -1042,12 +1012,7 @@ nsTableCellFrame::AccessibleType()
NS_IMETHODIMP
nsTableCellFrame::GetCellIndexes(int32_t &aRowIndex, int32_t &aColIndex)
{
- nsresult res = GetRowIndex(aRowIndex);
- if (NS_FAILED(res))
- {
- aColIndex = 0;
- return res;
- }
+ aRowIndex = RowIndex();
aColIndex = mColIndex;
return NS_OK;
}
diff --git a/layout/tables/nsTableCellFrame.h b/layout/tables/nsTableCellFrame.h
index ea527b3c5..f626a45b0 100644
--- a/layout/tables/nsTableCellFrame.h
+++ b/layout/tables/nsTableCellFrame.h
@@ -183,7 +183,10 @@ public:
NS_IMETHOD GetCellIndexes(int32_t &aRowIndex, int32_t &aColIndex) override;
/** return the mapped cell's row index (starting at 0 for the first row) */
- virtual nsresult GetRowIndex(int32_t &aRowIndex) const override;
+ uint32_t RowIndex() const
+ {
+ return static_cast<nsTableRowFrame*>(GetParent())->GetRowIndex();
+ }
/**
* return the cell's specified col span. this is what was specified in the
@@ -194,7 +197,16 @@ public:
int32_t GetColSpan();
/** return the cell's column index (starting at 0 for the first column) */
- virtual nsresult GetColIndex(int32_t &aColIndex) const override;
+ uint32_t ColIndex() const
+ {
+ // NOTE: We copy this from previous continuations, and we don't ever have
+ // dynamic updates when tables split, so our mColIndex always matches our
+ // first continuation's.
+ MOZ_ASSERT(static_cast<nsTableCellFrame*>(FirstContinuation())->mColIndex ==
+ mColIndex,
+ "mColIndex out of sync with first continuation");
+ return mColIndex;
+ }
void SetColIndex(int32_t aColIndex);
/** return the available isize given to this frame during its last reflow */
@@ -246,9 +258,9 @@ public:
virtual void InvalidateFrame(uint32_t aDisplayItemKey = 0) override;
virtual void InvalidateFrameWithRect(const nsRect& aRect, uint32_t aDisplayItemKey = 0) override;
virtual void InvalidateFrameForRemoval() override { InvalidateFrameSubtree(); }
-
+
bool ShouldPaintBordersAndBackgrounds() const;
-
+
bool ShouldPaintBackground(nsDisplayListBuilder* aBuilder);
protected:
diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp
index 868f83bda..4257c9c57 100644
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -368,9 +368,8 @@ nsTableFrame::AttributeChangedFor(nsIFrame* aFrame,
nsTableCellMap* cellMap = GetCellMap();
if (cellMap) {
// for now just remove the cell from the map and reinsert it
- int32_t rowIndex, colIndex;
- cellFrame->GetRowIndex(rowIndex);
- cellFrame->GetColIndex(colIndex);
+ uint32_t rowIndex = cellFrame->RowIndex();
+ uint32_t colIndex = cellFrame->ColIndex();
RemoveCell(cellFrame, rowIndex);
AutoTArray<nsTableCellFrame*, 1> cells;
cells.AppendElement(cellFrame);
@@ -447,9 +446,7 @@ nsTableFrame::GetEffectiveRowSpan(int32_t aRowIndex,
nsTableCellMap* cellMap = GetCellMap();
NS_PRECONDITION (nullptr != cellMap, "bad call, cellMap not yet allocated.");
- int32_t colIndex;
- aCell.GetColIndex(colIndex);
- return cellMap->GetEffectiveRowSpan(aRowIndex, colIndex);
+ return cellMap->GetEffectiveRowSpan(aRowIndex, aCell.ColIndex());
}
int32_t
@@ -458,9 +455,8 @@ nsTableFrame::GetEffectiveRowSpan(const nsTableCellFrame& aCell,
{
nsTableCellMap* tableCellMap = GetCellMap(); if (!tableCellMap) ABORT1(1);
- int32_t colIndex, rowIndex;
- aCell.GetColIndex(colIndex);
- aCell.GetRowIndex(rowIndex);
+ uint32_t colIndex = aCell.ColIndex();
+ uint32_t rowIndex = aCell.RowIndex();
if (aCellMap)
return aCellMap->GetRowSpan(rowIndex, colIndex, true);
@@ -474,9 +470,8 @@ nsTableFrame::GetEffectiveColSpan(const nsTableCellFrame& aCell,
{
nsTableCellMap* tableCellMap = GetCellMap(); if (!tableCellMap) ABORT1(1);
- int32_t colIndex, rowIndex;
- aCell.GetColIndex(colIndex);
- aCell.GetRowIndex(rowIndex);
+ uint32_t colIndex = aCell.ColIndex();
+ uint32_t rowIndex = aCell.RowIndex();
if (aCellMap)
return aCellMap->GetEffectiveColSpan(*tableCellMap, rowIndex, colIndex);
@@ -1221,9 +1216,9 @@ PaintRowGroupBackground(nsTableRowGroupFrame* aRowGroup,
const nsRect& aDirtyRect)
{
for (nsTableRowFrame* row = aRowGroup->GetFirstRow(); row; row = row->GetNextRow()) {
- if (!aDirtyRect.Intersects(nsRect(row->GetNormalPosition(), row->GetSize()))) {
- continue;
- }
+ if (!aDirtyRect.Intersects(nsRect(row->GetNormalPosition(), row->GetSize()))) {
+ continue;
+ }
PaintRowBackground(row, aFrame, aBuilder, aLists, aDirtyRect, row->GetNormalPosition());
}
}
@@ -1234,7 +1229,7 @@ PaintRowGroupBackgroundByColIdx(nsTableRowGroupFrame* aRowGroup,
nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists,
const nsRect& aDirtyRect,
- const nsTArray<int32_t>& aColIdx,
+ const nsTArray<uint32_t>& aColIdx,
const nsPoint& aOffset)
{
MOZ_DIAGNOSTIC_ASSERT(!aColIdx.IsEmpty(),
@@ -1246,8 +1241,7 @@ PaintRowGroupBackgroundByColIdx(nsTableRowGroupFrame* aRowGroup,
}
for (nsTableCellFrame* cell = row->GetFirstCell(); cell; cell = cell->GetNextCell()) {
- int32_t curColIdx;
- cell->GetColIndex(curColIdx);
+ uint32_t curColIdx = cell->ColIndex();
if (!aColIdx.Contains(curColIdx)) {
if (curColIdx > aColIdx.LastElement()) {
// We can just stop looking at this row.
@@ -1318,10 +1312,10 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder,
// Compute background rect by iterating all cell frame.
nsTableColGroupFrame* colGroup = static_cast<nsTableColGroupFrame*>(aFrame);
// Collecting column index.
- AutoTArray<int32_t, 1> colIdx;
+ AutoTArray<uint32_t, 1> colIdx;
for (nsTableColFrame* col = colGroup->GetFirstColumn(); col; col = col->GetNextCol()) {
MOZ_ASSERT(colIdx.IsEmpty() ||
- col->GetColIndex() > colIdx.LastElement());
+ static_cast<uint32_t>(col->GetColIndex()) > colIdx.LastElement());
colIdx.AppendElement(col->GetColIndex());
}
@@ -1341,7 +1335,7 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder,
} else if (aFrame->GetType() == nsGkAtoms::tableColFrame) {
// Compute background rect by iterating all cell frame.
nsTableColFrame* col = static_cast<nsTableColFrame*>(aFrame);
- AutoTArray<int32_t, 1> colIdx;
+ AutoTArray<uint32_t, 1> colIdx;
colIdx.AppendElement(col->GetColIndex());
nsTableFrame* table = col->GetTableFrame();
@@ -3973,9 +3967,8 @@ nsTableFrame::DumpRowGroup(nsIFrame* aKidFrame)
for (nsIFrame* childFrame : cFrame->PrincipalChildList()) {
nsTableCellFrame *cellFrame = do_QueryFrame(childFrame);
if (cellFrame) {
- int32_t colIndex;
- cellFrame->GetColIndex(colIndex);
- printf("cell(%d)=%p ", colIndex, static_cast<void*>(childFrame));
+ uint32_t colIndex = cellFrame->ColIndex();
+ printf("cell(%u)=%p ", colIndex, static_cast<void*>(childFrame));
}
}
printf("\n");
diff --git a/layout/tables/nsTableRowFrame.cpp b/layout/tables/nsTableRowFrame.cpp
index 8bbaf50f5..02b85a141 100644
--- a/layout/tables/nsTableRowFrame.cpp
+++ b/layout/tables/nsTableRowFrame.cpp
@@ -235,7 +235,7 @@ nsTableRowFrame::InsertFrames(ChildListID aListID,
// insert the cells into the cell map
int32_t colIndex = -1;
if (prevCellFrame) {
- prevCellFrame->GetColIndex(colIndex);
+ colIndex = prevCellFrame->ColIndex();
}
tableFrame->InsertCells(cellChildren, GetRowIndex(), colIndex);
@@ -647,8 +647,7 @@ CalcAvailISize(nsTableFrame& aTableFrame,
nsTableCellFrame& aCellFrame)
{
nscoord cellAvailISize = 0;
- int32_t colIndex;
- aCellFrame.GetColIndex(colIndex);
+ uint32_t colIndex = aCellFrame.ColIndex();
int32_t colspan = aTableFrame.GetEffectiveColSpan(aCellFrame);
NS_ASSERTION(colspan > 0, "effective colspan should be positive");
nsTableFrame* fifTable =
@@ -787,12 +786,12 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext,
}
}
- int32_t cellColIndex;
- cellFrame->GetColIndex(cellColIndex);
+ uint32_t cellColIndex = cellFrame->ColIndex();
cellColSpan = aTableFrame.GetEffectiveColSpan(*cellFrame);
// If the adjacent cell is in a prior row (because of a rowspan) add in the space
- if (prevColIndex != (cellColIndex - 1)) {
+ // NOTE: prevColIndex can be -1 here.
+ if (prevColIndex != (static_cast<int32_t>(cellColIndex) - 1)) {
iCoord += GetSpaceBetween(prevColIndex, cellColIndex, cellColSpan, aTableFrame,
false);
}
@@ -1160,8 +1159,7 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
shift = rowRect.BSize(wm);
nsTableCellFrame* cellFrame = GetFirstCell();
if (cellFrame) {
- int32_t rowIndex;
- cellFrame->GetRowIndex(rowIndex);
+ uint32_t rowIndex = cellFrame->RowIndex();
shift += tableFrame->GetRowSpacing(rowIndex);
while (cellFrame) {
LogicalRect cRect = cellFrame->GetLogicalRect(wm, containerSize);
@@ -1192,13 +1190,13 @@ nsTableRowFrame::CollapseRowIfNecessary(nscoord aRowOffset,
for (nsIFrame* kidFrame : mFrames) {
nsTableCellFrame *cellFrame = do_QueryFrame(kidFrame);
if (cellFrame) {
- int32_t cellColIndex;
- cellFrame->GetColIndex(cellColIndex);
+ uint32_t cellColIndex = cellFrame->ColIndex();
int32_t cellColSpan = tableFrame->GetEffectiveColSpan(*cellFrame);
// If the adjacent cell is in a prior row (because of a rowspan) add in
// the space
- if (prevColIndex != (cellColIndex - 1)) {
+ // NOTE: prevColIndex can be -1 here.
+ if (prevColIndex != (static_cast<int32_t>(cellColIndex) - 1)) {
iPos += GetSpaceBetween(prevColIndex, cellColIndex, cellColSpan,
*tableFrame, true);
}
@@ -1311,9 +1309,9 @@ nsTableRowFrame::InsertCellFrame(nsTableCellFrame* aFrame,
for (nsIFrame* child : mFrames) {
nsTableCellFrame *cellFrame = do_QueryFrame(child);
if (cellFrame) {
- int32_t colIndex;
- cellFrame->GetColIndex(colIndex);
- if (colIndex < aColIndex) {
+ uint32_t colIndex = cellFrame->ColIndex();
+ // Can aColIndex be -1 here? Let's assume it can for now.
+ if (static_cast<int32_t>(colIndex) < aColIndex) {
priorCell = cellFrame;
}
else break;
diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp
index f613c8b79..37f577f5c 100644
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -137,8 +137,7 @@ nsTableRowGroupFrame::InitRepeatedFrame(nsTableRowGroupFrame* aHeaderFooterFrame
while (copyCellFrame && originalCellFrame) {
NS_ASSERTION(originalCellFrame->GetContent() == copyCellFrame->GetContent(),
"cell frames have different content");
- int32_t colIndex;
- originalCellFrame->GetColIndex(colIndex);
+ uint32_t colIndex = originalCellFrame->ColIndex();
copyCellFrame->SetColIndex(colIndex);
// Move to the next cell frame
@@ -998,8 +997,7 @@ nsTableRowGroupFrame::SplitSpanningCells(nsPresContext& aPresContext,
nsTableCellFrame* contCell = static_cast<nsTableCellFrame*>(
aPresContext.PresShell()->FrameConstructor()->
CreateContinuingFrame(&aPresContext, cell, &aLastRow));
- int32_t colIndex;
- cell->GetColIndex(colIndex);
+ uint32_t colIndex = cell->ColIndex();
aContRow->InsertCellFrame(contCell, colIndex);
}
}