[webkit-changes] [WebKit/WebKit] ed5608: REGRESSION (iOS 16): sina.cn: Find on Page highlig...

Aditya Keerthi noreply at github.com
Sat Feb 4 11:58:20 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ed56087035ea16b403123ce455cadf354c161988
      https://github.com/WebKit/WebKit/commit/ed56087035ea16b403123ce455cadf354c161988
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2023-02-04 (Sat, 04 Feb 2023)

  Changed paths:
    M Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp

  Log Message:
  -----------
  REGRESSION (iOS 16): sina.cn: Find on Page highlights obscure the text behind them
https://bugs.webkit.org/show_bug.cgi?id=251707
rdar://102302792

Reviewed by Wenson Hsieh.

sina.cn contains elements with "-webkit-user-select: none". Prior to iOS 16,
any text found within these elements would count towards the number of results,
but would not be highlighted.

Find-in-page logic was refactored in iOS 16 to support UIKit's new Find & Replace
API. As part of these changes, find-in-page began storing/restoring ranges, rather
than simply updating selection. Consequently, the `TextIndicator` used to draw
highlights is created from a `SimpleRange`, rather than the current selection.
The previously used constructor would early return if the selection was empty
(as is the case when attempting to select a "-webkit-user-select: none" element),
resulting the the pre-iOS 16 behavior described above.

`TextIndicator` does not know how to take snapshots of "-webkit-user-select: none"
content. Consequently, the highlight is painted without any text, leading to
found text getting obscured.

For now, restore the pre-iOS 16 behavior, and do not draw highlights if the
selection is empty. In the longer term, `TextIndicator` should be taught to
draw this content (tracked in webkit.org/b/251709). Note that following this
change, there is still a net progression over pre-iOS 16 behavior, where
WebKit will indicate found results with "-webkit-user-select: none" by drawing
"holes".

* Source/WebKit/WebProcess/WebPage/WebFoundTextRangeController.cpp:
(WebKit::WebFoundTextRangeController::drawRect):

Additionally, move the use of `GraphicsContext` closer to the painting logic to
avoid running unnecessary code.

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




More information about the webkit-changes mailing list