Compare commits

...

2 commits

Author SHA1 Message Date
Tim Ledbetter
1c10421316 LibWeb: Support font-stretch SVG presentation attribute 2025-10-11 08:12:38 +01:00
Tim Ledbetter
14be5106d7 LibWeb: Add missing SVG presentation attributes 2025-10-11 08:12:38 +01:00
4 changed files with 23 additions and 17 deletions

View file

@ -34,12 +34,16 @@ void SVGElement::initialize(JS::Realm& realm)
}
struct NamedPropertyID {
NamedPropertyID(CSS::PropertyID property_id, Vector<FlyString> supported_elements = {})
NamedPropertyID(CSS::PropertyID property_id, FlyString name, Vector<FlyString> supported_elements = {})
: id(property_id)
, name(CSS::string_from_property_id(property_id))
, name(move(name))
, supported_elements(move(supported_elements))
{
}
NamedPropertyID(CSS::PropertyID property_id, Vector<FlyString> supported_elements = {})
: NamedPropertyID(property_id, CSS::string_from_property_id(property_id), move(supported_elements))
{
}
CSS::PropertyID id;
FlyString name;
@ -48,6 +52,7 @@ struct NamedPropertyID {
static ReadonlySpan<NamedPropertyID> attribute_style_properties()
{
// https://svgwg.org/svg2-draft/styling.html#PresentationAttributes
static Array const properties = {
// FIXME: The `fill` attribute and CSS `fill` property are not the same! But our support is limited enough that they are equivalent for now.
NamedPropertyID(CSS::PropertyID::Fill),
@ -69,7 +74,9 @@ static ReadonlySpan<NamedPropertyID> attribute_style_properties()
NamedPropertyID(CSS::PropertyID::FontFamily),
NamedPropertyID(CSS::PropertyID::FontSize),
NamedPropertyID(CSS::PropertyID::FontStyle),
NamedPropertyID(CSS::PropertyID::FontVariant),
NamedPropertyID(CSS::PropertyID::FontWeight),
NamedPropertyID(CSS::PropertyID::FontWidth, "font-stretch"_fly_string),
NamedPropertyID(CSS::PropertyID::Height, { SVG::TagNames::foreignObject, SVG::TagNames::image, SVG::TagNames::rect, SVG::TagNames::svg, SVG::TagNames::symbol, SVG::TagNames::use }),
NamedPropertyID(CSS::PropertyID::ImageRendering),
NamedPropertyID(CSS::PropertyID::LetterSpacing),
@ -94,6 +101,7 @@ static ReadonlySpan<NamedPropertyID> attribute_style_properties()
NamedPropertyID(CSS::PropertyID::StrokeOpacity),
NamedPropertyID(CSS::PropertyID::StrokeWidth),
NamedPropertyID(CSS::PropertyID::TextAnchor),
NamedPropertyID(CSS::PropertyID::TextDecoration),
NamedPropertyID(CSS::PropertyID::TextRendering),
NamedPropertyID(CSS::PropertyID::TextOverflow),
NamedPropertyID(CSS::PropertyID::TransformOrigin),

View file

@ -2,8 +2,7 @@ Harness status: OK
Found 48 tests
45 Pass
3 Fail
48 Pass
Pass clip-path presentation attribute supported on an irrelevant element
Pass clip-rule presentation attribute supported on an irrelevant element
Pass color presentation attribute supported on an irrelevant element
@ -19,9 +18,9 @@ Pass flood-color presentation attribute supported on an irrelevant element
Pass flood-opacity presentation attribute supported on an irrelevant element
Pass font-family presentation attribute supported on an irrelevant element
Pass font-size presentation attribute supported on an irrelevant element
Fail font-stretch presentation attribute supported on an irrelevant element
Pass font-stretch presentation attribute supported on an irrelevant element
Pass font-style presentation attribute supported on an irrelevant element
Fail font-variant presentation attribute supported on an irrelevant element
Pass font-variant presentation attribute supported on an irrelevant element
Pass font-weight presentation attribute supported on an irrelevant element
Pass image-rendering presentation attribute supported on an irrelevant element
Pass letter-spacing presentation attribute supported on an irrelevant element
@ -43,7 +42,7 @@ Pass stroke-miterlimit presentation attribute supported on an irrelevant element
Pass stroke-opacity presentation attribute supported on an irrelevant element
Pass stroke-width presentation attribute supported on an irrelevant element
Pass text-anchor presentation attribute supported on an irrelevant element
Fail text-decoration presentation attribute supported on an irrelevant element
Pass text-decoration presentation attribute supported on an irrelevant element
Pass text-overflow presentation attribute supported on an irrelevant element
Pass text-rendering presentation attribute supported on an irrelevant element
Pass transform-origin presentation attribute supported on an irrelevant element

View file

@ -2,8 +2,8 @@ Harness status: OK
Found 58 tests
54 Pass
4 Fail
57 Pass
1 Fail
Pass clip-path presentation attribute supported on a relevant element
Pass clip-rule presentation attribute supported on a relevant element
Pass color presentation attribute supported on a relevant element
@ -21,9 +21,9 @@ Pass flood-color presentation attribute supported on a relevant element
Pass flood-opacity presentation attribute supported on a relevant element
Pass font-family presentation attribute supported on a relevant element
Pass font-size presentation attribute supported on a relevant element
Fail font-stretch presentation attribute supported on a relevant element
Pass font-stretch presentation attribute supported on a relevant element
Pass font-style presentation attribute supported on a relevant element
Fail font-variant presentation attribute supported on a relevant element
Pass font-variant presentation attribute supported on a relevant element
Pass font-weight presentation attribute supported on a relevant element
Pass height presentation attribute supported on a relevant element
Pass image-rendering presentation attribute supported on a relevant element
@ -49,7 +49,7 @@ Pass stroke-miterlimit presentation attribute supported on a relevant element
Pass stroke-opacity presentation attribute supported on a relevant element
Pass stroke-width presentation attribute supported on a relevant element
Pass text-anchor presentation attribute supported on a relevant element
Fail text-decoration presentation attribute supported on a relevant element
Pass text-decoration presentation attribute supported on a relevant element
Pass text-overflow presentation attribute supported on a relevant element
Pass text-rendering presentation attribute supported on a relevant element
Pass transform-origin presentation attribute supported on a relevant element

View file

@ -2,8 +2,7 @@ Harness status: OK
Found 48 tests
45 Pass
3 Fail
48 Pass
Pass clip-path presentation attribute supported on an unknown SVG element
Pass clip-rule presentation attribute supported on an unknown SVG element
Pass color presentation attribute supported on an unknown SVG element
@ -19,9 +18,9 @@ Pass flood-color presentation attribute supported on an unknown SVG element
Pass flood-opacity presentation attribute supported on an unknown SVG element
Pass font-family presentation attribute supported on an unknown SVG element
Pass font-size presentation attribute supported on an unknown SVG element
Fail font-stretch presentation attribute supported on an unknown SVG element
Pass font-stretch presentation attribute supported on an unknown SVG element
Pass font-style presentation attribute supported on an unknown SVG element
Fail font-variant presentation attribute supported on an unknown SVG element
Pass font-variant presentation attribute supported on an unknown SVG element
Pass font-weight presentation attribute supported on an unknown SVG element
Pass image-rendering presentation attribute supported on an unknown SVG element
Pass letter-spacing presentation attribute supported on an unknown SVG element
@ -43,7 +42,7 @@ Pass stroke-miterlimit presentation attribute supported on an unknown SVG elemen
Pass stroke-opacity presentation attribute supported on an unknown SVG element
Pass stroke-width presentation attribute supported on an unknown SVG element
Pass text-anchor presentation attribute supported on an unknown SVG element
Fail text-decoration presentation attribute supported on an unknown SVG element
Pass text-decoration presentation attribute supported on an unknown SVG element
Pass text-overflow presentation attribute supported on an unknown SVG element
Pass text-rendering presentation attribute supported on an unknown SVG element
Pass transform-origin presentation attribute supported on an unknown SVG element