Title: [214687] trunk
- Revision
- 214687
- Author
- [email protected]
- Date
- 2017-03-31 14:46:42 -0700 (Fri, 31 Mar 2017)
Log Message
[WK2] Tapping editable text inside of a range selection no longer changes the selection to a caret
https://bugs.webkit.org/show_bug.cgi?id=170327
<rdar://problem/31363816>
Reviewed by Tim Horton.
Source/WebKit2:
Currently, we're forcing all text interaction gestures to duck in lieu of data interaction gestures
when we should only be doing so for gestures that begin a loupe. This prevents other gestures, such as
single taps, from changing the selection when they should be allowed to.
Hooks into new UIKit SPI to make this tweak.
Introduces a new LayoutTest: editing/selection/caret-after-tap-in-editable-selection.html.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView pointIsInAssistedNode:]):
(-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
LayoutTests:
Adds a new WK2 interaction test for iOS verifying that tapping a selection in editable content sets the selection
to a caret, rather than maintaining the range selection. This test is disabled in OpenSource, since it relies on
synthetic touch events.
* TestExpectations:
* editing/selection/caret-after-tap-in-editable-selection-expected.txt: Added.
* editing/selection/caret-after-tap-in-editable-selection.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (214686 => 214687)
--- trunk/LayoutTests/ChangeLog 2017-03-31 21:22:05 UTC (rev 214686)
+++ trunk/LayoutTests/ChangeLog 2017-03-31 21:46:42 UTC (rev 214687)
@@ -1,3 +1,19 @@
+2017-03-31 Wenson Hsieh <[email protected]>
+
+ [WK2] Tapping editable text inside of a range selection no longer changes the selection to a caret
+ https://bugs.webkit.org/show_bug.cgi?id=170327
+ <rdar://problem/31363816>
+
+ Reviewed by Tim Horton.
+
+ Adds a new WK2 interaction test for iOS verifying that tapping a selection in editable content sets the selection
+ to a caret, rather than maintaining the range selection. This test is disabled in OpenSource, since it relies on
+ synthetic touch events.
+
+ * TestExpectations:
+ * editing/selection/caret-after-tap-in-editable-selection-expected.txt: Added.
+ * editing/selection/caret-after-tap-in-editable-selection.html: Added.
+
2017-03-31 Alexey Proskuryakov <[email protected]>
Mark fast/mediastream/MediaStream-page-muted.html as flaky for
Modified: trunk/LayoutTests/TestExpectations (214686 => 214687)
--- trunk/LayoutTests/TestExpectations 2017-03-31 21:22:05 UTC (rev 214686)
+++ trunk/LayoutTests/TestExpectations 2017-03-31 21:46:42 UTC (rev 214687)
@@ -79,6 +79,7 @@
# This test only makes sense on iOS
fast/attachment/attachment-wrapping-action.html
+editing/selection/caret-after-tap-in-editable-selection.html [ Skip ]
# Only iOS has selection UI drawn by UIKit
editing/selection/character-granularity-rect.html [ Skip ]
Added: trunk/LayoutTests/editing/selection/caret-after-tap-in-editable-selection-expected.txt (0 => 214687)
--- trunk/LayoutTests/editing/selection/caret-after-tap-in-editable-selection-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/selection/caret-after-tap-in-editable-selection-expected.txt 2017-03-31 21:46:42 UTC (rev 214687)
@@ -0,0 +1,8 @@
+Here's to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes.
+The ones who see things differently. They're not fond of rules. And they have no respect for the status quo.
+You can quote them, disagree with them, glorify or vilify them. About the only thing you can't do is ignore them.
+Because they change things. They push the human race forward. And while some may see them as the crazy ones, we see genius.
+Because the people who are crazy enough to think they can change the world, are the ones who do.
+Expanded selection to range.
+Collapsed selection to caret.
+
Added: trunk/LayoutTests/editing/selection/caret-after-tap-in-editable-selection.html (0 => 214687)
--- trunk/LayoutTests/editing/selection/caret-after-tap-in-editable-selection.html (rev 0)
+++ trunk/LayoutTests/editing/selection/caret-after-tap-in-editable-selection.html 2017-03-31 21:46:42 UTC (rev 214687)
@@ -0,0 +1,71 @@
+<!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<meta name=viewport content="width=device-width, initial-scale=1">
+<body contenteditable height="100%">
+ <div>Here's to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes.</div>
+ <div>The ones who see things differently. They're not fond of rules. And they have no respect for the status quo.</div>
+ <div>You can quote them, disagree with them, glorify or vilify them. About the only thing you can't do is ignore them.</div>
+ <div>Because they change things. They push the human race forward. And while some may see them as the crazy ones, we see genius.</div>
+ <div>Because the people who are crazy enough to think they can change the world, are the ones who do.</div>
+ <div id="output" style="color: green; margin-top: 1em;"></div>
+</body>
+<script>
+ function tapInEditorToShowKeyboardScript()
+ {
+ return `
+ (() => {
+ uiController.didShowKeyboardCallback = () => {
+ uiController.uiScriptComplete();
+ };
+ uiController.singleTapAtPoint(50, 50, () => { });
+ })();`;
+ }
+
+ function tapInEditorScript()
+ {
+ return `
+ (() => {
+ uiController.singleTapAtPoint(50, 50, () => {
+ uiController.uiScriptComplete();
+ });
+ })();`;
+ }
+
+ function appendOutput(message)
+ {
+ let code = document.createElement("code");
+ code.appendChild(document.createTextNode(message));
+ output.appendChild(code);
+ output.appendChild(document.createElement("br"));
+ }
+
+ (() => {
+ let hasSeenRangeSelection = false;
+ document.designMode = "on";
+ document.addEventListener("selectionchange", () => {
+ if (!getSelection().rangeCount)
+ return;
+
+ let selectionIsCollapsed = getSelection().getRangeAt(0).collapsed;
+ if (!selectionIsCollapsed) {
+ appendOutput("Expanded selection to range.");
+ hasSeenRangeSelection = true;
+ }
+ if (hasSeenRangeSelection && selectionIsCollapsed) {
+ appendOutput("Collapsed selection to caret.");
+ testRunner.notifyDone();
+ }
+ });
+
+ if (!window.testRunner) {
+ appendOutput("To manually test, make a selection and tap inside of it. This should result in a caret selection.");
+ return;
+ }
+
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ testRunner.runUIScript(tapInEditorToShowKeyboardScript(), () => {
+ document.execCommand("SelectAll");
+ testRunner.runUIScript(tapInEditorScript(), () => { });
+ });
+ })();
+</script>
Modified: trunk/Source/WebKit2/ChangeLog (214686 => 214687)
--- trunk/Source/WebKit2/ChangeLog 2017-03-31 21:22:05 UTC (rev 214686)
+++ trunk/Source/WebKit2/ChangeLog 2017-03-31 21:46:42 UTC (rev 214687)
@@ -1,3 +1,22 @@
+2017-03-31 Wenson Hsieh <[email protected]>
+
+ [WK2] Tapping editable text inside of a range selection no longer changes the selection to a caret
+ https://bugs.webkit.org/show_bug.cgi?id=170327
+ <rdar://problem/31363816>
+
+ Reviewed by Tim Horton.
+
+ Currently, we're forcing all text interaction gestures to duck in lieu of data interaction gestures
+ when we should only be doing so for gestures that begin a loupe. This prevents other gestures, such as
+ single taps, from changing the selection when they should be allowed to.
+
+ Hooks into new UIKit SPI to make this tweak.
+ Introduces a new LayoutTest: editing/selection/caret-after-tap-in-editable-selection.html.
+
+ * UIProcess/ios/WKContentViewInteraction.mm:
+ (-[WKContentView pointIsInAssistedNode:]):
+ (-[WKContentView textInteractionGesture:shouldBeginAtPoint:]):
+
2017-03-31 Tim Horton <[email protected]>
Mail can get stuck underneath FindController::findStringMatches after searching in a long message
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (214686 => 214687)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2017-03-31 21:22:05 UTC (rev 214686)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm 2017-03-31 21:46:42 UTC (rev 214687)
@@ -1481,13 +1481,18 @@
- (BOOL)pointIsInAssistedNode:(CGPoint)point
{
+ // This method is still implemented for backwards compatibility with older UIKit versions.
+ return [self textInteractionGesture:UIWKGestureLoupe shouldBeginAtPoint:point];
+}
+
+- (BOOL)textInteractionGesture:(UIWKGestureType)gesture shouldBeginAtPoint:(CGPoint)point
+{
InteractionInformationRequest request(roundedIntPoint(point));
[self ensurePositionInformationIsUpToDate:request];
#if ENABLE(DATA_INTERACTION)
- if (_positionInformation.hasSelectionAtPosition) {
+ if (_positionInformation.hasSelectionAtPosition && gesture == UIWKGestureLoupe) {
// If the position might initiate data interaction, we don't want to change the selection.
- // FIXME: This should be renamed to something more precise, such as textInteractionShouldRecognizeGestureAtPoint:
return NO;
}
#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes