Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 73a32770e3ddaf634cf2598550adaedc7ce99239
      
https://github.com/WebKit/WebKit/commit/73a32770e3ddaf634cf2598550adaedc7ce99239
  Author: Antti Koivisto <[email protected]>
  Date:   2026-10-07 (Wed, 07 Oct 2026)

  Changed paths:
    M Source/WebCore/Scripts/generate-unified-sources.sh
    M Source/WebCore/Sources.txt
    M Source/WebCore/UnifiedSources-output.xcfilelist
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A 
Source/WebCore/layout/formattingContexts/inline/SVGTextDisplayContentBuilder.cpp
    A 
Source/WebCore/layout/formattingContexts/inline/SVGTextDisplayContentBuilder.h
    M 
Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLine.h
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.h
    M Source/WebCore/rendering/RenderBlockFlow.cpp
    M Source/WebCore/rendering/RenderBlockFlow.h
    M Source/WebCore/rendering/svg/RenderSVGText.cpp
    M Source/WebCore/rendering/svg/RenderSVGText.h

  Log Message:
  -----------
  [IFC][SVG text] Build SVG text display content without inline layout
https://bugs.webkit.org/show_bug.cgi?id=326663
rdar://problem/189395026

Reviewed by Alan Baradlay.

Add a common-case line layout fast path for SVG text.

SVG text never wraps and SVGTextLayoutEngine computes all glyph positions, so 
the inline formatting context
output is mostly thrown away. Build the display boxes and the line directly 
from the layout box tree instead.
Content that needs bidi reordering or other unsupported features falls back to 
the full inline layout.

On a microbenchmark with 10k text elements, IFC SVG text layout goes from 53% 
slower than legacy to about 4% slower
for text mutations, and from 20% slower to about 4% slower for creation.

* 
Source/WebCore/layout/formattingContexts/inline/SVGTextDisplayContentBuilder.cpp:
 Added.
(WebCore::Layout::hasInlineDirectionMarginBorderOrPadding):
(WebCore::Layout::buildSVGTextDisplayContent):

Produces the same boxes as the inline formatting context, including whitespace 
collapsing and trimming.

* 
Source/WebCore/layout/formattingContexts/inline/SVGTextDisplayContentBuilder.h: 
Added.
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLine.h:
(WebCore::InlineDisplay::Line::setLineBoxRectForSVGText):

Set the content geometry from the SVG line box too.

* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::layoutSVGText):
(WebCore::LayoutIntegration::LineLayout::insertedIntoTree):
(WebCore::LayoutIntegration::LineLayout::removedFromTree):
(WebCore::LayoutIntegration::LineLayout::updateTextContent):

SVG text is always fully laid out. Don't compute partial damage.

* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.h:
* Source/WebCore/Scripts/generate-unified-sources.sh:
* Source/WebCore/Sources.txt:
* Source/WebCore/UnifiedSources-output.xcfilelist:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::ensureInlineLayout):
* Source/WebCore/rendering/RenderBlockFlow.h:

Let RenderSVGText create the inline line layout.

* Source/WebCore/rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::layout):
(WebCore::RenderSVGText::layoutInlineChildrenWithoutLineLayout):

Build the display content with LineLayout::layoutSVGText() and mark the inline 
children clean. Fall back to
layoutInlineChildren() when the content needs the full inline layout.

* Source/WebCore/rendering/svg/RenderSVGText.h:

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



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

Reply via email to