Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: 1d42b8b66d7257fe7bb67f29bb8288d5261398ca https://github.com/WebKit/WebKit/commit/1d42b8b66d7257fe7bb67f29bb8288d5261398ca Author: Aditya Keerthi <akeer...@apple.com> Date: 2023-07-19 (Wed, 19 Jul 2023)
Changed paths: M Source/WebCore/editing/Editor.cpp Log Message: ----------- REGRESSION (macOS 14): Force clicking text selection in Books often shows blank highlight https://bugs.webkit.org/show_bug.cgi?id=259344 rdar://110178512 Reviewed by Wenson Hsieh. On macOS, force clicking the text selection presents a highlight, implemented using `TextIndicator`. In order to capture a snapshot of the selection, the `RenderView`'s `SelectionRangeData` must be up-to-date. On iOS family platforms, including Mac Catalyst (which is used by Books) appearance updates are almost always elided, as UIKit is responsible for drawing the selection highlight. This means that the current `SelectionRangeData` is often incorrect, which is fine since it is often unused. However, since it needs to be up-to-date for the selection snapshot, `FrameSelection::setUpdateAppearanceEnabled` is set to true for the scope of the snapshot, via `TemporarySelectionChange`. While appearance updates are enabled, `FrameSelection` bails from making updates if the selection is unchanged. In the case of this bug, the text is already selected prior to force clicking. Consequently, the selection used for the highlight in `TemporarySelectionChange` is equivalent to the current selection, and the appearance update never occurs. Finally, since the `SelectionRangeData` is incorrect, a blank selection snapshot is obtained. To fix, ensure an appearance update occurs prior to taking a selection snapshot using `TextIndicator` and `TemporarySelectionChange`. * Source/WebCore/editing/Editor.cpp: (WebCore::TemporarySelectionChange::TemporarySelectionChange): Call `FrameSelection::setNeedsSelectionUpdate` to ensure that an appearance update occurs even if the current selection and temporary selection are equal. Canonical link: https://commits.webkit.org/266168@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes