[webkit-changes] [WebKit/WebKit] edf1c2: [iOS] Various tests hit debug assertions underneat...

Wenson Hsieh noreply at github.com
Tue Feb 18 20:30:16 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: edf1c2158c6247c06987622dd2bf15fd4b05849b
      https://github.com/WebKit/WebKit/commit/edf1c2158c6247c06987622dd2bf15fd4b05849b
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2025-02-18 (Tue, 18 Feb 2025)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp
    M Source/WebCore/platform/text/UnicodeHelpers.cpp

  Log Message:
  -----------
  [iOS] Various tests hit debug assertions underneath `baseTextDirection` when turning on `BidiContentAwarePasteEnabled`
https://bugs.webkit.org/show_bug.cgi?id=287911
rdar://145098905

Reviewed by Abrar Rahman Protyasha.

When `BidiContentAwarePasteEnabled` is enabled, `ReplaceSelectionCommand` now attempts to check the
base writing direction of the pasted text, in order to automatically adjust base writing direction
prior to inserting the pasted content as a fragment in the DOM. To do this, it uses the
`baseTextDirection` helper, which returns an optional `TextDirection` enum.

However, this `baseTextDirection` helper function asserts in debug when passed an 8-bit (`LChar`)
string, since we immediately call `span16()` on it. This logic was pulled from `Layout::TextUtil`,
which (correctly) handles this case.

To fix this, we simply lower the `is8Bit()` into `baseTextDirection`, and return LTR before calling
into `ubidi_getBaseDirection` with `UChar` data.

* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::directionForTextContent):
* Source/WebCore/platform/text/UnicodeHelpers.cpp:
(WebCore::baseTextDirection):

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



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


More information about the webkit-changes mailing list