mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 03:57:15 +02:00
LibWeb: Implement dominant-baseline for SVG text
This property determines the default baseline used to align content within the given box.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
90a211bf47
commit
f05bc7c0cd
Notes:
github-actions[bot]
2026-02-26 08:24:27 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/f05bc7c0cd3 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8173 Reviewed-by: https://github.com/gmta ✅
@@ -971,6 +971,12 @@ TextAnchor ComputedProperties::text_anchor() const
|
||||
return keyword_to_text_anchor(value.to_keyword()).release_value();
|
||||
}
|
||||
|
||||
Optional<BaselineMetric> ComputedProperties::dominant_baseline() const
|
||||
{
|
||||
auto const& value = property(PropertyID::DominantBaseline);
|
||||
return keyword_to_baseline_metric(value.to_keyword());
|
||||
}
|
||||
|
||||
TextAlign ComputedProperties::text_align() const
|
||||
{
|
||||
auto const& value = property(PropertyID::TextAlign);
|
||||
|
||||
@@ -95,6 +95,7 @@ public:
|
||||
ColorInterpolation color_interpolation() const;
|
||||
PreferredColorScheme color_scheme(PreferredColorScheme, Optional<Vector<String> const&> document_supported_schemes) const;
|
||||
TextAnchor text_anchor() const;
|
||||
Optional<BaselineMetric> dominant_baseline() const;
|
||||
TextAlign text_align() const;
|
||||
TextJustify text_justify() const;
|
||||
TextOverflow text_overflow() const;
|
||||
|
||||
@@ -260,6 +260,7 @@ public:
|
||||
static TransformBox transform_box() { return TransformBox::ViewBox; }
|
||||
static TransformStyle transform_style() { return TransformStyle::Flat; }
|
||||
static Direction direction() { return Direction::Ltr; }
|
||||
static Optional<BaselineMetric> dominant_baseline() { return {}; }
|
||||
static UnicodeBidi unicode_bidi() { return UnicodeBidi::Normal; }
|
||||
static WritingMode writing_mode() { return WritingMode::HorizontalTb; }
|
||||
static UserSelect user_select() { return UserSelect::Auto; }
|
||||
@@ -594,6 +595,7 @@ public:
|
||||
ObjectFit object_fit() const { return m_noninherited.object_fit; }
|
||||
Position object_position() const { return m_noninherited.object_position; }
|
||||
Direction direction() const { return m_inherited.direction; }
|
||||
Optional<BaselineMetric> dominant_baseline() const { return m_inherited.dominant_baseline; }
|
||||
UnicodeBidi unicode_bidi() const { return m_noninherited.unicode_bidi; }
|
||||
WritingMode writing_mode() const { return m_inherited.writing_mode; }
|
||||
UserSelect user_select() const { return m_noninherited.user_select; }
|
||||
@@ -749,6 +751,7 @@ protected:
|
||||
ListStyleType list_style_type { InitialValues::list_style_type() };
|
||||
QuotesData quotes { InitialValues::quotes() };
|
||||
Direction direction { InitialValues::direction() };
|
||||
Optional<BaselineMetric> dominant_baseline { InitialValues::dominant_baseline() };
|
||||
WritingMode writing_mode { InitialValues::writing_mode() };
|
||||
FillRule fill_rule { InitialValues::fill_rule() };
|
||||
StrokeLinecap stroke_linecap { InitialValues::stroke_linecap() };
|
||||
@@ -1078,6 +1081,7 @@ public:
|
||||
void set_object_fit(ObjectFit value) { m_noninherited.object_fit = value; }
|
||||
void set_object_position(Position value) { m_noninherited.object_position = move(value); }
|
||||
void set_direction(Direction value) { m_inherited.direction = value; }
|
||||
void set_dominant_baseline(Optional<BaselineMetric> value) { m_inherited.dominant_baseline = value; }
|
||||
void set_unicode_bidi(UnicodeBidi value) { m_noninherited.unicode_bidi = value; }
|
||||
void set_writing_mode(WritingMode value) { m_inherited.writing_mode = value; }
|
||||
void set_user_select(UserSelect value) { m_noninherited.user_select = value; }
|
||||
|
||||
@@ -127,6 +127,16 @@
|
||||
"padding-box",
|
||||
"text"
|
||||
],
|
||||
"baseline-metric": [
|
||||
"text-bottom",
|
||||
"alphabetic",
|
||||
"ideographic",
|
||||
"middle",
|
||||
"central",
|
||||
"mathematical",
|
||||
"hanging",
|
||||
"text-top"
|
||||
],
|
||||
"border-collapse": [
|
||||
"separate",
|
||||
"collapse"
|
||||
|
||||
@@ -130,6 +130,7 @@
|
||||
"captiontext",
|
||||
"cell",
|
||||
"center",
|
||||
"central",
|
||||
"checkbox",
|
||||
"circle",
|
||||
"clip",
|
||||
@@ -269,6 +270,7 @@
|
||||
"inactivecaption",
|
||||
"inactivecaptiontext",
|
||||
"increasing",
|
||||
"ideographic",
|
||||
"incremental",
|
||||
"infinite",
|
||||
"infinity",
|
||||
@@ -348,6 +350,7 @@
|
||||
"match-source",
|
||||
"math",
|
||||
"math-auto",
|
||||
"mathematical",
|
||||
"max-content",
|
||||
"medium",
|
||||
"menu",
|
||||
|
||||
@@ -1820,6 +1820,18 @@
|
||||
"display-legacy"
|
||||
]
|
||||
},
|
||||
"dominant-baseline": {
|
||||
"animation-type": "discrete",
|
||||
"inherited": true,
|
||||
"initial": "auto",
|
||||
"requires-computation": "never",
|
||||
"valid-types": [
|
||||
"baseline-metric"
|
||||
],
|
||||
"valid-identifiers": [
|
||||
"auto"
|
||||
]
|
||||
},
|
||||
"empty-cells": {
|
||||
"animation-type": "discrete",
|
||||
"inherited": true,
|
||||
|
||||
Reference in New Issue
Block a user