diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h index 71fa353d1c..d83c1b3f7f 100644 --- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h +++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h @@ -111,6 +111,7 @@ public: static CSS::Length outline_offset() { return CSS::Length::make_px(0); } static CSS::OutlineStyle outline_style() { return CSS::OutlineStyle::None; } static CSS::Length outline_width() { return CSS::Length::make_px(3); } + static CSS::TableLayout table_layout() { return CSS::TableLayout::Auto; } }; enum class BackgroundSize { @@ -333,6 +334,8 @@ public: CSS::OutlineStyle outline_style() const { return m_noninherited.outline_style; } CSS::Length outline_width() const { return m_noninherited.outline_width; } + CSS::TableLayout table_layout() const { return m_noninherited.table_layout; } + ComputedValues clone_inherited_values() const { ComputedValues clone; @@ -447,6 +450,7 @@ protected: CSS::Length outline_offset { InitialValues::outline_offset() }; CSS::OutlineStyle outline_style { InitialValues::outline_style() }; CSS::Length outline_width { InitialValues::outline_width() }; + CSS::TableLayout table_layout { InitialValues::table_layout() }; } m_noninherited; }; @@ -546,6 +550,7 @@ public: void set_border_collapse(CSS::BorderCollapse const& border_collapse) { m_inherited.border_collapse = border_collapse; } void set_grid_template_areas(Vector> const& grid_template_areas) { m_noninherited.grid_template_areas = grid_template_areas; } void set_transition_delay(CSS::Time const& transition_delay) { m_noninherited.transition_delay = transition_delay; } + void set_table_layout(CSS::TableLayout value) { m_noninherited.table_layout = value; } void set_fill(SVGPaint value) { m_inherited.fill = value; } void set_stroke(SVGPaint value) { m_inherited.stroke = value; } diff --git a/Userland/Libraries/LibWeb/CSS/Enums.json b/Userland/Libraries/LibWeb/CSS/Enums.json index 423ade2ff3..c6e5b84a92 100644 --- a/Userland/Libraries/LibWeb/CSS/Enums.json +++ b/Userland/Libraries/LibWeb/CSS/Enums.json @@ -294,6 +294,10 @@ "to-zero", "up" ], + "table-layout": [ + "auto", + "fixed" + ], "text-anchor": [ "start", "middle", diff --git a/Userland/Libraries/LibWeb/CSS/Properties.json b/Userland/Libraries/LibWeb/CSS/Properties.json index d269303d10..5a49a07224 100644 --- a/Userland/Libraries/LibWeb/CSS/Properties.json +++ b/Userland/Libraries/LibWeb/CSS/Properties.json @@ -637,6 +637,13 @@ "caption-side" ] }, + "table-layout": { + "inherited": false, + "initial": "auto", + "valid-types": [ + "table-layout" + ] + }, "clear": { "inherited": false, "initial": "none", diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index 68b60905bd..638c0e333e 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -776,6 +776,8 @@ ErrorOr> ResolvedCSSStyleDeclaration::style_value_for_p return NumberStyleValue::create(layout_node.computed_values().stroke_opacity()); case PropertyID::StrokeWidth: return style_value_for_length_percentage(layout_node.computed_values().stroke_width()); + case PropertyID::TableLayout: + return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().table_layout())); case PropertyID::TextAlign: return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().text_align())); case PropertyID::TextDecorationLine: { diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp index 69e5f6cac0..015cdc7c3f 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -949,6 +949,12 @@ Optional StyleProperties::object_fit() const return value_id_to_object_fit(value->to_identifier()); } +Optional StyleProperties::table_layout() const +{ + auto value = property(CSS::PropertyID::TableLayout); + return value_id_to_table_layout(value->to_identifier()); +} + Color StyleProperties::stop_color() const { auto value = property(CSS::PropertyID::StopColor); diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.h b/Userland/Libraries/LibWeb/CSS/StyleProperties.h index 4f321c28e6..f6f427ff87 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.h +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.h @@ -112,6 +112,7 @@ public: Vector> grid_template_areas() const; String grid_area() const; Optional object_fit() const; + Optional table_layout() const; Vector transformations() const; CSS::TransformOrigin transform_origin() const; diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index 4c7b7380ae..79dd7f5eab 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -765,6 +765,9 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style) if (auto border_collapse = computed_style.border_collapse(); border_collapse.has_value()) computed_values.set_border_collapse(border_collapse.value()); + if (auto table_layout = computed_style.table_layout(); table_layout.has_value()) + computed_values.set_table_layout(table_layout.value()); + auto aspect_ratio = computed_style.property(CSS::PropertyID::AspectRatio); if (aspect_ratio->is_value_list()) { auto& values_list = aspect_ratio->as_value_list().values();