1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:47:44 +00:00

LibWeb: Consider percent and fixed widths in table column distribution

Change column distribution to take in account is_length() and
is_percentage() width values instead of treating all cells like
they have auto width by implementing it in the way described
in CSS Tables 3 spec:
https://www.w3.org/TR/css-tables-3/#width-distribution-algorithm

distribute_width_to_column() is structured to follow schema:
w3.org/TR/css-tables-3/images/CSS-Tables-Column-Width-Assignment.svg
This commit is contained in:
Aliaksandr Kalenik 2023-01-05 18:56:34 +03:00 committed by Andreas Kling
parent 21d89a2153
commit b2a04ff48a
2 changed files with 110 additions and 21 deletions

View file

@ -22,19 +22,27 @@ public:
private:
void calculate_row_column_grid(Box const&);
void compute_table_measures();
void compute_table_width(CSSPixels&);
void distribute_width_to_columns(CSSPixels extra_width);
void compute_table_width();
void distribute_width_to_columns();
void determine_intrisic_size_of_table_container(AvailableSpace const& available_space);
CSSPixels m_automatic_content_height { 0 };
Optional<AvailableSpace> m_available_space;
enum class ColumnType {
Percent,
Pixel,
Auto
};
struct Column {
ColumnType type { ColumnType::Auto };
CSSPixels left_offset { 0 };
CSSPixels min_width { 0 };
CSSPixels max_width { 0 };
CSSPixels used_width { 0 };
float percentage_width { 0 };
};
struct Row {