Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1663444ffb8cc963ae9fed19c2c430c3f4074926
      
https://github.com/WebKit/WebKit/commit/1663444ffb8cc963ae9fed19c2c430c3f4074926
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2025-08-26 (Tue, 26 Aug 2025)

  Changed paths:
    A LayoutTests/editing/pasteboard/paste-rtl-paragraph-twice-expected.html
    A LayoutTests/editing/pasteboard/paste-rtl-paragraph-twice.html
    M Source/WebCore/editing/ReplaceSelectionCommand.cpp

  Log Message:
  -----------
  [Bidi Copy/Paste] Preserve writing direction when pasting multi-paragraph 
bidi text
https://bugs.webkit.org/show_bug.cgi?id=297923
rdar://152236717

Reviewed by Abrar Rahman Protyasha.

Make the heuristics in `updateDirectionForStartOfInsertedContentIfNeeded` more 
aggressive, in the
case where the inserted content range spans multiple paragraphs (e.g. a 
paragraph separator,
followed by text); instead of only applying the paragraph direction fixup 
(based on the pasted
text's base writing direction or the paragraph's `dir`) to the first paragraph, 
we apply it to all
pasted paragraphs.

Note that the use of `baseTextDirection` (i.e. `ubidi_getBaseDirection`) is 
consistent with the
platform for now, but in the future (and on Cocoa platforms), we'd want to adopt
`CFAttributedStringGetStatisticalWritingDirections` to more accurately 
determine whether a pasted
string of plain text (with no explicit `dir`) should be handled as RTL or LTR.

* LayoutTests/editing/pasteboard/paste-rtl-paragraph-twice-expected.html: Added.
* LayoutTests/editing/pasteboard/paste-rtl-paragraph-twice.html: Added.

Add a layout test to exercise this change (the second paste would otherwise 
result in the second
paragraph ending up as LTR rather than RTL).

* Source/WebCore/editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::updateDirectionForStartOfInsertedContentIfNeeded):

See above.

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



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

Reply via email to