diff --git a/Libraries/LibWeb/HTML/HTMLFontElement.cpp b/Libraries/LibWeb/HTML/HTMLFontElement.cpp index 78b865ddca7..b70399a8eb2 100644 --- a/Libraries/LibWeb/HTML/HTMLFontElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLFontElement.cpp @@ -125,12 +125,12 @@ bool HTMLFontElement::is_presentational_hint(FlyString const& name) const void HTMLFontElement::apply_presentational_hints(GC::Ref cascaded_properties) const { for_each_attribute([&](auto& name, auto& value) { - if (name.equals_ignoring_ascii_case("color"sv)) { + if (name == AttributeNames::color) { // https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3:rules-for-parsing-a-legacy-colour-value auto color = parse_legacy_color_value(value); if (color.has_value()) cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::Color, CSS::CSSColorValue::create_from_color(color.value(), CSS::ColorSyntax::Legacy)); - } else if (name.equals_ignoring_ascii_case("size"sv)) { + } else if (name == AttributeNames::size) { // When a font element has a size attribute, the user agent is expected to use the following steps, known as the rules for parsing a legacy font size, to treat the attribute as a presentational hint setting the element's 'font-size' property: auto font_size_or_empty = parse_legacy_font_size(value); if (font_size_or_empty.has_value()) { @@ -138,6 +138,10 @@ void HTMLFontElement::apply_presentational_hints(GC::Refset_property_from_presentational_hint(CSS::PropertyID::FontSize, parsed_value.release_nonnull()); } + } else if (name == AttributeNames::face) { + // When a font element has a face attribute, the user agent is expected to treat the attribute as a presentational hint setting the element's 'font-family' property to the attribute's value. + if (auto parsed_value = parse_css_value(CSS::Parser::ParsingParams { document() }, value, CSS::PropertyID::FontFamily)) + cascaded_properties->set_property_from_presentational_hint(CSS::PropertyID::FontFamily, parsed_value.release_nonnull()); } }); } diff --git a/Tests/LibWeb/Ref/expected/HTML/HTMLFontElement-face-attribute-ref.html b/Tests/LibWeb/Ref/expected/HTML/HTMLFontElement-face-attribute-ref.html new file mode 100644 index 00000000000..f73eeeeb674 --- /dev/null +++ b/Tests/LibWeb/Ref/expected/HTML/HTMLFontElement-face-attribute-ref.html @@ -0,0 +1,12 @@ + + + + + + + Well hello friends! + diff --git a/Tests/LibWeb/Ref/input/HTML/HTMLFontElement-face-attribute.html b/Tests/LibWeb/Ref/input/HTML/HTMLFontElement-face-attribute.html new file mode 100644 index 00000000000..d9404634ca7 --- /dev/null +++ b/Tests/LibWeb/Ref/input/HTML/HTMLFontElement-face-attribute.html @@ -0,0 +1,7 @@ + + + + + + Well hello friends! + diff --git a/Tests/LibWeb/Text/expected/Editing/execCommand-fontName.txt b/Tests/LibWeb/Text/expected/Editing/execCommand-fontName.txt index 31ccbcc8d67..021f0ece6fc 100644 --- a/Tests/LibWeb/Text/expected/Editing/execCommand-fontName.txt +++ b/Tests/LibWeb/Text/expected/Editing/execCommand-fontName.txt @@ -1,2 +1,2 @@ -foobar -foobar +foobar +foobar