LibWeb: Table box width should be relative to wrapper containing block

This commit is contained in:
Aliaksandr Kalenik 2023-01-14 15:05:08 +01:00 committed by Andreas Kling
commit 80578ead45
Notes: sideshowbarker 2024-07-17 10:54:57 +09:00
2 changed files with 8 additions and 1 deletions

View file

@ -210,7 +210,9 @@ void TableFormattingContext::compute_table_width()
auto& computed_values = table_box().computed_values();
CSSPixels width_of_table_containing_block = m_state.get(*table_box().containing_block()).content_width();
// Percentages on 'width' and 'height' on the table are relative to the table wrapper box's containing block,
// not the table wrapper box itself.
CSSPixels width_of_table_containing_block = m_state.get(*table_wrapper().containing_block()).content_width();
// The row/column-grid width minimum (GRIDMIN) width is the sum of the min-content width
// of all the columns plus cell spacing or borders.

View file

@ -8,6 +8,7 @@
#include <AK/Forward.h>
#include <LibWeb/Layout/FormattingContext.h>
#include <LibWeb/Layout/TableWrapper.h>
namespace Web::Layout {
@ -20,6 +21,10 @@ public:
virtual CSSPixels automatic_content_height() const override;
TableBox const& table_box() const { return static_cast<TableBox const&>(context_box()); }
TableWrapper const& table_wrapper() const
{
return verify_cast<TableWrapper>(*table_box().containing_block());
}
private:
void calculate_row_column_grid(Box const&);