mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-07 21:17:07 +09:00
LibWeb: Use the correct definition of separated-borders mode
We previously checked the cell's computed values for the border-collapse property, but a cell is only in separated-borders mode if the table has border-collapse set to separate. Curiously in some other placed where this mode is checked we already did the correct thing.
This commit is contained in:
parent
50cce72ab9
commit
88da6250f9
Notes:
github-actions[bot]
2025-06-04 14:04:01 +00:00
Author: https://github.com/rubenqwertyuiop
Commit: 88da6250f9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4994
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 39 additions and 3 deletions
|
@ -862,7 +862,7 @@ void TableFormattingContext::compute_table_height()
|
|||
cell_state.padding_left = cell.box->computed_values().padding().left().to_px(cell.box, width_of_containing_block);
|
||||
cell_state.padding_right = cell.box->computed_values().padding().right().to_px(cell.box, width_of_containing_block);
|
||||
|
||||
if (cell.box->computed_values().border_collapse() == CSS::BorderCollapse::Separate) {
|
||||
if (table_box().computed_values().border_collapse() == CSS::BorderCollapse::Separate) {
|
||||
cell_state.border_top = cell.box->computed_values().border_top().width;
|
||||
cell_state.border_bottom = cell.box->computed_values().border_bottom().width;
|
||||
cell_state.border_left = cell.box->computed_values().border_left().width;
|
||||
|
@ -1286,7 +1286,7 @@ void TableFormattingContext::border_conflict_resolution()
|
|||
.column_index = cell.column_index,
|
||||
.row_span = cell.row_span,
|
||||
.column_span = cell.column_span });
|
||||
if (cell.box->computed_values().border_collapse() == CSS::BorderCollapse::Separate) {
|
||||
if (table_box().computed_values().border_collapse() == CSS::BorderCollapse::Separate) {
|
||||
continue;
|
||||
}
|
||||
Painting::PaintableBox::BordersDataWithElementKind override_borders_data;
|
||||
|
|
|
@ -377,7 +377,7 @@ void paint_table_borders(PaintContext& context, PaintableBox const& table_painta
|
|||
}
|
||||
auto cell_coordinates_to_device_rect = snap_cells_to_device_coordinates(cell_coordinates_to_box, row_count, column_count, context);
|
||||
for (auto const& cell_box : cell_boxes) {
|
||||
if (cell_box.computed_values().border_collapse() == CSS::BorderCollapse::Separate) {
|
||||
if (table_paintable.computed_values().border_collapse() == CSS::BorderCollapse::Separate) {
|
||||
paint_separate_cell_borders(cell_box, cell_coordinates_to_device_rect, context);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<link rel="match" href="../expected/table-collapse-ignored-in-cells-ref.html" />
|
||||
<style>
|
||||
.collapse { border-collapse: collapse; }
|
||||
.separate { border-collapse: separate; }
|
||||
.border { border: 5px solid black; }
|
||||
.border-left { border-left: 5px solid blue; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="collapse border">
|
||||
<td class="border-left">aaaaaaa</td>
|
||||
</table>
|
||||
<table class="separate border-left">
|
||||
<td class="border">aaaaaaa</td>
|
||||
</table>
|
||||
</body>
|
18
Tests/LibWeb/Ref/input/table-collapse-ignored-in-cells.html
Normal file
18
Tests/LibWeb/Ref/input/table-collapse-ignored-in-cells.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<head>
|
||||
<link rel="match" href="../expected/table-collapse-ignored-in-cells-ref.html" />
|
||||
<style>
|
||||
.collapse { border-collapse: collapse; }
|
||||
.separate { border-collapse: separate; }
|
||||
.border { border: 5px solid black; }
|
||||
.border-left { border-left: 5px solid blue; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="collapse border">
|
||||
<td class="separate border-left">aaaaaaa</td>
|
||||
</table>
|
||||
<table class="separate border-left">
|
||||
<td class="collapse border">aaaaaaa</td>
|
||||
</table>
|
||||
</body>
|
Loading…
Add table
Add a link
Reference in a new issue