mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibWeb: Serialize CanvasTextDrawingStyles::font correctly
Previously we simply serialized a concatenation of the longhand properties, now we use the correct `font` serialization logic implemented within `ShorthandStyleValue::serialize`
This commit is contained in:
Notes:
github-actions[bot]
2026-04-08 13:34:10 +00:00
Author: https://github.com/Calme1709 Commit: https://github.com/LadybirdBrowser/ladybird/commit/3342fc897f6 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8787 Reviewed-by: https://github.com/AtkinsSJ ✅
@@ -34,16 +34,7 @@ ByteString CanvasTextDrawingStyles<IncludingClass, CanvasType>::font() const
|
||||
}
|
||||
|
||||
// On getting, the font attribute must return the serialized form of the current font of the context (with no 'line-height' component).
|
||||
auto const& font_style_value = my_drawing_state().font_style_value->as_shorthand();
|
||||
auto font_style = font_style_value.longhand(CSS::PropertyID::FontStyle);
|
||||
auto font_weight = font_style_value.longhand(CSS::PropertyID::FontWeight);
|
||||
auto font_size = font_style_value.longhand(CSS::PropertyID::FontSize);
|
||||
auto font_family = font_style_value.longhand(CSS::PropertyID::FontFamily);
|
||||
return ByteString::formatted("{} {} {} {}",
|
||||
font_style->to_string(CSS::SerializationMode::Normal),
|
||||
font_weight->to_string(CSS::SerializationMode::Normal),
|
||||
font_size->to_string(CSS::SerializationMode::Normal),
|
||||
font_family->to_string(CSS::SerializationMode::Normal));
|
||||
return my_drawing_state().font_style_value->to_string(CSS::SerializationMode::ResolvedValue).to_byte_string();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/canvas.html#font-style-source-object
|
||||
|
||||
Reference in New Issue
Block a user