From dba09fa5c43276bb455cc4da6bd0ec302f798189 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Wed, 26 Feb 2020 20:51:22 +0100 Subject: Revert "Issue #1355 - Better way to create display items for column backgrounds" This reverts commit 44c47c50388f526c2d134e16d5debebe94a0faf8. --- layout/tables/nsTableCellFrame.cpp | 54 ++++++++------------------------------ 1 file changed, 11 insertions(+), 43 deletions(-) (limited to 'layout/tables/nsTableCellFrame.cpp') diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 9c715d999..8b811df1e 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -450,6 +450,7 @@ nsTableCellFrame::ShouldPaintBackground(nsDisplayListBuilder* aBuilder) void nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, + const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { DO_GLOBAL_REFLOW_COUNT_DSP("nsTableCellFrame"); @@ -461,14 +462,14 @@ nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, new (aBuilder) nsDisplayBoxShadowOuter(aBuilder, this)); } - nsRect bgRect = GetRectRelativeToSelf() + aBuilder->ToReferenceFrame(this); - // display background if we need to. if (aBuilder->IsForEventDelivery() || !StyleBackground()->IsTransparent() || StyleDisplay()->mAppearance) { - nsDisplayBackgroundImage::AppendBackgroundItemsToTop( - aBuilder, this, bgRect, aLists.BorderBackground()); + nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder, + this, + GetRectRelativeToSelf(), + aLists.BorderBackground()); } // display inset box-shadows if we need to. @@ -487,49 +488,16 @@ nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, "TableCellSelection", nsDisplayItem::TYPE_TABLE_CELL_SELECTION)); } - - // This can be null if display list building initiated in the middle - // of the table, which can happen with background-clip:text and - // -moz-element. - nsDisplayTableBackgroundSet* backgrounds = - aBuilder->GetTableBackgroundSet(); - if (backgrounds) { - // Compute bgRect relative to reference frame, but using the - // normal (without position:relative offsets) positions for the - // cell, row and row group. - bgRect = GetRectRelativeToSelf() + GetNormalPosition(); - - nsTableRowFrame* row = GetTableRowFrame(); - bgRect += row->GetNormalPosition(); - - nsTableRowGroupFrame* rowGroup = row->GetTableRowGroupFrame(); - bgRect += rowGroup->GetNormalPosition(); - - bgRect += backgrounds->TableToReferenceFrame(); - - // Create backgrounds items as needed for the column and column - // group that this cell occupies. - nsTableColFrame* col = backgrounds->GetColForIndex(ColIndex()); - nsTableColGroupFrame* colGroup = col->GetTableColGroupFrame(); - - Maybe buildingForColGroup; - nsDisplayBackgroundImage::AppendBackgroundItemsToTop( - aBuilder, colGroup, bgRect, backgrounds->ColGroupBackgrounds(), false, - nullptr, colGroup->GetRect() + backgrounds->TableToReferenceFrame(), - this, &buildingForColGroup); - - Maybe buildingForCol; - nsDisplayBackgroundImage::AppendBackgroundItemsToTop( - aBuilder, col, bgRect, backgrounds->ColBackgrounds(), false, nullptr, - col->GetRect() + colGroup->GetPosition() + - backgrounds->TableToReferenceFrame(), - this, &buildingForCol); - } } // the 'empty-cells' property has no effect on 'outline' DisplayOutline(aBuilder, aLists); + // Push a null 'current table item' so that descendant tables can't + // accidentally mess with our table + nsAutoPushCurrentTableItem pushTableItem; + pushTableItem.Push(aBuilder, nullptr); + nsIFrame* kid = mFrames.FirstChild(); NS_ASSERTION(kid && !kid->GetNextSibling(), "Table cells should have just one child"); // The child's background will go in our BorderBackground() list. @@ -538,7 +506,7 @@ nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, // because that/ would put the child's background in the Content() list // which isn't right (e.g., would end up on top of our child floats for // event handling). - BuildDisplayListForChild(aBuilder, kid, aLists); + BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aLists); } nsIFrame::LogicalSides -- cgit v1.2.3