diff --git a/Tests/LibWeb/Ref/reference/scrollable-contains-table-ref.html b/Tests/LibWeb/Ref/reference/scrollable-contains-table-ref.html new file mode 100644 index 00000000000..a2394f7bbc3 --- /dev/null +++ b/Tests/LibWeb/Ref/reference/scrollable-contains-table-ref.html @@ -0,0 +1,82 @@ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Row 2, Cell 1Row 2, Cell 2Row 2, Cell 3Row 2, Cell 4
Row 3, Cell 1Row 3, Cell 2Row 3, Cell 3Row 3, Cell 4
Row 4, Cell 1Row 4, Cell 2Row 4, Cell 3Row 4, Cell 4
Row 5, Cell 1Row 5, Cell 2Row 5, Cell 3Row 5, Cell 4
Row 6, Cell 1Row 6, Cell 2Row 6, Cell 3Row 6, Cell 4
Row 7, Cell 1Row 7, Cell 2Row 7, Cell 3Row 7, Cell 4
Row 8, Cell 1Row 8, Cell 2Row 8, Cell 3Row 8, Cell 4
Row 9, Cell 1Row 9, Cell 2Row 9, Cell 3Row 9, Cell 4
+
+ diff --git a/Tests/LibWeb/Ref/scrollable-contains-table.html b/Tests/LibWeb/Ref/scrollable-contains-table.html new file mode 100644 index 00000000000..f3b1189e652 --- /dev/null +++ b/Tests/LibWeb/Ref/scrollable-contains-table.html @@ -0,0 +1,101 @@ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Header 1Header 2Header 3Header 4
Row 1, Cell 1Row 1, Cell 2Row 1, Cell 3Row 1, Cell 4
Row 2, Cell 1Row 2, Cell 2Row 2, Cell 3Row 2, Cell 4
Row 3, Cell 1Row 3, Cell 2Row 3, Cell 3Row 3, Cell 4
Row 4, Cell 1Row 4, Cell 2Row 4, Cell 3Row 4, Cell 4
Row 5, Cell 1Row 5, Cell 2Row 5, Cell 3Row 5, Cell 4
Row 6, Cell 1Row 6, Cell 2Row 6, Cell 3Row 6, Cell 4
Row 7, Cell 1Row 7, Cell 2Row 7, Cell 3Row 7, Cell 4
Row 8, Cell 1Row 8, Cell 2Row 8, Cell 3Row 8, Cell 4
Row 9, Cell 1Row 9, Cell 2Row 9, Cell 3Row 9, Cell 4
+
+ + diff --git a/Userland/Libraries/LibWeb/Painting/Paintable.h b/Userland/Libraries/LibWeb/Painting/Paintable.h index f9f2c592788..1e8d1dd434d 100644 --- a/Userland/Libraries/LibWeb/Painting/Paintable.h +++ b/Userland/Libraries/LibWeb/Painting/Paintable.h @@ -16,6 +16,7 @@ namespace Web::Painting { enum class PaintPhase { Background, Border, + TableCollapsedBorder, Foreground, Outline, Overlay, diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index a2c6d0b4e52..6dac4bfe347 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -309,10 +310,15 @@ void PaintableBox::paint(PaintContext& context, PaintPhase phase) const paint_box_shadow(context); } - if (phase == PaintPhase::Border) { + auto const is_table_with_collapsed_borders = display().is_table_inside() && computed_values().border_collapse() == CSS::BorderCollapse::Collapse; + if (!display().is_table_cell() && !is_table_with_collapsed_borders && phase == PaintPhase::Border) { paint_border(context); } + if ((display().is_table_inside() || computed_values().border_collapse() == CSS::BorderCollapse::Collapse) && phase == PaintPhase::TableCollapsedBorder) { + paint_table_borders(context, *this); + } + if (phase == PaintPhase::Outline) { auto const& outline_data = this->outline_data(); if (outline_data.has_value()) { @@ -519,7 +525,7 @@ void PaintableBox::reset_scroll_offset(PaintContext& context, PaintPhase) const void PaintableBox::apply_clip_overflow_rect(PaintContext& context, PaintPhase phase) const { - if (!AK::first_is_one_of(phase, PaintPhase::Background, PaintPhase::Border, PaintPhase::Foreground, PaintPhase::Outline)) + if (!AK::first_is_one_of(phase, PaintPhase::Background, PaintPhase::Border, PaintPhase::TableCollapsedBorder, PaintPhase::Foreground, PaintPhase::Outline)) return; if (clip_rect().has_value()) { @@ -542,7 +548,7 @@ void PaintableBox::apply_clip_overflow_rect(PaintContext& context, PaintPhase ph void PaintableBox::clear_clip_overflow_rect(PaintContext& context, PaintPhase phase) const { - if (!AK::first_is_one_of(phase, PaintPhase::Background, PaintPhase::Border, PaintPhase::Foreground, PaintPhase::Outline)) + if (!AK::first_is_one_of(phase, PaintPhase::Background, PaintPhase::Border, PaintPhase::TableCollapsedBorder, PaintPhase::Foreground, PaintPhase::Outline)) return; if (m_clipping_overflow) { diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index 8a1cb27a2a0..6aa591d1553 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #include namespace Web::Painting { @@ -134,13 +133,9 @@ void StackingContext::paint_descendants(PaintContext& context, Paintable const& case StackingContextPaintPhase::BackgroundAndBorders: if (!child_is_inline_or_replaced && !child.is_floating()) { paint_node(child, context, PaintPhase::Background); - bool is_table_with_collapsed_borders = child.display().is_table_inside() && child.computed_values().border_collapse() == CSS::BorderCollapse::Collapse; - if (!child.display().is_table_cell() && !is_table_with_collapsed_borders) - paint_node(child, context, PaintPhase::Border); + paint_node(child, context, PaintPhase::Border); paint_descendants(context, child, phase); - if (child.display().is_table_inside() || child.computed_values().border_collapse() == CSS::BorderCollapse::Collapse) { - paint_table_borders(context, verify_cast(child)); - } + paint_node(child, context, PaintPhase::TableCollapsedBorder); } break; case StackingContextPaintPhase::Floats: @@ -155,8 +150,7 @@ void StackingContext::paint_descendants(PaintContext& context, Paintable const& if (child_is_inline_or_replaced) { paint_node(child, context, PaintPhase::Background); paint_node(child, context, PaintPhase::Border); - if (child.display().is_table_inside() && child.computed_values().border_collapse() == CSS::BorderCollapse::Separate) - paint_table_borders(context, verify_cast(child)); + paint_node(child, context, PaintPhase::TableCollapsedBorder); paint_descendants(context, child, StackingContextPaintPhase::BackgroundAndBorders); } paint_descendants(context, child, phase);