mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:37:43 +00:00
LibWeb: Setup computed values for SVG geometry properties
This commit is contained in:
parent
b9afea40e6
commit
4f78ddd6a2
2 changed files with 36 additions and 0 deletions
|
@ -170,6 +170,13 @@ public:
|
||||||
static CSS::TableLayout table_layout() { return CSS::TableLayout::Auto; }
|
static CSS::TableLayout table_layout() { return CSS::TableLayout::Auto; }
|
||||||
static QuotesData quotes() { return QuotesData { .type = QuotesData::Type::Auto }; }
|
static QuotesData quotes() { return QuotesData { .type = QuotesData::Type::Auto }; }
|
||||||
static CSS::TransformBox transform_box() { return CSS::TransformBox::ViewBox; }
|
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 x() { return CSS::Length::make_px(0); }
|
||||||
static LengthPercentage y() { 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; }
|
CSS::TextAnchor text_anchor() const { return m_inherited.text_anchor; }
|
||||||
Optional<MaskReference> const& mask() const { return m_noninherited.mask; }
|
Optional<MaskReference> const& mask() const { return m_noninherited.mask; }
|
||||||
CSS::MaskType mask_type() const { return m_noninherited.mask_type; }
|
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& x() const { return m_noninherited.x; }
|
||||||
LengthPercentage const& y() const { return m_noninherited.y; }
|
LengthPercentage const& y() const { return m_noninherited.y; }
|
||||||
|
|
||||||
|
@ -566,6 +579,12 @@ protected:
|
||||||
|
|
||||||
Optional<MaskReference> mask;
|
Optional<MaskReference> mask;
|
||||||
CSS::MaskType mask_type { InitialValues::mask_type() };
|
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 x { InitialValues::x() };
|
||||||
LengthPercentage y { 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_outline_width(CSS::Length value) { m_noninherited.outline_width = value; }
|
||||||
void set_mask(MaskReference value) { m_noninherited.mask = value; }
|
void set_mask(MaskReference value) { m_noninherited.mask = value; }
|
||||||
void set_mask_type(CSS::MaskType value) { m_noninherited.mask_type = 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_x(LengthPercentage x) { m_noninherited.x = x; }
|
||||||
void set_y(LengthPercentage y) { m_noninherited.y = y; }
|
void set_y(LengthPercentage y) { m_noninherited.y = y; }
|
||||||
|
|
||||||
|
|
|
@ -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_template_areas(computed_style.grid_template_areas());
|
||||||
computed_values.set_grid_auto_flow(computed_style.grid_auto_flow());
|
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())
|
if (auto x_value = computed_style.length_percentage(CSS::PropertyID::X); x_value.has_value())
|
||||||
computed_values.set_x(*x_value);
|
computed_values.set_x(*x_value);
|
||||||
if (auto y_value = computed_style.length_percentage(CSS::PropertyID::Y); y_value.has_value())
|
if (auto y_value = computed_style.length_percentage(CSS::PropertyID::Y); y_value.has_value())
|
||||||
computed_values.set_y(*y_value);
|
computed_values.set_y(*y_value);
|
||||||
|
|
||||||
auto fill = computed_style.property(CSS::PropertyID::Fill);
|
auto fill = computed_style.property(CSS::PropertyID::Fill);
|
||||||
if (fill->has_color())
|
if (fill->has_color())
|
||||||
computed_values.set_fill(fill->to_color(*this));
|
computed_values.set_fill(fill->to_color(*this));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue