Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 465cfe09178ce29558632515716457248790aaf8
      
https://github.com/WebKit/WebKit/commit/465cfe09178ce29558632515716457248790aaf8
  Author: Alan Baradlay <[email protected]>
  Date:   2026-02-10 (Tue, 10 Feb 2026)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.h
    M Source/WebCore/layout/formattingContexts/inline/InlineTextItem.h
    M Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp
    M Source/WebCore/layout/formattingContexts/inline/text/TextUtil.h

  Log Message:
  -----------
  Measure content while finding potential breaking positions (non-bidi, normal 
text-autospace)
https://bugs.webkit.org/show_bug.cgi?id=307345

Reviewed by Antti Koivisto.

Let's measure text width the same time we slice the content into 
InlineTextItems.
(This was also the initial implementation which was later changed to a two-pass 
approach for bidi content).

When the content is bidi/text-autospace is not normal, we may measure text 
twice but width-cache should
help us here.

1. Add helper functions to measure non-whitespace content and create 
InlineTextItems.
2. Measure text as we process the content (both in case of initial or cached 
positions)

* Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp:
(WebCore::Layout::nonWhitespaceContentWidth):
(WebCore::Layout::InlineItemsBuilder::build):
(WebCore::Layout::canCacheWidthOnInlineTextItem):
(WebCore::Layout::InlineItemsBuilder::computeInlineTextItemWidthsAndTextSpacing):
(WebCore::Layout::InlineItemsBuilder::buildInlineItemListForTextFromBreakingPositionsCache):
(WebCore::Layout::InlineItemsBuilder::handleTextContent):
(WebCore::Layout::InlineItemsBuilder::shouldDeferTextMeasurement const):
(WebCore::Layout::canCacheMeasuredWidthOnInlineTextItem): Deleted.
* Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.h:
* Source/WebCore/layout/formattingContexts/inline/InlineTextItem.h:
(WebCore::Layout::InlineTextItem::createNonWhitespaceItem):
* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::singleSpaceWidth):
(WebCore::Layout::TextUtil::width):
(WebCore::Layout::spaceWidth): Deleted.
* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.h:

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



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

Reply via email to