1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:57:45 +00:00

LibWeb: Setup computed values for SVG geometry properties

This commit is contained in:
MacDue 2024-03-03 20:24:11 +00:00 committed by Andreas Kling
parent b9afea40e6
commit 4f78ddd6a2
2 changed files with 36 additions and 0 deletions

View file

@ -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<MaskReference> 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<MaskReference> 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; }