[WK2] Tapping away to dismiss the selection does not update the selected DOM range...
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Mar 2017 22:36:00 +0000 (22:36 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Mar 2017 22:36:00 +0000 (22:36 +0000)
commit74d02b98d77dde8232fe7ca85835363593353790
tree67e09e3b3ec18aaba791ba672d446e3903aab778
parent25544bd640b30ee995700b1186b0116f11f1a168
[WK2] Tapping away to dismiss the selection does not update the selected DOM range using character granularity
https://bugs.webkit.org/show_bug.cgi?id=170328
<rdar://problem/30904558>

Reviewed by Tim Horton.

Source/WebKit2:

When UIKit clears the selection while in text interaction mode, it notifies its document view (i.e., the
WKContentView) by setting its selected text range to nil. When character granularity selection is enabled, use
this as a cue to notify the web process that the selection is being cleared out.

-setSelectedTextRange: is a noop in the general case because the web process acts as the source of truth for what
the selection currently consists of, and notifies the UI process and UIKit via WKTextPosition and WKTextRange.
However, in the case of character granularity selections, tapping away to clear the selection is handled by
UIKit's text gesture recognizer cluster, which then informs the document (via -setSelectedTextRange:) that the
selection should be cleared out.

Adds a new Layout test: editing/selection/character-granularity-selected-range-after-dismissing-selection.html.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setSelectedTextRange:]):

LayoutTests:

Adds a new layout test verifying that when a user taps away to clear the current selection in character
granularity selection mode, the selected DOM range in the web process does not fall out of sync with UIKit's
selection views, which are dismissed.

* editing/selection/character-granularity-selected-range-after-dismissing-selection-expected.txt: Added.
* editing/selection/character-granularity-selected-range-after-dismissing-selection.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214692 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/editing/selection/character-granularity-selected-range-after-dismissing-selection-expected.txt [new file with mode: 0644]
LayoutTests/editing/selection/character-granularity-selected-range-after-dismissing-selection.html [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm