mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 15:58:39 +09:00
Issue #1355 - Make addition of cell border display items depend on
whether they should be drawn. This reduces the size of display lists for tables by only adding display list items that are actually going to be visibly drawn, which will help overall performance of table drawing.
This commit is contained in:
parent
4f0a0c4606
commit
1069ed9273
2 changed files with 112 additions and 4 deletions
|
|
@ -1268,6 +1268,74 @@ PaintRowGroupBackgroundByColIdx(nsTableRowGroupFrame* aRowGroup,
|
|||
}
|
||||
}
|
||||
|
||||
static inline bool FrameHasBorder(nsIFrame* f)
|
||||
{
|
||||
if (!f->StyleVisibility()->IsVisible()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (f->StyleBorder()->HasBorder()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void nsTableFrame::CalcHasBCBorders()
|
||||
{
|
||||
if (!IsBorderCollapse()) {
|
||||
SetHasBCBorders(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (FrameHasBorder(this)) {
|
||||
SetHasBCBorders(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Check col and col group has borders.
|
||||
for (nsIFrame* f : this->GetChildList(kColGroupList)) {
|
||||
if (FrameHasBorder(f)) {
|
||||
SetHasBCBorders(true);
|
||||
return;
|
||||
}
|
||||
|
||||
nsTableColGroupFrame *colGroup = static_cast<nsTableColGroupFrame*>(f);
|
||||
for (nsTableColFrame* col = colGroup->GetFirstColumn(); col; col = col->GetNextCol()) {
|
||||
if (FrameHasBorder(col)) {
|
||||
SetHasBCBorders(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check row group, row and cell has borders.
|
||||
RowGroupArray rowGroups;
|
||||
OrderRowGroups(rowGroups);
|
||||
for (nsTableRowGroupFrame* rowGroup : rowGroups) {
|
||||
if (FrameHasBorder(rowGroup)) {
|
||||
SetHasBCBorders(true);
|
||||
return;
|
||||
}
|
||||
|
||||
for (nsTableRowFrame* row = rowGroup->GetFirstRow(); row; row = row->GetNextRow()) {
|
||||
if (FrameHasBorder(row)) {
|
||||
SetHasBCBorders(true);
|
||||
return;
|
||||
}
|
||||
|
||||
for (nsTableCellFrame* cell = row->GetFirstCell(); cell; cell = cell->GetNextCell()) {
|
||||
if (FrameHasBorder(cell)) {
|
||||
SetHasBCBorders(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetHasBCBorders(false);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder,
|
||||
nsFrame* aFrame,
|
||||
|
|
@ -1375,11 +1443,16 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder,
|
|||
nsTableFrame* table = static_cast<nsTableFrame*>(aFrame);
|
||||
// In the collapsed border model, overlay all collapsed borders.
|
||||
if (table->IsBorderCollapse()) {
|
||||
aLists.BorderBackground()->AppendNewToTop(
|
||||
new (aBuilder) nsDisplayTableBorderCollapse(aBuilder, table));
|
||||
if (table->HasBCBorders()) {
|
||||
aLists.BorderBackground()->AppendNewToTop(
|
||||
new (aBuilder) nsDisplayTableBorderCollapse(aBuilder, table));
|
||||
}
|
||||
} else {
|
||||
aLists.BorderBackground()->AppendNewToTop(
|
||||
new (aBuilder) nsDisplayBorder(aBuilder, table));
|
||||
const nsStyleBorder* borderStyle = aFrame->StyleBorder();
|
||||
if (borderStyle->HasBorder()) {
|
||||
aLists.BorderBackground()->AppendNewToTop(
|
||||
new (aBuilder) nsDisplayBorder(aBuilder, table));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4101,6 +4174,7 @@ nsTableFrame::AddBCDamageArea(const TableArea& aValue)
|
|||
#endif
|
||||
|
||||
SetNeedToCalcBCBorders(true);
|
||||
SetNeedToCalcHasBCBorders(true);
|
||||
// Get the property
|
||||
BCPropertyData* value = GetOrCreateBCProperty();
|
||||
if (value) {
|
||||
|
|
@ -4141,6 +4215,7 @@ nsTableFrame::SetFullBCDamageArea()
|
|||
NS_ASSERTION(IsBorderCollapse(), "invalid SetFullBCDamageArea call");
|
||||
|
||||
SetNeedToCalcBCBorders(true);
|
||||
SetNeedToCalcHasBCBorders(true);
|
||||
|
||||
BCPropertyData* value = GetOrCreateBCProperty();
|
||||
if (value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue