mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 05:25:32 +03:00
LibWeb: Consider row computed height in total row min height of table
Fixes the issue that currently we do not consider table rows height while calculating min row height even if it is definite value.
This commit is contained in:
parent
d06057f88b
commit
9b4cd0dab7
Notes:
sideshowbarker
2024-07-16 23:03:06 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/9b4cd0dab7 Pull-request: https://github.com/SerenityOS/serenity/pull/18546
6
Tests/LibWeb/Layout/expected/table/row-px-height.txt
Normal file
6
Tests/LibWeb/Layout/expected/table/row-px-height.txt
Normal file
@ -0,0 +1,6 @@
|
||||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x116 children: not-inline
|
||||
TableWrapper <(anonymous)> at (8,8) content-size 102x100 children: not-inline
|
||||
TableBox <body> at (8,8) content-size 102x100 children: not-inline
|
||||
TableRowBox <div.row> at (8,8) content-size 102x100 children: not-inline
|
||||
TableCellBox <div.cell> at (9,9) content-size 100x0 children: not-inline
|
17
Tests/LibWeb/Layout/input/table/row-px-height.html
Normal file
17
Tests/LibWeb/Layout/input/table/row-px-height.html
Normal file
@ -0,0 +1,17 @@
|
||||
<style>
|
||||
body {
|
||||
display: table;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: table-row;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
.cell {
|
||||
display: table-cell;
|
||||
border: 1px solid black;
|
||||
width: 100px;
|
||||
}
|
||||
</style>
|
||||
<div class="row"><div class="cell"></div></div>
|
@ -425,6 +425,16 @@ void TableFormattingContext::calculate_row_heights(LayoutMode layout_mode)
|
||||
row.used_height = max(row.used_height, cell_state.border_box_height());
|
||||
row.baseline = max(row.baseline, cell.baseline);
|
||||
}
|
||||
|
||||
for (auto& row : m_rows) {
|
||||
auto row_computed_height = row.box->computed_values().height();
|
||||
if (row_computed_height.is_length()) {
|
||||
auto height_of_containing_block = m_state.get(*row.box->containing_block()).content_height();
|
||||
auto height_of_containing_block_as_length = CSS::Length::make_px(height_of_containing_block);
|
||||
auto row_used_height = row_computed_height.resolved(row.box, height_of_containing_block_as_length).to_px(row.box);
|
||||
row.used_height = max(row.used_height, row_used_height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TableFormattingContext::position_row_boxes(CSSPixels& total_content_height)
|
||||
|
Loading…
Reference in New Issue
Block a user