diff --git a/Libraries/LibWeb/SVG/SVGElement.cpp b/Libraries/LibWeb/SVG/SVGElement.cpp index 1413f9ec110..7198358254d 100644 --- a/Libraries/LibWeb/SVG/SVGElement.cpp +++ b/Libraries/LibWeb/SVG/SVGElement.cpp @@ -34,12 +34,16 @@ void SVGElement::initialize(JS::Realm& realm) } struct NamedPropertyID { - NamedPropertyID(CSS::PropertyID property_id, Vector supported_elements = {}) + NamedPropertyID(CSS::PropertyID property_id, FlyString name, Vector 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 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 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 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 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), diff --git a/Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-irrelevant.txt b/Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-irrelevant.txt index addf2f101cb..11d1517fc05 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-irrelevant.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-irrelevant.txt @@ -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 diff --git a/Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-relevant.txt b/Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-relevant.txt index 683eea049a1..8752fd689fc 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-relevant.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-relevant.txt @@ -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 diff --git a/Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-unknown.txt b/Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-unknown.txt index b5a6fa599e6..5e671774306 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-unknown.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/svg/styling/presentation-attributes-unknown.txt @@ -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