mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +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
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
Message received from worker: "{\"w\":10,\"h\":10}"
|
||||
Message received from worker: "normal normal 20px SerenitySans"
|
||||
Message received from worker: "normal normal 20px SerenitySans"
|
||||
Message received from worker: "20px SerenitySans"
|
||||
Message received from worker: "20px SerenitySans"
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
normal normal 20px SerenitySans
|
||||
normal normal 20px SerenitySans
|
||||
20px SerenitySans
|
||||
20px SerenitySans
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
normal normal 20px SerenitySans
|
||||
normal normal 20px SerenitySans
|
||||
normal normal 20px SerenitySans
|
||||
normal normal 20px SerenitySans
|
||||
20px SerenitySans
|
||||
20px SerenitySans
|
||||
20px SerenitySans
|
||||
20px SerenitySans
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{"w":10,"h":10}
|
||||
normal normal 20px SerenitySans
|
||||
normal normal 20px SerenitySans
|
||||
20px SerenitySans
|
||||
20px SerenitySans
|
||||
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail Canvas test: 2d.text.font.parse.basic
|
||||
1 Pass
|
||||
Pass Canvas test: 2d.text.font.parse.basic
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail Canvas test: 2d.text.font.parse.family
|
||||
1 Pass
|
||||
Pass Canvas test: 2d.text.font.parse.family
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail Canvas test: 2d.text.font.parse.invalid
|
||||
1 Pass
|
||||
Pass Canvas test: 2d.text.font.parse.invalid
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail Canvas test: 2d.text.font.parse.tiny
|
||||
1 Pass
|
||||
Pass Canvas test: 2d.text.font.parse.tiny
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail Canvas test: 2d.text.font.weight
|
||||
1 Pass
|
||||
Pass Canvas test: 2d.text.font.weight
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail OffscreenCanvas test: 2d.text.font.parse.basic
|
||||
1 Pass
|
||||
Pass OffscreenCanvas test: 2d.text.font.parse.basic
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail 2d
|
||||
1 Pass
|
||||
Pass 2d
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail OffscreenCanvas test: 2d.text.font.parse.family
|
||||
1 Pass
|
||||
Pass OffscreenCanvas test: 2d.text.font.parse.family
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail 2d
|
||||
1 Pass
|
||||
Pass 2d
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail OffscreenCanvas test: 2d.text.font.parse.invalid
|
||||
1 Pass
|
||||
Pass OffscreenCanvas test: 2d.text.font.parse.invalid
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail 2d
|
||||
1 Pass
|
||||
Pass 2d
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail OffscreenCanvas test: 2d.text.font.parse.tiny
|
||||
1 Pass
|
||||
Pass OffscreenCanvas test: 2d.text.font.parse.tiny
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail 2d
|
||||
1 Pass
|
||||
Pass 2d
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail OffscreenCanvas test: 2d.text.font.weight
|
||||
1 Pass
|
||||
Pass OffscreenCanvas test: 2d.text.font.weight
|
||||
@@ -2,5 +2,5 @@ Harness status: OK
|
||||
|
||||
Found 1 tests
|
||||
|
||||
1 Fail
|
||||
Fail 2d
|
||||
1 Pass
|
||||
Pass 2d
|
||||
Reference in New Issue
Block a user