From 157cd64a8efd0d9ed7a39004aafdb1e1e5e4c338 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 30 Apr 2020 21:45:28 +0000 Subject: Issue #80 - De-unify layout/tables --- layout/tables/nsTableFrame.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'layout/tables/nsTableFrame.cpp') diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index e5a48139a..648fa7ddf 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -41,6 +41,7 @@ #include "nsCSSFrameConstructor.h" #include "mozilla/StyleSetHandle.h" #include "mozilla/StyleSetHandleInlines.h" +#include "mozilla/gfx/Helpers.h" #include "nsDisplayList.h" #include "nsIScrollableFrame.h" #include "nsCSSProps.h" @@ -48,6 +49,7 @@ #include using namespace mozilla; +using namespace mozilla::gfx; using namespace mozilla::image; using namespace mozilla::layout; -- cgit v1.2.3 From 71137783ac6927bd0dc02fce1d6e61e6ec027753 Mon Sep 17 00:00:00 2001 From: win7-7 Date: Fri, 8 May 2020 15:20:01 +0300 Subject: Issue #1355 - Store the dirty rect on the display list builder rather than passing it as a parameter to BuildDisplayList Also fix build bustage for De-unified layout/xul in nsRootBoxFrame.cpp --- layout/tables/nsTableFrame.cpp | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) (limited to 'layout/tables/nsTableFrame.cpp') diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 648fa7ddf..99838f217 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -1165,7 +1165,7 @@ nsDisplayTableBorderCollapse::Paint(nsDisplayListBuilder* aBuilder, /* static */ void nsTableFrame::GenericTraversal(nsDisplayListBuilder* aBuilder, nsFrame* aFrame, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) + const nsDisplayListSet& aLists) { // This is similar to what nsContainerFrame::BuildDisplayListForNonBlockChildren // does, except that we allow the children's background and borders to go @@ -1176,11 +1176,11 @@ nsTableFrame::GenericTraversal(nsDisplayListBuilder* aBuilder, nsFrame* aFrame, // BorderBackground list anyway. It does affect cell borders though; this // lets us get cell borders into the nsTableFrame's BorderBackground list. for (nsIFrame* kid : aFrame->GetChildList(kColGroupList)) { - aFrame->BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists); + aFrame->BuildDisplayListForChild(aBuilder, kid, aLists); } for (nsIFrame* kid : aFrame->PrincipalChildList()) { - aFrame->BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists); + aFrame->BuildDisplayListForChild(aBuilder, kid, aLists); } } @@ -1189,7 +1189,6 @@ PaintRowBackground(nsTableRowFrame* aRow, nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists, - const nsRect& aDirtyRect, const nsPoint& aOffset = nsPoint()) { // Compute background rect by iterating over all cell frames. @@ -1199,7 +1198,7 @@ PaintRowBackground(nsTableRowFrame* aRow, } auto cellRect = cell->GetRectRelativeToSelf() + cell->GetNormalPosition() + aOffset; - if (!aDirtyRect.Intersects(cellRect)) { + if (!aBuilder->GetDirtyRect().Intersects(cellRect)) { continue; } nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder, aFrame, cellRect, @@ -1214,14 +1213,14 @@ static void PaintRowGroupBackground(nsTableRowGroupFrame* aRowGroup, nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, - const nsDisplayListSet& aLists, - const nsRect& aDirtyRect) + const nsDisplayListSet& aLists) { for (nsTableRowFrame* row = aRowGroup->GetFirstRow(); row; row = row->GetNextRow()) { - if (!aDirtyRect.Intersects(nsRect(row->GetNormalPosition(), row->GetSize()))) { + if (!aBuilder->GetDirtyRect().Intersects(nsRect(row->GetNormalPosition(), + row->GetSize()))) { continue; } - PaintRowBackground(row, aFrame, aBuilder, aLists, aDirtyRect, row->GetNormalPosition()); + PaintRowBackground(row, aFrame, aBuilder, aLists, row->GetNormalPosition()); } } @@ -1230,7 +1229,6 @@ PaintRowGroupBackgroundByColIdx(nsTableRowGroupFrame* aRowGroup, nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists, - const nsRect& aDirtyRect, const nsTArray& aColIdx, const nsPoint& aOffset) { @@ -1238,7 +1236,7 @@ PaintRowGroupBackgroundByColIdx(nsTableRowGroupFrame* aRowGroup, "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()))) { + if (!aBuilder->GetDirtyRect().Intersects(nsRect(rowPos, row->GetSize()))) { continue; } for (nsTableCellFrame* cell = row->GetFirstCell(); cell; cell = cell->GetNextCell()) { @@ -1258,7 +1256,7 @@ PaintRowGroupBackgroundByColIdx(nsTableRowGroupFrame* aRowGroup, auto cellPos = cell->GetNormalPosition() + rowPos; auto cellRect = nsRect(cellPos, cell->GetSize()); - if (!aDirtyRect.Intersects(cellRect)) { + if (!aBuilder->GetDirtyRect().Intersects(cellRect)) { continue; } nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder, aFrame, cellRect, @@ -1341,7 +1339,6 @@ void nsTableFrame::CalcHasBCBorders() /* static */ void nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder, nsFrame* aFrame, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists, DisplayGenericTablePartTraversal aTraversal) { @@ -1374,10 +1371,10 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder, // See spec at https://drafts.csswg.org/css-tables-3/#drawing-cell-backgrounds if (aFrame->GetType() == nsGkAtoms::tableRowGroupFrame) { nsTableRowGroupFrame* rowGroup = static_cast(aFrame); - PaintRowGroupBackground(rowGroup, aFrame, aBuilder, aLists, aDirtyRect); + PaintRowGroupBackground(rowGroup, aFrame, aBuilder, aLists); } else if (aFrame->GetType() == nsGkAtoms::tableRowFrame) { nsTableRowFrame* row = static_cast(aFrame); - PaintRowBackground(row, aFrame, aBuilder, aLists, aDirtyRect); + PaintRowBackground(row, aFrame, aBuilder, aLists); } else if (aFrame->GetType() == nsGkAtoms::tableColGroupFrame) { // Compute background rect by iterating all cell frame. nsTableColGroupFrame* colGroup = static_cast(aFrame); @@ -1396,10 +1393,10 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder, table->OrderRowGroups(rowGroups); for (nsTableRowGroupFrame* rowGroup : rowGroups) { auto offset = rowGroup->GetNormalPosition() - colGroup->GetNormalPosition(); - if (!aDirtyRect.Intersects(nsRect(offset, rowGroup->GetSize()))) { + if (!aBuilder->GetDirtyRect().Intersects(nsRect(offset, rowGroup->GetSize()))) { continue; } - PaintRowGroupBackgroundByColIdx(rowGroup, aFrame, aBuilder, aLists, aDirtyRect, colIdx, offset); + PaintRowGroupBackgroundByColIdx(rowGroup, aFrame, aBuilder, aLists, colIdx, offset); } } } else if (aFrame->GetType() == nsGkAtoms::tableColFrame) { @@ -1415,10 +1412,10 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder, auto offset = rowGroup->GetNormalPosition() - col->GetNormalPosition() - col->GetTableColGroupFrame()->GetNormalPosition(); - if (!aDirtyRect.Intersects(nsRect(offset, rowGroup->GetSize()))) { + if (!aBuilder->GetDirtyRect().Intersects(nsRect(offset, rowGroup->GetSize()))) { continue; } - PaintRowGroupBackgroundByColIdx(rowGroup, aFrame, aBuilder, aLists, aDirtyRect, colIdx, offset); + PaintRowGroupBackgroundByColIdx(rowGroup, aFrame, aBuilder, aLists, colIdx, offset); } } else if (isVisible) { nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder, aFrame, @@ -1438,7 +1435,7 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder, } } - aTraversal(aBuilder, aFrame, aDirtyRect, aLists); + aTraversal(aBuilder, aFrame, aLists); if (isVisible) { if (isTable) { @@ -1466,12 +1463,11 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder, // SEC: TODO: adjust the rect for captions void nsTableFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { DO_GLOBAL_REFLOW_COUNT_DSP_COLOR("nsTableFrame", NS_RGB(255,128,255)); - DisplayGenericTablePart(aBuilder, this, aDirtyRect, aLists); + DisplayGenericTablePart(aBuilder, this, aLists); } nsMargin -- cgit v1.2.3 From d8d0538162defbb3e44be475c4781bb71f55c2ba Mon Sep 17 00:00:00 2001 From: win7-7 Date: Fri, 8 May 2020 01:13:51 +0300 Subject: Issue #1355 - SetNeedToCalcHasBCBorders to true when initialize nsTableFrame In the printing preview, we create continuous table frame if table is too long to containing in a page. But the default value of NeedToCalcHasBCBorders is false which means we don't calculate HasBCBorders for continuous table frame. Thus, the border collapse is not shown when printing preview. --- layout/tables/nsTableFrame.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'layout/tables/nsTableFrame.cpp') diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 99838f217..57b249fb3 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -176,6 +176,9 @@ nsTableFrame::Init(nsIContent* aContent, const nsStyleTableBorder* tableStyle = StyleTableBorder(); bool borderCollapse = (NS_STYLE_BORDER_COLLAPSE == tableStyle->mBorderCollapse); SetBorderCollapse(borderCollapse); + if (borderCollapse) { + SetNeedToCalcHasBCBorders(true); + } if (!aPrevInFlow) { // If we're the first-in-flow, we manage the cell map & layout strategy that -- cgit v1.2.3 From d3d3aad6e52397334844ed80f8db650174937854 Mon Sep 17 00:00:00 2001 From: win7-7 Date: Fri, 8 May 2020 01:21:41 +0300 Subject: Issue #1355 - Better way to create display items for column backgrounds Part 1: Remove current table item, as it's never set. Part 2: Get rid of generic table painting code, and handle each class separately. Part 4: Hoist outline skipping into col(group) frame code. Part 5: Skip box-shadow for table column and column groups. Part 6: Store column and column group backgrounds separately, and then append them before the rest of the table contents. Part 7: Pass rects in display list coordinates to AppendBackgroundItemsToTop. Part 8: Create column and column group background display items as part of the cell's BuildDisplayList. Part 9: Used cached values instead of calling nsDisplayListBuilder::ToReferenceFrame when possible, since it can be expensive when the requested frame isn't the builder's current frame. Part 10: Make sure we build display items for table parts where only the normal position is visible, since we may need to create background items for ancestors at that position. Part 11: Create an AutoBuildingDisplayList when we create background items for table columns and column groups, so that we initialize the invalidation state correctly. --- layout/tables/nsTableFrame.cpp | 286 ++++++++--------------------------------- 1 file changed, 51 insertions(+), 235 deletions(-) (limited to 'layout/tables/nsTableFrame.cpp') diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 57b249fb3..59a6d0f1a 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -1166,113 +1166,7 @@ nsDisplayTableBorderCollapse::Paint(nsDisplayListBuilder* aBuilder, static_cast(mFrame)->PaintBCBorders(*drawTarget, mVisibleRect - pt); } -/* static */ void -nsTableFrame::GenericTraversal(nsDisplayListBuilder* aBuilder, nsFrame* aFrame, - const nsDisplayListSet& aLists) -{ - // This is similar to what nsContainerFrame::BuildDisplayListForNonBlockChildren - // does, except that we allow the children's background and borders to go - // in our BorderBackground list. This doesn't really affect background - // painting --- the children won't actually draw their own backgrounds - // because the nsTableFrame already drew them, unless a child has its own - // stacking context, in which case the child won't use its passed-in - // BorderBackground list anyway. It does affect cell borders though; this - // lets us get cell borders into the nsTableFrame's BorderBackground list. - for (nsIFrame* kid : aFrame->GetChildList(kColGroupList)) { - aFrame->BuildDisplayListForChild(aBuilder, kid, aLists); - } - - for (nsIFrame* kid : aFrame->PrincipalChildList()) { - aFrame->BuildDisplayListForChild(aBuilder, kid, aLists); - } -} - -static void -PaintRowBackground(nsTableRowFrame* aRow, - nsIFrame* aFrame, - nsDisplayListBuilder* aBuilder, - const nsDisplayListSet& aLists, - const nsPoint& aOffset = nsPoint()) -{ - // Compute background rect by iterating over all cell frames. - for (nsTableCellFrame* cell = aRow->GetFirstCell(); cell; cell = cell->GetNextCell()) { - if (!cell->ShouldPaintBackground(aBuilder)) { - continue; - } - - auto cellRect = cell->GetRectRelativeToSelf() + cell->GetNormalPosition() + aOffset; - if (!aBuilder->GetDirtyRect().Intersects(cellRect)) { - continue; - } - nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder, aFrame, cellRect, - aLists.BorderBackground(), - true, nullptr, - aFrame->GetRectRelativeToSelf(), - cell); - } -} - -static void -PaintRowGroupBackground(nsTableRowGroupFrame* aRowGroup, - nsIFrame* aFrame, - nsDisplayListBuilder* aBuilder, - const nsDisplayListSet& aLists) -{ - for (nsTableRowFrame* row = aRowGroup->GetFirstRow(); row; row = row->GetNextRow()) { - if (!aBuilder->GetDirtyRect().Intersects(nsRect(row->GetNormalPosition(), - row->GetSize()))) { - continue; - } - PaintRowBackground(row, aFrame, aBuilder, aLists, row->GetNormalPosition()); - } -} - -static void -PaintRowGroupBackgroundByColIdx(nsTableRowGroupFrame* aRowGroup, - nsIFrame* aFrame, - nsDisplayListBuilder* aBuilder, - const nsDisplayListSet& aLists, - const nsTArray& 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 (!aBuilder->GetDirtyRect().Intersects(nsRect(rowPos, row->GetSize()))) { - continue; - } - for (nsTableCellFrame* cell = row->GetFirstCell(); cell; cell = cell->GetNextCell()) { - - uint32_t curColIdx = cell->ColIndex(); - if (!aColIdx.Contains(curColIdx)) { - if (curColIdx > aColIdx.LastElement()) { - // We can just stop looking at this row. - break; - } - continue; - } - - if (!cell->ShouldPaintBackground(aBuilder)) { - continue; - } - - auto cellPos = cell->GetNormalPosition() + rowPos; - auto cellRect = nsRect(cellPos, cell->GetSize()); - if (!aBuilder->GetDirtyRect().Intersects(cellRect)) { - continue; - } - nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder, aFrame, cellRect, - aLists.BorderBackground(), - true, nullptr, - aFrame->GetRectRelativeToSelf(), - cell); - } - } -} - -static inline bool FrameHasBorder(nsIFrame* f) -{ +static inline bool FrameHasBorder(nsIFrame* f) { if (!f->StyleVisibility()->IsVisible()) { return false; } @@ -1284,8 +1178,7 @@ static inline bool FrameHasBorder(nsIFrame* f) return false; } -void nsTableFrame::CalcHasBCBorders() -{ +void nsTableFrame::CalcHasBCBorders() { if (!IsBorderCollapse()) { SetHasBCBorders(false); return; @@ -1303,8 +1196,9 @@ void nsTableFrame::CalcHasBCBorders() return; } - nsTableColGroupFrame *colGroup = static_cast(f); - for (nsTableColFrame* col = colGroup->GetFirstColumn(); col; col = col->GetNextCol()) { + nsTableColGroupFrame* colGroup = static_cast(f); + for (nsTableColFrame* col = colGroup->GetFirstColumn(); col; + col = col->GetNextCol()) { if (FrameHasBorder(col)) { SetHasBCBorders(true); return; @@ -1321,13 +1215,15 @@ void nsTableFrame::CalcHasBCBorders() return; } - for (nsTableRowFrame* row = rowGroup->GetFirstRow(); row; row = row->GetNextRow()) { + for (nsTableRowFrame* row = rowGroup->GetFirstRow(); row; + row = row->GetNextRow()) { if (FrameHasBorder(row)) { SetHasBCBorders(true); return; } - for (nsTableCellFrame* cell = row->GetFirstCell(); cell; cell = cell->GetNextCell()) { + for (nsTableCellFrame* cell = row->GetFirstCell(); cell; + cell = cell->GetNextCell()) { if (FrameHasBorder(cell)) { SetHasBCBorders(true); return; @@ -1339,138 +1235,58 @@ void nsTableFrame::CalcHasBCBorders() SetHasBCBorders(false); } -/* static */ void -nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder, - nsFrame* aFrame, - const nsDisplayListSet& aLists, - DisplayGenericTablePartTraversal aTraversal) -{ - bool isVisible = aFrame->IsVisibleForPainting(aBuilder); - bool isTable = (aFrame->GetType() == nsGkAtoms::tableFrame); - - if (isVisible || !isTable) { - nsDisplayTableItem* currentItem = aBuilder->GetCurrentTableItem(); - // currentItem may be null, when none of the table parts have a - // background or border - if (currentItem) { - currentItem->UpdateForFrameBackground(aFrame); - } - } - - if (isVisible) { - // XXX: should box-shadow for rows/rowgroups/columns/colgroups get painted - // just because we're visible? Or should it depend on the cell visibility - // when we're not the whole table? - - // Paint the outset box-shadows for the table frames - if (aFrame->StyleEffects()->mBoxShadow) { - aLists.BorderBackground()->AppendNewToTop( - new (aBuilder) nsDisplayBoxShadowOuter(aBuilder, aFrame)); - } - } - - // Background visibility for rows, rowgroups, columns, colgroups depends on - // the visibility of the _cell_, not of the row/col(group). - // See spec at https://drafts.csswg.org/css-tables-3/#drawing-cell-backgrounds - if (aFrame->GetType() == nsGkAtoms::tableRowGroupFrame) { - nsTableRowGroupFrame* rowGroup = static_cast(aFrame); - PaintRowGroupBackground(rowGroup, aFrame, aBuilder, aLists); - } else if (aFrame->GetType() == nsGkAtoms::tableRowFrame) { - nsTableRowFrame* row = static_cast(aFrame); - PaintRowBackground(row, aFrame, aBuilder, aLists); - } else if (aFrame->GetType() == nsGkAtoms::tableColGroupFrame) { - // Compute background rect by iterating all cell frame. - nsTableColGroupFrame* colGroup = static_cast(aFrame); - // Collecting column index. - AutoTArray colIdx; - for (nsTableColFrame* col = colGroup->GetFirstColumn(); col; col = col->GetNextCol()) { - MOZ_ASSERT(colIdx.IsEmpty() || - static_cast(col->GetColIndex()) > colIdx.LastElement()); - colIdx.AppendElement(col->GetColIndex()); - } - - 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 (!aBuilder->GetDirtyRect().Intersects(nsRect(offset, rowGroup->GetSize()))) { - continue; - } - PaintRowGroupBackgroundByColIdx(rowGroup, aFrame, aBuilder, aLists, colIdx, offset); - } - } - } else if (aFrame->GetType() == nsGkAtoms::tableColFrame) { - // Compute background rect by iterating all cell frame. - nsTableColFrame* col = static_cast(aFrame); - AutoTArray colIdx; - colIdx.AppendElement(col->GetColIndex()); +// table paint code is concerned primarily with borders and bg color +// SEC: TODO: adjust the rect for captions +void +nsTableFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, + const nsDisplayListSet& aLists) +{ + DO_GLOBAL_REFLOW_COUNT_DSP_COLOR("nsTableFrame", NS_RGB(255,128,255)); - nsTableFrame* table = col->GetTableFrame(); - RowGroupArray rowGroups; - table->OrderRowGroups(rowGroups); - for (nsTableRowGroupFrame* rowGroup : rowGroups) { - auto offset = rowGroup->GetNormalPosition() - - col->GetNormalPosition() - - col->GetTableColGroupFrame()->GetNormalPosition(); - if (!aBuilder->GetDirtyRect().Intersects(nsRect(offset, rowGroup->GetSize()))) { - continue; - } - PaintRowGroupBackgroundByColIdx(rowGroup, aFrame, aBuilder, aLists, colIdx, offset); - } - } else if (isVisible) { - nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder, aFrame, - aFrame->GetRectRelativeToSelf(), - aLists.BorderBackground()); - } + DisplayBorderBackgroundOutline(aBuilder, aLists); - if (isVisible) { - // XXX: should box-shadow for rows/rowgroups/columns/colgroups get painted - // just because we're visible? Or should it depend on the cell visibility - // when we're not the whole table? + nsDisplayTableBackgroundSet tableBGs(aBuilder, this); + nsDisplayListCollection lists(aBuilder); - // Paint the inset box-shadows for the table frames - if (aFrame->StyleEffects()->mBoxShadow) { - aLists.BorderBackground()->AppendNewToTop( - new (aBuilder) nsDisplayBoxShadowInner(aBuilder, aFrame)); +// This is similar to what + // nsContainerFrame::BuildDisplayListForNonBlockChildren does, except that we + // allow the children's background and borders to go in our BorderBackground + // list. This doesn't really affect background painting --- the children won't + // actually draw their own backgrounds because the nsTableFrame already drew + // them, unless a child has its own stacking context, in which case the child + // won't use its passed-in BorderBackground list anyway. It does affect cell + // borders though; this lets us get cell borders into the nsTableFrame's + // BorderBackground list. + for (nsIFrame* colGroup : FirstContinuation()->GetChildList(kColGroupList)) { + for (nsIFrame* col : colGroup->PrincipalChildList()) { + tableBGs.AddColumn((nsTableColFrame*)col); } } - aTraversal(aBuilder, aFrame, aLists); + for (nsIFrame* kid : PrincipalChildList()) { + BuildDisplayListForChild(aBuilder, kid, lists); + } - if (isVisible) { - if (isTable) { - nsTableFrame* table = static_cast(aFrame); - // In the collapsed border model, overlay all collapsed borders. - if (table->IsBorderCollapse()) { - if (table->HasBCBorders()) { - aLists.BorderBackground()->AppendNewToTop( - new (aBuilder) nsDisplayTableBorderCollapse(aBuilder, table)); - } - } else { - const nsStyleBorder* borderStyle = aFrame->StyleBorder(); - if (borderStyle->HasBorder()) { - aLists.BorderBackground()->AppendNewToTop( - new (aBuilder) nsDisplayBorder(aBuilder, table)); - } + tableBGs.MoveTo(aLists); + lists.MoveTo(aLists); + + if (IsVisibleForPainting(aBuilder)) { + // In the collapsed border model, overlay all collapsed borders. + if (IsBorderCollapse()) { + if (HasBCBorders()) { + aLists.BorderBackground()->AppendNewToTop( + new (aBuilder) nsDisplayTableBorderCollapse + (aBuilder, this)); + } + } else { + const nsStyleBorder* borderStyle = StyleBorder(); + if (borderStyle->HasBorder()) { + aLists.BorderBackground()->AppendNewToTop( + new (aBuilder) nsDisplayBorder + (aBuilder, this)); } } } - - aFrame->DisplayOutline(aBuilder, aLists); -} - -// table paint code is concerned primarily with borders and bg color -// SEC: TODO: adjust the rect for captions -void -nsTableFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsDisplayListSet& aLists) -{ - DO_GLOBAL_REFLOW_COUNT_DSP_COLOR("nsTableFrame", NS_RGB(255,128,255)); - - DisplayGenericTablePart(aBuilder, this, aLists); } nsMargin -- cgit v1.2.3