Closed Bug 1725132 Opened 3 years ago Closed 3 years ago

[wpt-sync] Sync PR 29986 - Rely on the CSS serializer for CanvasTextDrawingStyles.font

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
93 Branch
Tracking Status
firefox93 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 29986 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/29986
Details from upstream follow.

b'Fr\xc3\xa9d\xc3\xa9ric Wang <fwang@igalia.com>' wrote:

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/3086444
WPT-Export-Revision: 784783f2a30f7d5912eaaaa33588625e2b964075

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core

CI Results

Ran 0 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 3 tests and 1 subtests

Status Summary

Firefox

OK : 3
PASS: 1
FAIL: 2

Chrome

OK : 3
FAIL: 3

Safari

OK : 3
FAIL: 3

Links

GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

/html/canvas/offscreen/text/2d.text.font.parse.family.html
OffscreenCanvas test: 2d.text.font.parse.family: FAIL (Chrome: FAIL, Safari: FAIL)
/html/canvas/offscreen/text/2d.text.font.parse.family.worker.html
2d: FAIL (Chrome: FAIL, Safari: FAIL)

Pushed by wptsync@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/827a06fd047f
[wpt PR 29986] - Rely on the CSS serializer for CanvasTextDrawingStyles.font, a=testonly
https://hg.mozilla.org/integration/autoland/rev/00872597d074
[wpt PR 29986] - Update wpt metadata, a=testonly
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 93 Branch
You need to log in before you can comment on or make changes to this bug.