summaryrefslogtreecommitdiffstats
path: root/layout/tables
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-02-08 15:17:21 +0100
committerGitHub <noreply@github.com>2020-02-08 15:17:21 +0100
commit4234b3a36b364da2d5dd4f243f2543a9d76057d8 (patch)
treeca67c33b41ca9a22e337cdbde71ceeaf4afbc54a /layout/tables
parent6c82d043a1fbcda650057467ae2858025290ed25 (diff)
parent6376eceaebe8852b3b74bc77bd1cd6d06e5bb049 (diff)
downloadUXP-4234b3a36b364da2d5dd4f243f2543a9d76057d8.tar
UXP-4234b3a36b364da2d5dd4f243f2543a9d76057d8.tar.gz
UXP-4234b3a36b364da2d5dd4f243f2543a9d76057d8.tar.lz
UXP-4234b3a36b364da2d5dd4f243f2543a9d76057d8.tar.xz
UXP-4234b3a36b364da2d5dd4f243f2543a9d76057d8.zip
Merge pull request #1393 from win7-7/optimization-3-pr
Do less work for columns not in the desired set in PaintRowGroupBackgroundByColIdx
Diffstat (limited to 'layout/tables')
-rw-r--r--layout/tables/nsTableFrame.cpp38
1 files changed, 26 insertions, 12 deletions
diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp
index 0e54fd093..868f83bda 100644
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1237,19 +1237,29 @@ PaintRowGroupBackgroundByColIdx(nsTableRowGroupFrame* aRowGroup,
const nsTArray<int32_t>& aColIdx,
const nsPoint& aOffset)
{
+ MOZ_DIAGNOSTIC_ASSERT(!aColIdx.IsEmpty(),
+ "Must be painting backgrounds for something");
for (nsTableRowFrame* row = aRowGroup->GetFirstRow(); row; row = row->GetNextRow()) {
auto rowPos = row->GetNormalPosition() + aOffset;
if (!aDirtyRect.Intersects(nsRect(rowPos, row->GetSize()))) {
continue;
}
for (nsTableCellFrame* cell = row->GetFirstCell(); cell; cell = cell->GetNextCell()) {
+
+ int32_t curColIdx;
+ cell->GetColIndex(curColIdx);
+ if (!aColIdx.Contains(curColIdx)) {
+ if (curColIdx > aColIdx.LastElement()) {
+ // We can just stop looking at this row.
+ break;
+ }
+ continue;
+ }
+
if (!cell->ShouldPaintBackground(aBuilder)) {
continue;
}
- int32_t curColIdx;
- cell->GetColIndex(curColIdx);
- if (aColIdx.Contains(curColIdx)) {
auto cellPos = cell->GetNormalPosition() + rowPos;
auto cellRect = nsRect(cellPos, cell->GetSize());
if (!aDirtyRect.Intersects(cellRect)) {
@@ -1260,7 +1270,6 @@ PaintRowGroupBackgroundByColIdx(nsTableRowGroupFrame* aRowGroup,
true, nullptr,
aFrame->GetRectRelativeToSelf(),
cell);
- }
}
}
}
@@ -1311,18 +1320,23 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder,
// Collecting column index.
AutoTArray<int32_t, 1> colIdx;
for (nsTableColFrame* col = colGroup->GetFirstColumn(); col; col = col->GetNextCol()) {
+ MOZ_ASSERT(colIdx.IsEmpty() ||
+ col->GetColIndex() > colIdx.LastElement());
colIdx.AppendElement(col->GetColIndex());
}
- nsTableFrame* table = colGroup->GetTableFrame();
- RowGroupArray rowGroups;
- table->OrderRowGroups(rowGroups);
- for (nsTableRowGroupFrame* rowGroup : rowGroups) {
- auto offset = rowGroup->GetNormalPosition() - colGroup->GetNormalPosition();
- if (!aDirtyRect.Intersects(nsRect(offset, rowGroup->GetSize()))) {
- continue;
- }
+ if (!colIdx.IsEmpty()) {
+ // We have some actual cells that live inside this rowgroup.
+ nsTableFrame* table = colGroup->GetTableFrame();
+ RowGroupArray rowGroups;
+ table->OrderRowGroups(rowGroups);
+ for (nsTableRowGroupFrame* rowGroup : rowGroups) {
+ auto offset = rowGroup->GetNormalPosition() - colGroup->GetNormalPosition();
+ if (!aDirtyRect.Intersects(nsRect(offset, rowGroup->GetSize()))) {
+ continue;
+ }
PaintRowGroupBackgroundByColIdx(rowGroup, aFrame, aBuilder, aLists, aDirtyRect, colIdx, offset);
+ }
}
} else if (aFrame->GetType() == nsGkAtoms::tableColFrame) {
// Compute background rect by iterating all cell frame.