summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
diff options
context:
space:
mode:
authorAliaksandr Kalenik <kalenik.aliaksandr@gmail.com>2023-01-05 18:56:34 +0300
committerAndreas Kling <kling@serenityos.org>2023-01-06 12:01:46 +0100
commitb2a04ff48a95f795647aacefe6d41230397f458f (patch)
tree94450747146b77e03cd42c09ad9c741d00e70523 /Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
parent21d89a2153edf49f9debfa2503b8c39553370764 (diff)
downloadserenity-b2a04ff48a95f795647aacefe6d41230397f458f.zip
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
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout/TableFormattingContext.h')
-rw-r--r--Userland/Libraries/LibWeb/Layout/TableFormattingContext.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
index 2d4d25f34f..8f63e677cd 100644
--- a/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
+++ b/Userland/Libraries/LibWeb/Layout/TableFormattingContext.h
@@ -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 {