mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 07:18:39 +09:00
Issue #1355 - Make nsTableCellFrame::GetColIndex/GetRowIndex faster
We can devirtualize it, remove some branches.
This commit is contained in:
parent
bcbf8e8983
commit
e8bb5560f7
12 changed files with 106 additions and 152 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue