Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
REGRESSION (macOS 14): Force clicking text selection in Books often s…
…hows 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
- Loading branch information