[webkit-changes] [WebKit/WebKit] b94074: Serialize canvas font families as needed

Gerald Squelart noreply at github.com
Sat Dec 9 05:40:41 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b94074dc23734836e49b503082cb3ab662e732a5
      https://github.com/WebKit/WebKit/commit/b94074dc23734836e49b503082cb3ab662e732a5
  Author: Gerald Squelart <squelart at apple.com>
  Date:   2023-12-09 (Sat, 09 Dec 2023)

  Changed paths:
    M LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/text/2d.text.font.parse.family-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.font.parse.family-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.font.parse.family.worker-expected.txt
    M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp

  Log Message:
  -----------
  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




More information about the webkit-changes mailing list