-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Serialize canvas font families as needed
https://bugs.webkit.org/show_bug.cgi?id=265993 rdar://problem/119312574 Reviewed by Dean Jackson. In a canvas rendering context, the `font` attribute contains a list of font families, which should only contain valid CSS custom-ident's and strings (in quotes, with escaped characters as appropriate). The original code used to only serialize family names with spaces in them, which could have missed some cases, such as the one in the WPT test 2d.text.drawing.style.absolute.spacing.html: `QuotedFont\",` and others. This patch uses the CSS markup function serializeFontFamily to serialize the canvas rendering context's `font` family names when needed. * LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/text/2d.text.font.parse.family-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.font.parse.family-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.font.parse.family.worker-expected.txt: * Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::State::fontString const): Canonical link: https://commits.webkit.org/271804@main
- Loading branch information
Showing
4 changed files
with
5 additions
and
5 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...ed/w3c/web-platform-tests/html/canvas/element/text/2d.text.font.parse.family-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
2d.text.font.parse.family | ||
Actual output: | ||
|
||
FAIL Canvas test: 2d.text.font.parse.family assert_equals: ctx.font === '20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, "QuotedFont\\\\\\","' (got 20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, QuotedFont\",[string], expected 20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, "QuotedFont\\\","[string]) expected "20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, \"QuotedFont\\\\\\\",\"" but got "20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, QuotedFont\\\"," | ||
PASS Canvas test: 2d.text.font.parse.family | ||
|
2 changes: 1 addition & 1 deletion
2
.../w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.font.parse.family-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
2d.text.font.parse.family | ||
|
||
|
||
FAIL OffscreenCanvas test: 2d.text.font.parse.family assert_equals: ctx.font === '20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, "QuotedFont\\\\\\","' (got 20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, QuotedFont\",[string], expected 20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, "QuotedFont\\\","[string]) expected "20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, \"QuotedFont\\\\\\\",\"" but got "20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, QuotedFont\\\"," | ||
PASS OffscreenCanvas test: 2d.text.font.parse.family | ||
|
2 changes: 1 addition & 1 deletion
2
...b-platform-tests/html/canvas/offscreen/text/2d.text.font.parse.family.worker-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL 2d assert_equals: ctx.font === '20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, "QuotedFont\\\\\\","' (got 20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, QuotedFont\",[string], expected 20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, "QuotedFont\\\","[string]) expected "20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, \"QuotedFont\\\\\\\",\"" but got "20px cursive, fantasy, monospace, sans-serif, serif, UnquotedFont, QuotedFont\\\"," | ||
PASS 2d | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters