diff --git a/Userland/Libraries/LibWeb/CSS/ComputedValues.h b/Userland/Libraries/LibWeb/CSS/ComputedValues.h index 98fcc68789..e0257373ec 100644 --- a/Userland/Libraries/LibWeb/CSS/ComputedValues.h +++ b/Userland/Libraries/LibWeb/CSS/ComputedValues.h @@ -170,6 +170,13 @@ public: static CSS::TableLayout table_layout() { return CSS::TableLayout::Auto; } static QuotesData quotes() { return QuotesData { .type = QuotesData::Type::Auto }; } static CSS::TransformBox transform_box() { return CSS::TransformBox::ViewBox; } + + // https://www.w3.org/TR/SVG/geometry.html + static LengthPercentage cx() { return CSS::Length::make_px(0); } + static LengthPercentage cy() { return CSS::Length::make_px(0); } + static LengthPercentage r() { return CSS::Length::make_px(0); } + static LengthPercentage rx() { return CSS::Length::make_auto(); } + static LengthPercentage ry() { return CSS::Length::make_auto(); } static LengthPercentage x() { return CSS::Length::make_px(0); } static LengthPercentage y() { return CSS::Length::make_px(0); } @@ -407,6 +414,12 @@ public: CSS::TextAnchor text_anchor() const { return m_inherited.text_anchor; } Optional const& mask() const { return m_noninherited.mask; } CSS::MaskType mask_type() const { return m_noninherited.mask_type; } + + LengthPercentage const& cx() const { return m_noninherited.cx; } + LengthPercentage const& cy() const { return m_noninherited.cy; } + LengthPercentage const& r() const { return m_noninherited.r; } + LengthPercentage const& rx() const { return m_noninherited.ry; } + LengthPercentage const& ry() const { return m_noninherited.ry; } LengthPercentage const& x() const { return m_noninherited.x; } LengthPercentage const& y() const { return m_noninherited.y; } @@ -566,6 +579,12 @@ protected: Optional mask; CSS::MaskType mask_type { InitialValues::mask_type() }; + + LengthPercentage cx { InitialValues::cx() }; + LengthPercentage cy { InitialValues::cy() }; + LengthPercentage r { InitialValues::r() }; + LengthPercentage rx { InitialValues::rx() }; + LengthPercentage ry { InitialValues::ry() }; LengthPercentage x { InitialValues::x() }; LengthPercentage y { InitialValues::x() }; @@ -694,6 +713,12 @@ public: void set_outline_width(CSS::Length value) { m_noninherited.outline_width = value; } void set_mask(MaskReference value) { m_noninherited.mask = value; } void set_mask_type(CSS::MaskType value) { m_noninherited.mask_type = value; } + + void set_cx(LengthPercentage cx) { m_noninherited.cx = cx; } + void set_cy(LengthPercentage cy) { m_noninherited.cy = cy; } + void set_r(LengthPercentage r) { m_noninherited.r = r; } + void set_rx(LengthPercentage rx) { m_noninherited.rx = rx; } + void set_ry(LengthPercentage ry) { m_noninherited.ry = ry; } void set_x(LengthPercentage x) { m_noninherited.x = x; } void set_y(LengthPercentage y) { m_noninherited.y = y; } diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp index a78adcd937..de2e9a27d7 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.cpp +++ b/Userland/Libraries/LibWeb/Layout/Node.cpp @@ -753,10 +753,21 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style) computed_values.set_grid_template_areas(computed_style.grid_template_areas()); computed_values.set_grid_auto_flow(computed_style.grid_auto_flow()); + if (auto cx_value = computed_style.length_percentage(CSS::PropertyID::Cx); cx_value.has_value()) + computed_values.set_cx(*cx_value); + if (auto cy_value = computed_style.length_percentage(CSS::PropertyID::Cy); cy_value.has_value()) + computed_values.set_cy(*cy_value); + if (auto r_value = computed_style.length_percentage(CSS::PropertyID::R); r_value.has_value()) + computed_values.set_r(*r_value); + if (auto rx_value = computed_style.length_percentage(CSS::PropertyID::Rx); rx_value.has_value()) + computed_values.set_rx(*rx_value); + if (auto ry_value = computed_style.length_percentage(CSS::PropertyID::Ry); ry_value.has_value()) + computed_values.set_ry(*ry_value); if (auto x_value = computed_style.length_percentage(CSS::PropertyID::X); x_value.has_value()) computed_values.set_x(*x_value); if (auto y_value = computed_style.length_percentage(CSS::PropertyID::Y); y_value.has_value()) computed_values.set_y(*y_value); + auto fill = computed_style.property(CSS::PropertyID::Fill); if (fill->has_color()) computed_values.set_fill(fill->to_color(*this));