diff options
author | Moonchild <git-repo@palemoon.org> | 2020-02-17 12:40:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-17 12:40:36 +0100 |
commit | a4ab3fc59dcd26d527716ae8ed23adf9148cb699 (patch) | |
tree | f5c0845fac59471189d20e88617531dcdb1b79dd /layout/tables/nsTableFrame.cpp | |
parent | e8417acbff563634f11f25461d953b951caac056 (diff) | |
parent | d4098037a4a6bee464fde4b70644e730e13b487f (diff) | |
download | UXP-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/tables/nsTableFrame.cpp')
-rw-r--r-- | layout/tables/nsTableFrame.cpp | 41 |
1 files changed, 17 insertions, 24 deletions
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"); |