diff options
author | Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> | 2023-01-19 21:23:46 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-01-20 18:04:17 +0100 |
commit | addfa4ed586a4ba033b43cb0d7f57a8dd9600751 (patch) | |
tree | b00967ec55d2f64421addeba3eabf584e29dda3c /Userland | |
parent | 57e19a7e56a7684ce78e7660bda9fc1f5d9d16f3 (diff) | |
download | serenity-addfa4ed586a4ba033b43cb0d7f57a8dd9600751.zip |
LibWeb: Include table intrinsic offsets in child boxes position
Table's border and padding should be taken in account while
calculating child boxes x and y offsets.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp index ee375191a3..d0d7ae51e9 100644 --- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.cpp @@ -416,7 +416,10 @@ void TableFormattingContext::calculate_row_heights(LayoutMode layout_mode) void TableFormattingContext::position_row_boxes() { - CSSPixels row_top_offset = 0.0f; + auto const& table_state = m_state.get(table_box()); + + CSSPixels row_top_offset = table_state.border_top + table_state.padding_top; + CSSPixels row_left_offset = table_state.border_left + table_state.padding_left; for (size_t y = 0; y < m_rows.size(); y++) { auto& row = m_rows[y]; auto& row_state = m_state.get_mutable(row.box); @@ -427,16 +430,19 @@ void TableFormattingContext::position_row_boxes() row_state.set_content_height(row.used_height); row_state.set_content_width(row_width); + row_state.set_content_x(row_left_offset); row_state.set_content_y(row_top_offset); row_top_offset += row_state.content_height(); } - CSSPixels row_group_top_offset = 0.0f; + CSSPixels row_group_top_offset = table_state.border_top + table_state.padding_top; + CSSPixels row_group_left_offset = table_state.border_left + table_state.padding_left; table_box().for_each_child_of_type<TableRowGroupBox>([&](auto& row_group_box) { CSSPixels row_group_height = 0.0f; CSSPixels row_group_width = 0.0f; auto& row_group_box_state = m_state.get_mutable(row_group_box); + row_group_box_state.set_content_x(row_group_left_offset); row_group_box_state.set_content_y(row_group_top_offset); row_group_box.template for_each_child_of_type<TableRowBox>([&](auto& row) { |