LibWeb: Add table-layout CSS property

This commit is contained in:
Andi Gallo 2023-08-07 01:32:52 +00:00 committed by Sam Atkins
parent a0ea87ffc6
commit 97512d0c76
Notes: sideshowbarker 2024-07-17 08:37:36 +09:00
7 changed files with 28 additions and 0 deletions

View File

@ -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<Vector<String>> 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; }

View File

@ -294,6 +294,10 @@
"to-zero",
"up"
],
"table-layout": [
"auto",
"fixed"
],
"text-anchor": [
"start",
"middle",

View File

@ -637,6 +637,13 @@
"caption-side"
]
},
"table-layout": {
"inherited": false,
"initial": "auto",
"valid-types": [
"table-layout"
]
},
"clear": {
"inherited": false,
"initial": "none",

View File

@ -776,6 +776,8 @@ ErrorOr<RefPtr<StyleValue const>> 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: {

View File

@ -949,6 +949,12 @@ Optional<CSS::ObjectFit> StyleProperties::object_fit() const
return value_id_to_object_fit(value->to_identifier());
}
Optional<CSS::TableLayout> 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);

View File

@ -112,6 +112,7 @@ public:
Vector<Vector<String>> grid_template_areas() const;
String grid_area() const;
Optional<CSS::ObjectFit> object_fit() const;
Optional<CSS::TableLayout> table_layout() const;
Vector<CSS::Transformation> transformations() const;
CSS::TransformOrigin transform_origin() const;

View File

@ -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();