mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-06 17:48:37 +00:00
LibWeb/CSS: Parse the font-language-override descriptor
This commit is contained in:
parent
1d8867d9ae
commit
20af2eb2b0
Notes:
github-actions[bot]
2024-09-28 12:43:20 +00:00
Author: https://github.com/AtkinsSJ
Commit: 20af2eb2b0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1554
5 changed files with 25 additions and 3 deletions
|
@ -5507,6 +5507,7 @@ JS::GCPtr<CSSFontFaceRule> Parser::parse_font_face_rule(TokenStream<ComponentVal
|
|||
Optional<Percentage> descent_override;
|
||||
Optional<Percentage> line_gap_override;
|
||||
FontDisplay font_display = FontDisplay::Auto;
|
||||
Optional<FlyString> language_override;
|
||||
|
||||
// "normal" is returned as nullptr
|
||||
auto parse_as_percentage_or_normal = [&](Vector<ComponentValue> const& values) -> ErrorOr<Optional<Percentage>> {
|
||||
|
@ -5626,6 +5627,18 @@ JS::GCPtr<CSSFontFaceRule> Parser::parse_font_face_rule(TokenStream<ComponentVal
|
|||
font_family = String::join(' ', font_family_parts).release_value_but_fixme_should_propagate_errors();
|
||||
continue;
|
||||
}
|
||||
if (declaration.name().equals_ignoring_ascii_case("font-language-override"sv)) {
|
||||
TokenStream token_stream { declaration.values() };
|
||||
if (auto maybe_value = parse_css_value(CSS::PropertyID::FontLanguageOverride, token_stream); !maybe_value.is_error()) {
|
||||
auto& value = maybe_value.value();
|
||||
if (value->is_string()) {
|
||||
language_override = value->as_string().string_value();
|
||||
} else {
|
||||
language_override.clear();
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (declaration.name().equals_ignoring_ascii_case("font-named-instance"sv)) {
|
||||
// auto | <string>
|
||||
TokenStream token_stream { declaration.values() };
|
||||
|
@ -5707,7 +5720,7 @@ JS::GCPtr<CSSFontFaceRule> Parser::parse_font_face_rule(TokenStream<ComponentVal
|
|||
unicode_range.empend(0x0u, 0x10FFFFu);
|
||||
}
|
||||
|
||||
return CSSFontFaceRule::create(m_context.realm(), ParsedFontFace { font_family.release_value(), move(weight), move(slope), move(width), move(src), move(unicode_range), move(ascent_override), move(descent_override), move(line_gap_override), font_display, move(font_named_instance) });
|
||||
return CSSFontFaceRule::create(m_context.realm(), ParsedFontFace { font_family.release_value(), move(weight), move(slope), move(width), move(src), move(unicode_range), move(ascent_override), move(descent_override), move(line_gap_override), font_display, move(font_named_instance), move(language_override) });
|
||||
}
|
||||
|
||||
Vector<ParsedFontFace::Source> Parser::parse_as_font_face_src()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue