diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-02-02 02:16:41 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:22:44 +0200 |
commit | fddc35e4384c20b1ad5d0c9818f490be29b1ece5 (patch) | |
tree | 46d948b46e1057a21f382152c9ac4215eb5703fa /layout/tables/nsTableCellFrame.cpp | |
parent | 7e4efa4e1f9d1569edcaed7440fbbfe831236c8d (diff) | |
download | UXP-fddc35e4384c20b1ad5d0c9818f490be29b1ece5.tar UXP-fddc35e4384c20b1ad5d0c9818f490be29b1ece5.tar.gz UXP-fddc35e4384c20b1ad5d0c9818f490be29b1ece5.tar.lz UXP-fddc35e4384c20b1ad5d0c9818f490be29b1ece5.tar.xz UXP-fddc35e4384c20b1ad5d0c9818f490be29b1ece5.zip |
Issue #1378 - Align the drawing of table cell backgrounds with the spec.
Diffstat (limited to 'layout/tables/nsTableCellFrame.cpp')
-rw-r--r-- | layout/tables/nsTableCellFrame.cpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp index 043509fc4..2862bb201 100644 --- a/layout/tables/nsTableCellFrame.cpp +++ b/layout/tables/nsTableCellFrame.cpp @@ -450,19 +450,40 @@ PaintTableCellSelection(nsIFrame* aFrame, DrawTarget* aDrawTarget, aPt); } +bool +nsTableCellFrame::ShouldPaintBordersAndBackgrounds() const +{ + // If we're not visible, we don't paint. + if (!StyleVisibility()->IsVisible()) { + return false; + } + + // Consider 'empty-cells', but only in separated borders mode. + if (!GetContentEmpty()) { + return true; + } + + nsTableFrame* tableFrame = GetTableFrame(); + if (tableFrame->IsBorderCollapse()) { + return true; + } + + return StyleTableBorder()->mEmptyCells == NS_STYLE_TABLE_EMPTY_CELLS_SHOW; +} + +bool +nsTableCellFrame::ShouldPaintBackground(nsDisplayListBuilder* aBuilder) +{ + return ShouldPaintBordersAndBackgrounds() && IsVisibleInSelection(aBuilder); +} + void nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { DO_GLOBAL_REFLOW_COUNT_DSP("nsTableCellFrame"); - nsTableFrame* tableFrame = GetTableFrame(); - int32_t emptyCellStyle = GetContentEmpty() && !tableFrame->IsBorderCollapse() ? - StyleTableBorder()->mEmptyCells - : NS_STYLE_TABLE_EMPTY_CELLS_SHOW; - // take account of 'empty-cells' - if (StyleVisibility()->IsVisible() && - (NS_STYLE_TABLE_EMPTY_CELLS_HIDE != emptyCellStyle)) { + if (ShouldPaintBordersAndBackgrounds()) { // display outset box-shadows if we need to. bool hasBoxShadow = !!StyleEffects()->mBoxShadow; if (hasBoxShadow) { @@ -487,7 +508,7 @@ nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, } // display borders if we need to - ProcessBorders(tableFrame, aBuilder, aLists); + ProcessBorders(GetTableFrame(), aBuilder, aLists); // and display the selection border if we need to if (IsSelected()) { |