Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6276679c922a56a7053f32bdbfe4da5525ed325d
      
https://github.com/WebKit/WebKit/commit/6276679c922a56a7053f32bdbfe4da5525ed325d
  Author: Antti Koivisto <[email protected]>
  Date:   2026-10-06 (Tue, 06 Oct 2026)

  Changed paths:
    A LayoutTests/svg/text/text-anchor-multiple-x-chunks-expected.svg
    A LayoutTests/svg/text/text-anchor-multiple-x-chunks.svg
    M Source/WebCore/rendering/svg/SVGTextChunk.cpp
    M Source/WebCore/rendering/svg/SVGTextChunk.h
    M Source/WebCore/rendering/svg/SVGTextChunkBuilder.cpp
    M Source/WebCore/rendering/svg/SVGTextChunkBuilder.h
    M Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp
    M Source/WebCore/rendering/svg/SVGTextLayoutEngine.h

  Log Message:
  -----------
  [IFC][SVG text] Build SVG text chunks from fragment ranges
https://bugs.webkit.org/show_bug.cgi?id=326514
rdar://problem/189305162

Reviewed by Alan Baradlay.

SVG text chunks were built from whole text boxes, with chunk starts recorded 
only at box starts. Legacy line layout
creates a new box for every character that starts a chunk, IFC does not. With 
IFC several chunks merged into one and
text-anchor was applied over the combined length.

Record chunk starts as fragment indexes and build chunks from fragment ranges 
so a chunk can start inside a box.

* LayoutTests/svg/text/text-anchor-multiple-x-chunks-expected.svg: Added.
* LayoutTests/svg/text/text-anchor-multiple-x-chunks.svg: Added.

The reference positions each chunk with its own text element, which works the 
same on both line layout paths.

* Source/WebCore/rendering/svg/SVGTextChunk.cpp:
(WebCore::SVGTextChunk::SVGTextChunk):
(WebCore::SVGTextChunk::appendFragments):
(WebCore::SVGTextChunk::firstFragment const):
(WebCore::SVGTextChunk::totalCharacters const):
(WebCore::SVGTextChunk::totalLength const):
(WebCore::SVGTextChunk::layout const):
(WebCore::SVGTextChunk::processTextLengthSpacingCorrection const):
(WebCore::SVGTextChunk::applySpacingAndGlyphsTransform const):
(WebCore::SVGTextChunk::setLengthAdjustTransform const):
(WebCore::SVGTextChunk::processTextAnchorCorrection const):
(WebCore::SVGTextChunk::buildBoxTransformations const): Deleted.
(WebCore::SVGTextChunk::boxSpacingAndGlyphsTransform const): Deleted.
* Source/WebCore/rendering/svg/SVGTextChunk.h:

lengthAdjust="spacingAndGlyphs" transform is now set on the fragments of the 
chunk instead of per box.

* Source/WebCore/rendering/svg/SVGTextChunkBuilder.cpp:
(WebCore::SVGTextChunkBuilder::buildTextChunks):
(WebCore::SVGTextChunkBuilder::layoutTextChunks):
(WebCore::SVGTextChunkBuilder::applyElementLevelTextLength):
(WebCore::SVGTextChunkBuilder::transformationForTextBox const): Deleted.
* Source/WebCore/rendering/svg/SVGTextChunkBuilder.h:
* Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp:
(WebCore::SVGTextLayoutEngine::finishLayout):
(WebCore::SVGTextLayoutEngine::layoutTextOnLineOrPath):

Record the chunk start when starting the fragment for a chunk starting 
character.
A box that follows a box of the same text renderer no longer starts a new chunk 
after a textLength chunk.
IFC may split a text node into multiple boxes.

(WebCore::SVGTextLayoutEngine::finalizeTransformMatrices): Deleted.
* Source/WebCore/rendering/svg/SVGTextLayoutEngine.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to