Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f6bc4f7cc2fe6e6e5f32fb44c979ba685e88b7c1
      
https://github.com/WebKit/WebKit/commit/f6bc4f7cc2fe6e6e5f32fb44c979ba685e88b7c1
  Author: Wenson Hsieh <wenson_hs...@apple.com>
  Date:   2025-03-19 (Wed, 19 Mar 2025)

  Changed paths:
    A 
LayoutTests/editing/selection/ios/bidi-visually-contiguous-selection-10-expected.txt
    A 
LayoutTests/editing/selection/ios/bidi-visually-contiguous-selection-10.html
    M Source/WebCore/rendering/CaretRectComputation.h
    M Source/WebCore/rendering/RenderObject.cpp

  Log Message:
  -----------
  [iOS] [Visual Bidi Selection] Selection highlight is sometimes missing on 
last line in multiline bidi text selection
https://bugs.webkit.org/show_bug.cgi?id=290014
rdar://146854735

Reviewed by Abrar Rahman Protyasha.

Currently, `makeBidiSelectionVisuallyContiguousIfNeeded` handles multiline 
selections by adjusting
the selections in the first and last lines, such that they unite the caret rect 
of the corresponding
selection endpoint, with the rect of the position at the end or start of the 
line (depending on
whether we're computing the selection rect for the first or last line).

This mostly works, except for the case where `(right|left)BoundaryOfLine` 
returns a position that's
on the *previous* line, instead of the current line; in this case, we end up 
with a broken selection
handle, as the selection caret on the last line is joined with the caret rect 
of a position on the
previous line. The handle rect becomes too tall, and the highlight itself 
either faces the wrong
direction or disappears entirely.

To fix this, use `RenderedPosition`'s helpers — `(right|left)BoundaryOfBidiRun` 
— instead of the
editing helpers `(right|left)BoundaryOfLine` when computing the caret rect of 
the extents on the
same line. Unlike the latter, the former correctly handles the case where a 
soft line wrap is
followed by an inline block container, by returning caret rects corresponding 
to the left and right
visual boundaries of the inline block container.

* 
LayoutTests/editing/selection/ios/bidi-visually-contiguous-selection-10-expected.txt:
 Added.
* LayoutTests/editing/selection/ios/bidi-visually-contiguous-selection-10.html: 
Added.

Add a layout test to exercise this fix.

* Source/WebCore/rendering/CaretRectComputation.h:

Drive-by change — give this `enum class` a width of `bool`.

* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::makeBidiSelectionVisuallyContiguousIfNeeded):

Canonical link: https://commits.webkit.org/292356@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