Branch: refs/heads/main Home: https://github.com/WebKit/WebKit Commit: ca201a717c242c53d1171e58aee57a5665cd5bc5 https://github.com/WebKit/WebKit/commit/ca201a717c242c53d1171e58aee57a5665cd5bc5 Author: Ryosuke Niwa <rn...@webkit.org> Date: 2022-10-31 (Mon, 31 Oct 2022)
Changed paths: A LayoutTests/editing/selection/double-click-expands-focus-anchor-live-range-expected.txt A LayoutTests/editing/selection/double-click-expands-focus-anchor-live-range.html M Source/WebCore/editing/VisibleSelection.cpp M Source/WebCore/page/EventHandler.cpp M Source/WebCore/page/EventHandler.h Log Message: ----------- [Live Range Selection] Expanding selection by granularity should expand anchor & focus https://bugs.webkit.org/show_bug.cgi?id=247239 Reviewed by Wenson Hsieh and Darin Adler. This patch reverts commits.webkit.org/r268847 and implements a new fix. Ideally, we fix VisibleSelection::adjustSelectionRespectingGranularity to not expand the end more than required but that approach causes regressions (e.g. extending selection backwards will end up deselecting the original word that was double tapped when drag selecting text backwards), some of which are hard to overcome. So, this patch instead detects when the ending is expanding unexpectedly, and corrects it in EventHandler::updateSelectionForMouseDrag. * LayoutTests/editing/selection/double-click-expands-focus-anchor-live-range-expected.txt: Added. * LayoutTests/editing/selection/double-click-expands-focus-anchor-live-range.html: Added. * Source/WebCore/editing/VisibleSelection.cpp: (WebCore::VisibleSelection::validate): Reverted r268847. * Source/WebCore/page/EventHandler.cpp: (WebCore::EventHandler::updateSelectionForMouseDownDispatchingSelectStart): (WebCore::EventHandler::handleMousePressEventDoubleClick): (WebCore::EventHandler::updateSelectionForMouseDrag): Detect when the end is erroneously extending, and correct back to the original end. * Source/WebCore/page/EventHandler.h: Canonical link: https://commits.webkit.org/256174@main _______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes