Skip to content

Commit 1c10421

Browse files
tcl3AtkinsSJ
authored andcommitted
LibWeb: Support font-stretch SVG presentation attribute
1 parent 14be510 commit 1c10421

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

Libraries/LibWeb/SVG/SVGElement.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,16 @@ void SVGElement::initialize(JS::Realm& realm)
3434
}
3535

3636
struct NamedPropertyID {
37-
NamedPropertyID(CSS::PropertyID property_id, Vector<FlyString> supported_elements = {})
37+
NamedPropertyID(CSS::PropertyID property_id, FlyString name, Vector<FlyString> supported_elements = {})
3838
: id(property_id)
39-
, name(CSS::string_from_property_id(property_id))
39+
, name(move(name))
4040
, supported_elements(move(supported_elements))
4141
{
4242
}
43+
NamedPropertyID(CSS::PropertyID property_id, Vector<FlyString> supported_elements = {})
44+
: NamedPropertyID(property_id, CSS::string_from_property_id(property_id), move(supported_elements))
45+
{
46+
}
4347

4448
CSS::PropertyID id;
4549
FlyString name;
@@ -72,6 +76,7 @@ static ReadonlySpan<NamedPropertyID> attribute_style_properties()
7276
NamedPropertyID(CSS::PropertyID::FontStyle),
7377
NamedPropertyID(CSS::PropertyID::FontVariant),
7478
NamedPropertyID(CSS::PropertyID::FontWeight),
79+
NamedPropertyID(CSS::PropertyID::FontWidth, "font-stretch"_fly_string),
7580
NamedPropertyID(CSS::PropertyID::Height, { SVG::TagNames::foreignObject, SVG::TagNames::image, SVG::TagNames::rect, SVG::TagNames::svg, SVG::TagNames::symbol, SVG::TagNames::use }),
7681
NamedPropertyID(CSS::PropertyID::ImageRendering),
7782
NamedPropertyID(CSS::PropertyID::LetterSpacing),

Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-irrelevant.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ Harness status: OK
22

33
Found 48 tests
44

5-
47 Pass
6-
1 Fail
5+
48 Pass
76
Pass clip-path presentation attribute supported on an irrelevant element
87
Pass clip-rule presentation attribute supported on an irrelevant element
98
Pass color presentation attribute supported on an irrelevant element
@@ -19,7 +18,7 @@ Pass flood-color presentation attribute supported on an irrelevant element
1918
Pass flood-opacity presentation attribute supported on an irrelevant element
2019
Pass font-family presentation attribute supported on an irrelevant element
2120
Pass font-size presentation attribute supported on an irrelevant element
22-
Fail font-stretch presentation attribute supported on an irrelevant element
21+
Pass font-stretch presentation attribute supported on an irrelevant element
2322
Pass font-style presentation attribute supported on an irrelevant element
2423
Pass font-variant presentation attribute supported on an irrelevant element
2524
Pass font-weight presentation attribute supported on an irrelevant element

Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-relevant.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Harness status: OK
22

33
Found 58 tests
44

5-
56 Pass
6-
2 Fail
5+
57 Pass
6+
1 Fail
77
Pass clip-path presentation attribute supported on a relevant element
88
Pass clip-rule presentation attribute supported on a relevant element
99
Pass color presentation attribute supported on a relevant element
@@ -21,7 +21,7 @@ Pass flood-color presentation attribute supported on a relevant element
2121
Pass flood-opacity presentation attribute supported on a relevant element
2222
Pass font-family presentation attribute supported on a relevant element
2323
Pass font-size presentation attribute supported on a relevant element
24-
Fail font-stretch presentation attribute supported on a relevant element
24+
Pass font-stretch presentation attribute supported on a relevant element
2525
Pass font-style presentation attribute supported on a relevant element
2626
Pass font-variant presentation attribute supported on a relevant element
2727
Pass font-weight presentation attribute supported on a relevant element

Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-unknown.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ Harness status: OK
22

33
Found 48 tests
44

5-
47 Pass
6-
1 Fail
5+
48 Pass
76
Pass clip-path presentation attribute supported on an unknown SVG element
87
Pass clip-rule presentation attribute supported on an unknown SVG element
98
Pass color presentation attribute supported on an unknown SVG element
@@ -19,7 +18,7 @@ Pass flood-color presentation attribute supported on an unknown SVG element
1918
Pass flood-opacity presentation attribute supported on an unknown SVG element
2019
Pass font-family presentation attribute supported on an unknown SVG element
2120
Pass font-size presentation attribute supported on an unknown SVG element
22-
Fail font-stretch presentation attribute supported on an unknown SVG element
21+
Pass font-stretch presentation attribute supported on an unknown SVG element
2322
Pass font-style presentation attribute supported on an unknown SVG element
2423
Pass font-variant presentation attribute supported on an unknown SVG element
2524
Pass font-weight presentation attribute supported on an unknown SVG element

0 commit comments

Comments
 (0)