Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1fc3d9918294db0be3dda280ef838328b0e59c0b
      
https://github.com/WebKit/WebKit/commit/1fc3d9918294db0be3dda280ef838328b0e59c0b
  Author: Yulun Wu <[email protected]>
  Date:   2025-01-20 (Mon, 20 Jan 2025)

  Changed paths:
    A LayoutTests/fast/text/whitespace/whitespace-trailing-trim-expected.txt
    A LayoutTests/fast/text/whitespace/whitespace-trailing-trim.html
    M 
Source/WebCore/layout/formattingContexts/inline/text/TextBreakingPositionCache.cpp
    M 
Source/WebCore/layout/formattingContexts/inline/text/TextBreakingPositionContext.h

  Log Message:
  -----------
  [IFC] Update TextBreakingPositionCache to use WhiteSpaceCollapse.
https://bugs.webkit.org/show_bug.cgi?id=285551
<rdar://141021052>

Reviewed by Alan Baradlay.

This change fixes a bug where TextBreakingPositionContext was tracking validity 
of
text breaking positions by checking whether RenderStyle::WhiteSpace changed 
between
the calculation and fetching cached breaking points. This causes issues where 
setting
TextWrapMode implicitly changes how white space collapses but RenderText's
RenderStyle is not correctly updated, causing TextBreakingPositionCache to
use stale breaking positions.

This is because there are combinations of textWrapMode() and 
whiteSpaceCollapse()
that are not supported by the whiteSpace() shorthand, causing combinations that
cannot be represented by the whiteSpace() syntax to be incorrectly classified as
WhiteSpace::Normal. Changing layout contexts between unsupported combinations
causes incorrect usage of cached layouts.

The correct way to avoid this is to hash on the longhand 
RenderStyle::WhiteSpaceCollapse.

https://github.com/WebKit/WebKit/blob/e41eca63e27004fb0b1e0a5a3e90e00b134a6d7f/Source/WebCore/rendering/style/RenderStyle.cpp#L2850-L2872

A follow up CL will be sent out to remove RenderStyle()::whiteSpace() from 
WebCore.

This PR also adds WhiteSpaceCollapseBehavior that groups WhiteSpaceCollapse
types that have the same text breaking positions. This lets us avoid
recalculating breaking points when switching between these
WhiteSpaceCollapse types that would have identical breaking points.

https://drafts.csswg.org/css-text-4/#white-space-collapsing

https://commits.webkit.org/265267@main
https://commits.webkit.org/269613@main

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to