[webkit-changes] [WebKit/WebKit] a9ba14: 'textLength' support for 'tspan' elements is incom...

Nikolas Zimmermann noreply at github.com
Tue May 30 01:32:48 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a9ba148c1a1793210f451e03e94ee71a359c94b0
      https://github.com/WebKit/WebKit/commit/a9ba148c1a1793210f451e03e94ee71a359c94b0
  Author: Nikolas Zimmermann <nzimmermann at igalia.com>
  Date:   2023-05-30 (Tue, 30 May 2023)

  Changed paths:
    A LayoutTests/svg/text/textLength-tspan-1-expected.html
    A LayoutTests/svg/text/textLength-tspan-1.html
    A LayoutTests/svg/text/textLength-tspan-2-expected.html
    A LayoutTests/svg/text/textLength-tspan-2.html
    M Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp
    M Source/WebCore/rendering/svg/SVGTextLayoutEngine.h

  Log Message:
  -----------
  'textLength' support for 'tspan' elements is incomplete
https://bugs.webkit.org/show_bug.cgi?id=257160

Reviewed by Rob Buis.

WebKit issue #171805 contained an imported fix from Chromium
to properly compute the inter-character spacing (off-by-one).

Continue the work to make textLength fully functional on <tspan>
elements, in a few edge cases related to whitespace/text chunk handling.

Prior to this patch, non-collapsed whitespace remnants between
flow boxes ended up contributing to the size of a text chunk -- this
goes unnoticed as long as textLength support isn't used. If textLength
is used on <tspan> elements, the extra characters, lead to wrong
inter-character space computation (as the number of characters is
larger than expected).

Add new reftests to cover the new logic - see LayoutTests/svg/text/textLength-tspan-{1|2}.html.

* LayoutTests/svg/text/textLength-tspan-1-expected.html: Added.
* LayoutTests/svg/text/textLength-tspan-1.html: Added.
* LayoutTests/svg/text/textLength-tspan-2-expected.html: Added.
* LayoutTests/svg/text/textLength-tspan-2.html: Added.
* Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp:
(WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath):
* Source/WebCore/rendering/svg/SVGTextLayoutEngine.h:

Canonical link: https://commits.webkit.org/264666@main




More information about the webkit-changes mailing list