summaryrefslogtreecommitdiffstats
path: root/layout/tables/nsTableCellFrame.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-11-02 22:39:03 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-11-02 22:42:07 +0100
commit145527207538b6ee1018cb77e6705912c29f8a9f (patch)
treea285c388b5f554a60f42ef0db19c1cee327b8950 /layout/tables/nsTableCellFrame.cpp
parent24027f0df9d23304709a80c22c6bfdbd27a95046 (diff)
downloadUXP-145527207538b6ee1018cb77e6705912c29f8a9f.tar
UXP-145527207538b6ee1018cb77e6705912c29f8a9f.tar.gz
UXP-145527207538b6ee1018cb77e6705912c29f8a9f.tar.lz
UXP-145527207538b6ee1018cb77e6705912c29f8a9f.tar.xz
UXP-145527207538b6ee1018cb77e6705912c29f8a9f.zip
Issue #146 - Part 1: Draw each table's background on their own display
list items. This patch does the following things: 1. Creates nsDisplayTableBorderCollapse that draws all collapse border of tables. 2. Stops the use of nsDisplayTableBorderBackground. 3. Lets column and column group frames generate display items. 4. When traversing the table, also traverses the column and column group frames. 5. For each type of table frame (col group, col, row group, row and cell), draws their own background.
Diffstat (limited to 'layout/tables/nsTableCellFrame.cpp')
-rw-r--r--layout/tables/nsTableCellFrame.cpp103
1 files changed, 42 insertions, 61 deletions
diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp
index dea82ea59..bac8d387f 100644
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -484,70 +484,51 @@ nsTableCellFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists)
{
DO_GLOBAL_REFLOW_COUNT_DSP("nsTableCellFrame");
- if (IsVisibleInSelection(aBuilder)) {
- 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)) {
- // display outset box-shadows if we need to.
- bool hasBoxShadow = !!StyleEffects()->mBoxShadow;
- if (hasBoxShadow) {
- aLists.BorderBackground()->AppendNewToTop(
- new (aBuilder) nsDisplayBoxShadowOuter(aBuilder, this));
- }
-
- // display background if we need to.
- if (aBuilder->IsForEventDelivery() ||
- !StyleBackground()->IsTransparent() || StyleDisplay()->mAppearance) {
- if (!tableFrame->IsBorderCollapse()) {
- nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder,
- this,
- GetRectRelativeToSelf(),
- aLists.BorderBackground());
- } else if (aBuilder->IsAtRootOfPseudoStackingContext() ||
- aBuilder->IsForEventDelivery()) {
- // The cell background was not painted by the nsTablePainter,
- // so we need to do it. We have special background processing here
- // so we need to duplicate some code from nsFrame::DisplayBorderBackgroundOutline
- nsDisplayTableItem* item =
- new (aBuilder) nsDisplayTableCellBackground(aBuilder, this);
- aLists.BorderBackground()->AppendNewToTop(item);
- item->UpdateForFrameBackground(this);
- } else {
- // The nsTablePainter will paint our background. Make sure it
- // knows if we're background-attachment:fixed.
- nsDisplayTableItem* currentItem = aBuilder->GetCurrentTableItem();
- if (currentItem) {
- currentItem->UpdateForFrameBackground(this);
- }
- }
- }
-
- // display inset box-shadows if we need to.
- if (hasBoxShadow) {
- aLists.BorderBackground()->AppendNewToTop(
- new (aBuilder) nsDisplayBoxShadowInner(aBuilder, this));
- }
-
- // display borders if we need to
- ProcessBorders(tableFrame, aBuilder, aLists);
-
- // and display the selection border if we need to
- if (IsSelected()) {
- aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
- nsDisplayGeneric(aBuilder, this, ::PaintTableCellSelection,
- "TableCellSelection",
- nsDisplayItem::TYPE_TABLE_CELL_SELECTION));
- }
+ 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)) {
+ // display outset box-shadows if we need to.
+ bool hasBoxShadow = !!StyleEffects()->mBoxShadow;
+ if (hasBoxShadow) {
+ aLists.BorderBackground()->AppendNewToTop(
+ new (aBuilder) nsDisplayBoxShadowOuter(aBuilder, this));
+ }
+
+ // display background if we need to.
+ if (aBuilder->IsForEventDelivery() ||
+ !StyleBackground()->IsTransparent() ||
+ StyleDisplay()->mAppearance) {
+ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder,
+ this,
+ GetRectRelativeToSelf(),
+ aLists.BorderBackground());
+ }
+
+ // display inset box-shadows if we need to.
+ if (hasBoxShadow) {
+ aLists.BorderBackground()->AppendNewToTop(
+ new (aBuilder) nsDisplayBoxShadowInner(aBuilder, this));
+ }
+
+ // display borders if we need to
+ ProcessBorders(tableFrame, aBuilder, aLists);
+
+ // and display the selection border if we need to
+ if (IsSelected()) {
+ aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
+ nsDisplayGeneric(aBuilder, this, ::PaintTableCellSelection,
+ "TableCellSelection",
+ nsDisplayItem::TYPE_TABLE_CELL_SELECTION));
}
-
- // the 'empty-cells' property has no effect on 'outline'
- DisplayOutline(aBuilder, aLists);
}
+ // 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;