mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 15:49:11 +00:00
LibWeb/CSS: Parse font-width descriptor and its font-stretch alias
This commit is contained in:
parent
4a67b28600
commit
b1870e7029
Notes:
github-actions[bot]
2024-09-28 12:43:32 +00:00
Author: https://github.com/AtkinsSJ
Commit: b1870e7029
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1554
5 changed files with 24 additions and 6 deletions
|
@ -5457,6 +5457,7 @@ JS::GCPtr<CSSFontFaceRule> Parser::parse_font_face_rule(TokenStream<ComponentVal
|
|||
Vector<Gfx::UnicodeRange> unicode_range;
|
||||
Optional<int> weight;
|
||||
Optional<int> slope;
|
||||
Optional<int> width;
|
||||
Optional<Percentage> ascent_override;
|
||||
Optional<Percentage> descent_override;
|
||||
Optional<Percentage> line_gap_override;
|
||||
|
@ -5615,6 +5616,14 @@ JS::GCPtr<CSSFontFaceRule> Parser::parse_font_face_rule(TokenStream<ComponentVal
|
|||
}
|
||||
continue;
|
||||
}
|
||||
if (declaration.name().equals_ignoring_ascii_case("font-width"sv)
|
||||
|| declaration.name().equals_ignoring_ascii_case("font-stretch"sv)) {
|
||||
TokenStream token_stream { declaration.values() };
|
||||
if (auto value = parse_css_value(CSS::PropertyID::FontWidth, token_stream); !value.is_error()) {
|
||||
width = value.value()->to_font_width();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (declaration.name().equals_ignoring_ascii_case("line-gap-override"sv)) {
|
||||
auto value = parse_as_percentage_or_normal(declaration.values());
|
||||
if (value.is_error()) {
|
||||
|
@ -5653,7 +5662,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(), weight, slope, 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) });
|
||||
}
|
||||
|
||||
Vector<ParsedFontFace::Source> Parser::parse_as_font_face_src()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue