Bug
1725132 [wpt PR 29986] - Rely on the CSS serializer for CanvasTextDrawingStyles.font, a=testonly
Automatic update from web-platform-tests
Rely on the CSS serializer for CanvasTextDrawingStyles.font
According to the canvas specification [1]:
"On getting, the font attribute must return the serialized form of the
current font of the context (with no 'line-height' component)."
This patch changes the implementations of CanvasRenderingContext2D
OffscreenCanvasRenderingContext2D so that the font-family part is
serialized via the CSS serializer [2] [3] [4]. This reduces code
duplication and makes things more consistent in preparation for
[5]. In particular, this changes the following:
- Font family names are always quoted when necessary (e.g. if they
contain a quote or a comma), while this used to only be done when
they contain an ASCII space U+0020.
- The "-webkit" prefix prepended to some generic font families names
(namely "cursive", "fantasy", "monospace", "sans-serif" and "serif")
is removed ; while this used to be done for all font family names
with a "-webkit" prefix.
- Various character substitutions from [3] are performed, while no
no such substitutions used to happen. One noticeable edge case is
the escaping of double quote and backslash characters.
The new serialization behavior aligns with Firefox. This is a considered
a minor bug fix that "does not affect web API behavior to the point that
developers need to be aware of it" and so is exempt from an I2S [6].
[1] https://html.spec.whatwg.org/multipage/canvas.html#text-styles
[2] https://drafts.csswg.org/cssom/#serialize-a-comma-separated-list
[3] https://drafts.csswg.org/cssom/#serialize-a-string
[4] https://drafts.csswg.org/cssom/#serialize-an-identifier
[5] https://bugs.chromium.org/p/chromium/issues/detail?id=
1065468
[6] https://www.chromium.org/blink/launching-features
Bug:
1065468
Change-Id: I7003705af8010cbb9723ee8d0a6c39e083f9eef7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/
3086444
Reviewed-by: Yi Xu <yiyix@chromium.org>
Reviewed-by: Rune Lillesveen <futhark@chromium.org>
Commit-Queue: Frédéric Wang <fwang@igalia.com>
Cr-Commit-Position: refs/heads/master@{#911930}
--
wpt-commits:
6fc4f27b2befb9e5cb8256fd41617dedd16d691a
wpt-pr: 29986