Unreviewed, rolling out r249709.
authorrussell_e@apple.com <russell_e@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Sep 2019 16:53:19 +0000 (16:53 +0000)
committerrussell_e@apple.com <russell_e@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Sep 2019 16:53:19 +0000 (16:53 +0000)
Layout test added in this patch has been consistently failing
since it landed.

Reverted changeset:

"Option + arrow moves caret past whitespace on iOS"
https://bugs.webkit.org/show_bug.cgi?id=201575
https://trac.webkit.org/changeset/249709

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249838 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/selection/ios/move-by-word-with-keyboard-expected.txt [deleted file]
LayoutTests/editing/selection/ios/move-by-word-with-keyboard.html [deleted file]
LayoutTests/editing/selection/ios/select-non-editable-text-using-keyboard-expected.txt
LayoutTests/editing/selection/ios/select-non-editable-text-using-keyboard.html
Source/WebCore/ChangeLog
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/editing/FrameSelection.h
Source/WebCore/editing/TextIterator.cpp
Source/WebCore/editing/VisibleUnits.cpp
Source/WebCore/editing/VisibleUnits.h
Source/WebCore/platform/text/TextBoundaries.cpp
Source/WebCore/platform/text/TextBoundaries.h
Source/WebCore/platform/text/mac/TextBoundaries.mm

index 52e5ca3..57f6a79 100644 (file)
@@ -1,3 +1,16 @@
+2019-09-13  Russell Epstein  <repstein@apple.com>
+
+        Unreviewed, rolling out r249709.
+
+        Layout test added in this patch has been consistently failing
+        since it landed.
+
+        Reverted changeset:
+
+        "Option + arrow moves caret past whitespace on iOS"
+        https://bugs.webkit.org/show_bug.cgi?id=201575
+        https://trac.webkit.org/changeset/249709
+
 2019-09-13  Chris Dumez  <cdumez@apple.com>
 
         Stop using testRunner.setPrivateBrowsingEnabled_DEPRECATED() in http/tests/security/appcache-in-private-browsing.html
diff --git a/LayoutTests/editing/selection/ios/move-by-word-with-keyboard-expected.txt b/LayoutTests/editing/selection/ios/move-by-word-with-keyboard-expected.txt
deleted file mode 100644 (file)
index 6e91781..0000000
+++ /dev/null
@@ -1,423 +0,0 @@
-This tests moving the caret with word granularity on iOS.
-WebKit should stop at the end of each word before whitespace when moving forwards, and after whitespace when moving backwards,
-The empty line should be skipped in either direction.
-
-Before moving forwards:
-| "
-    "
-| <div>
-|   "<#selection-caret>hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & blue."
-| "
-"
-
-After moving to the right by word (1):
-| "
-    "
-| <div>
-|   "hello<#selection-caret> world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & blue."
-| "
-"
-
-After moving to the right by word (2):
-| "
-    "
-| <div>
-|   "hello world<#selection-caret>"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & blue."
-| "
-"
-
-After moving to the right by word (3):
-| "
-    "
-| <div>
-|   "hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red,<#selection-caret> green, & blue."
-| "
-"
-
-After moving to the right by word (4):
-| "
-    "
-| <div>
-|   "hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green,<#selection-caret> & blue."
-| "
-"
-
-After moving to the right by word (5):
-| "
-    "
-| <div>
-|   "hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, &<#selection-caret> blue."
-| "
-"
-
-After moving to the right by word (6):
-| "
-    "
-| <div>
-|   "hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & blue.<#selection-caret>"
-| "
-"
-
-Before moving backwards:
-| "
-    "
-| <div>
-|   "hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & blue.<#selection-caret>"
-| "
-"
-
-After moving to the left by word (1):
-| "
-    "
-| <div>
-|   "hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & <#selection-caret>blue."
-| "
-"
-
-After moving to the left by word (2):
-| "
-    "
-| <div>
-|   "hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, <#selection-caret>& blue."
-| "
-"
-
-After moving to the left by word (3):
-| "
-    "
-| <div>
-|   "hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, <#selection-caret>green, & blue."
-| "
-"
-
-After moving to the left by word (4):
-| "
-    "
-| <div>
-|   "hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "<#selection-caret>red, green, & blue."
-| "
-"
-
-After moving to the left by word (5):
-| "
-    "
-| <div>
-|   "hello <#selection-caret>world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & blue."
-| "
-"
-
-After moving to the left by word (6):
-| "
-    "
-| <div>
-|   "<#selection-caret>hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & blue."
-| "
-"
-
-Before extending forwards:
-| "
-    "
-| <div>
-|   "<#selection-caret>hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & blue."
-| "
-"
-
-After extending to the right by word (1):
-| "
-    "
-| <div>
-|   "<#selection-anchor>hello<#selection-focus> world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & blue."
-| "
-"
-
-After extending to the right by word (2):
-| "
-    "
-| <div>
-|   "<#selection-anchor>hello world<#selection-focus>"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & blue."
-| "
-"
-
-After extending to the right by word (3):
-| "
-    "
-| <div>
-|   "<#selection-anchor>hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red,<#selection-focus> green, & blue."
-| "
-"
-
-After extending to the right by word (4):
-| "
-    "
-| <div>
-|   "<#selection-anchor>hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green,<#selection-focus> & blue."
-| "
-"
-
-After extending to the right by word (5):
-| "
-    "
-| <div>
-|   "<#selection-anchor>hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, &<#selection-focus> blue."
-| "
-"
-
-After extending to the right by word (6):
-| "
-    "
-| <div>
-|   "<#selection-anchor>hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & blue.<#selection-focus>"
-| "
-"
-
-Before extending backwards:
-| "
-    "
-| <div>
-|   "hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & blue.<#selection-caret>"
-| "
-"
-
-After extending to the left by word (1):
-| "
-    "
-| <div>
-|   "hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & <#selection-focus>blue.<#selection-anchor>"
-| "
-"
-
-After extending to the left by word (2):
-| "
-    "
-| <div>
-|   "hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, <#selection-focus>& blue.<#selection-anchor>"
-| "
-"
-
-After extending to the left by word (3):
-| "
-    "
-| <div>
-|   "hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, <#selection-focus>green, & blue.<#selection-anchor>"
-| "
-"
-
-After extending to the left by word (4):
-| "
-    "
-| <div>
-|   "hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "<#selection-focus>red, green, & blue.<#selection-anchor>"
-| "
-"
-
-After extending to the left by word (5):
-| "
-    "
-| <div>
-|   "hello <#selection-focus>world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & blue.<#selection-anchor>"
-| "
-"
-
-After extending to the left by word (6):
-| "
-    "
-| <div>
-|   "<#selection-focus>hello world"
-| "
-    "
-| <br>
-| "
-    "
-| <div>
-|   "red, green, & blue.<#selection-anchor>"
-| "
-"
diff --git a/LayoutTests/editing/selection/ios/move-by-word-with-keyboard.html b/LayoutTests/editing/selection/ios/move-by-word-with-keyboard.html
deleted file mode 100644 (file)
index 4e8137c..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
-<html>
-<head>
-<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no">
-<script src="../../../resources/ui-helper.js"></script>
-<script src="../../../resources/dump-as-markup.js"></script>
-<script>
-
-Markup.description(`This tests moving the caret with word granularity on iOS.
-WebKit should stop at the end of each word before whitespace when moving forwards, and after whitespace when moving backwards,
-The empty line should be skipped in either direction.`);
-Markup.noAutoDump();
-Markup.waitUntilDone();
-
-async function runTest()
-{
-    const editor = document.getElementById('editor');
-
-    if (window.testRunner)
-        await UIHelper.activateElementAndWaitForInputSession(editor);
-
-    if (!window.testRunner) {
-        Markup.dump(editor, 'Markup');
-        Markup.notifyDone();
-        return;
-    }
-
-    getSelection().setPosition(editor, 0);
-    Markup.dump(editor, 'Before moving forwards');
-
-    const moveCount = 6;
-
-    for (let i = 0; i < moveCount; i++) {
-        await UIHelper.keyDown('rightArrow', ['altKey']);
-        await UIHelper.ensurePresentationUpdate();
-        Markup.dump(editor, `After moving to the right by word (${i + 1})`);
-    }
-
-    getSelection().setPosition(editor, editor.childNodes.length);
-    Markup.dump(editor, 'Before moving backwards');
-
-    for (let i = 0; i < moveCount; i++) {
-        await UIHelper.keyDown('leftArrow', ['altKey']);
-        await UIHelper.ensurePresentationUpdate();
-        Markup.dump(editor, `After moving to the left by word (${i + 1})`);
-    }
-
-    getSelection().setPosition(editor, 0);
-    Markup.dump(editor, 'Before extending forwards');
-
-    for (let i = 0; i < moveCount; i++) {
-        await UIHelper.keyDown('rightArrow', ['shiftKey', 'altKey']);
-        await UIHelper.ensurePresentationUpdate();
-        Markup.dump(editor, `After extending to the right by word (${i + 1})`);
-    }
-
-    getSelection().setPosition(editor, editor.childNodes.length);
-    Markup.dump(editor, 'Before extending backwards');
-
-    for (let i = 0; i < moveCount; i++) {
-        await UIHelper.keyDown('leftArrow', ['shiftKey', 'altKey']);
-        await UIHelper.ensurePresentationUpdate();
-        Markup.dump(editor, `After extending to the left by word (${i + 1})`);
-    }
-
-    Markup.notifyDone();
-}
-
-onload = runTest;
-</script>
-</head>
-<body>
-<div id="editor" contenteditable>
-    <div>hello world</div>
-    <br>
-    <div>red, green, & blue.</div>
-</div>
-</body>
-</html>
index 7e8770d..be2232e 100644 (file)
@@ -11,7 +11,7 @@ Press Shift + left arrow to select the previous character:
 PASS window.getSelection().toString() is "Her"
 
 Press Shift + Option + right arrow to select to the end of the word:
-PASS window.getSelection().toString() is "Here's"
+PASS window.getSelection().toString() is "Here's "
 
 Press Shift + Option + left arrow to select to the beginning of the word:
 PASS window.getSelection().toString() is "The"
index 7d03e54..e14810a 100644 (file)
@@ -49,7 +49,7 @@ async function testExtendSelectionToEndOfWord()
 
     debug("<br>Press Shift + Option + right arrow to select to the end of the word:");
     await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("rightArrow", ["shiftKey", "altKey"]) , document, "selectionchange");
-    shouldBeEqualToString("window.getSelection().toString()", "Here's");
+    shouldBeEqualToString("window.getSelection().toString()", "Here's ");
 }
 
 async function testExtendSelectionToBeginningOfWord()
@@ -79,13 +79,6 @@ async function testExtendSelectionToBeginningOfLine()
     shouldBeEqualToString("window.getSelection().toString()", "The misfits.");
 }
 
-async function waitForSecondaryPresentationUpdateIfNeeded()
-{
-    // There might be a secondary selectionchange event after moving by paragraph boundary. See webkit.org/b/199851
-    if (window.testRunner)
-        await UIHelper.ensurePresentationUpdate();
-}
-
 async function testExtendSelectionUp()
 {
     await UIHelper.callFunctionAndWaitForEvent(() => selection.setBaseAndExtent(paragraphs[1].firstChild, 1, paragraphs[1].firstChild, 0), document, "selectionchange");
@@ -93,7 +86,6 @@ async function testExtendSelectionUp()
     debug("<br>Press Shift + up arrow to select up:");
     await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("upArrow", ["shiftKey"]) , document, "selectionchange");
     shouldBeEqualToString("window.getSelection().toString()", "Here's to the crazy ones.\n\nT");
-    await waitForSecondaryPresentationUpdateIfNeeded();
 }
 
 async function testExtendSelectionDown()
@@ -103,7 +95,6 @@ async function testExtendSelectionDown()
     debug("<br>Press Shift + down arrow to select down:");
     await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("downArrow", ["shiftKey"]) , document, "selectionchange");
     shouldBeEqualToString("window.getSelection().toString()", "The misfits.\n\nT");
-    await waitForSecondaryPresentationUpdateIfNeeded();
 }
 
 async function testExtendSelectionToEndOfParagraph()
@@ -116,8 +107,6 @@ async function testExtendSelectionToEndOfParagraph()
     await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("downArrow", ["shiftKey", "altKey"]) , document, "selectionchange");
     shouldBeEqualToString("window.getSelection().toString()", "Here's to the crazy ones.");
 
-    await waitForSecondaryPresentationUpdateIfNeeded();
-
     toggleOnlyShowTestContainer();
 }
 
@@ -129,11 +118,8 @@ async function testExtendSelectionToBeginningOfParagraph()
 
     debug("<br>Press Shift + Option + up arrow to select to the beginning of the paragraph:");
     await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("upArrow", ["shiftKey", "altKey"]) , document, "selectionchange");
-
     shouldBeEqualToString("window.getSelection().toString()", "The rebels.");
 
-    await waitForSecondaryPresentationUpdateIfNeeded();
-
     toggleOnlyShowTestContainer();
 }
 
@@ -147,8 +133,6 @@ async function testExtendSelectionToEndOfDocument()
     await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("downArrow", ["shiftKey", "ctrlKey"]) , document, "selectionchange");
     shouldBeEqualToString("window.getSelection().toString()", "Here's to the crazy ones.\n\nThe misfits.\n\nThe rebels.");
 
-    await waitForSecondaryPresentationUpdateIfNeeded();
-
     toggleOnlyShowTestContainer();
 }
 
@@ -162,8 +146,6 @@ async function testExtendSelectionToBeginningOfDocument()
     await UIHelper.callFunctionAndWaitForEvent(() => window.testRunner && UIHelper.keyDown("upArrow", ["shiftKey", "ctrlKey"]) , document, "selectionchange");
     shouldBeEqualToString("window.getSelection().toString()", "Here's to the crazy ones.\n\nThe misfits.");
 
-    await waitForSecondaryPresentationUpdateIfNeeded();
-
     toggleOnlyShowTestContainer();
 }
 
index b8b1b0f..19fa86f 100644 (file)
@@ -1,3 +1,16 @@
+2019-09-13  Russell Epstein  <repstein@apple.com>
+
+        Unreviewed, rolling out r249709.
+
+        Layout test added in this patch has been consistently failing
+        since it landed.
+
+        Reverted changeset:
+
+        "Option + arrow moves caret past whitespace on iOS"
+        https://bugs.webkit.org/show_bug.cgi?id=201575
+        https://trac.webkit.org/changeset/249709
+
 2019-09-13  Zalan Bujtas  <zalan@apple.com>
 
         [LFC] Rename FormattingContext::layout to layoutInFlowContent()
index 9fe4814..74fa64b 100644 (file)
@@ -711,26 +711,20 @@ VisiblePosition FrameSelection::endForPlatform() const
     return positionForPlatform(false);
 }
 
-static NextWordModeInIOS nextWordWhitespaceModeInIOS(EUserTriggered userTriggered)
+VisiblePosition FrameSelection::nextWordPositionForPlatform(const VisiblePosition &originalPosition)
 {
-    return userTriggered == UserTriggered ? NextWordModeInIOS::StopAfterWord : NextWordModeInIOS::LegacyStopBeforeWord;
-}
-
-VisiblePosition FrameSelection::nextWordPositionForPlatform(const VisiblePosition &originalPosition, EUserTriggered userTriggered)
-{
-    VisiblePosition positionAfterCurrentWord = nextWordPosition(originalPosition, nextWordWhitespaceModeInIOS(userTriggered));
+    VisiblePosition positionAfterCurrentWord = nextWordPosition(originalPosition);
 
     if (m_frame && m_frame->editor().behavior().shouldSkipSpaceWhenMovingRight()) {
         // In order to skip spaces when moving right, we advance one
         // word further and then move one word back. Given the
         // semantics of previousWordPosition() this will put us at the
         // beginning of the word following.
-        auto whitespaceMode = nextWordWhitespaceModeInIOS(userTriggered);
-        VisiblePosition positionAfterSpacingAndFollowingWord = nextWordPosition(positionAfterCurrentWord, whitespaceMode);
+        VisiblePosition positionAfterSpacingAndFollowingWord = nextWordPosition(positionAfterCurrentWord);
         if (positionAfterSpacingAndFollowingWord != positionAfterCurrentWord)
-            positionAfterCurrentWord = previousWordPosition(positionAfterSpacingAndFollowingWord, whitespaceMode);
+            positionAfterCurrentWord = previousWordPosition(positionAfterSpacingAndFollowingWord);
 
-        bool movingBackwardsMovedPositionToStartOfCurrentWord = positionAfterCurrentWord == previousWordPosition(nextWordPosition(originalPosition, whitespaceMode), whitespaceMode);
+        bool movingBackwardsMovedPositionToStartOfCurrentWord = positionAfterCurrentWord == previousWordPosition(nextWordPosition(originalPosition));
         if (movingBackwardsMovedPositionToStartOfCurrentWord)
             positionAfterCurrentWord = positionAfterSpacingAndFollowingWord;
     }
@@ -745,7 +739,7 @@ static void adjustPositionForUserSelectAll(VisiblePosition& pos, bool isForward)
 }
 #endif
 
-VisiblePosition FrameSelection::modifyExtendingRight(TextGranularity granularity, EUserTriggered userTriggered)
+VisiblePosition FrameSelection::modifyExtendingRight(TextGranularity granularity)
 {
     VisiblePosition pos(m_selection.extent(), m_selection.affinity());
 
@@ -763,15 +757,15 @@ VisiblePosition FrameSelection::modifyExtendingRight(TextGranularity granularity
         break;
     case WordGranularity:
         if (directionOfEnclosingBlock() == TextDirection::LTR)
-            pos = nextWordPositionForPlatform(pos, userTriggered);
+            pos = nextWordPositionForPlatform(pos);
         else
-            pos = previousWordPosition(pos, nextWordWhitespaceModeInIOS(userTriggered));
+            pos = previousWordPosition(pos);
         break;
     case LineBoundary:
         if (directionOfEnclosingBlock() == TextDirection::LTR)
-            pos = modifyExtendingForward(granularity, userTriggered);
+            pos = modifyExtendingForward(granularity);
         else
-            pos = modifyExtendingBackward(granularity, userTriggered);
+            pos = modifyExtendingBackward(granularity);
         break;
     case SentenceGranularity:
     case LineGranularity:
@@ -780,7 +774,7 @@ VisiblePosition FrameSelection::modifyExtendingRight(TextGranularity granularity
     case ParagraphBoundary:
     case DocumentBoundary:
         // FIXME: implement all of the above?
-        pos = modifyExtendingForward(granularity, userTriggered);
+        pos = modifyExtendingForward(granularity);
         break;
     case DocumentGranularity:
         ASSERT_NOT_REACHED();
@@ -792,7 +786,7 @@ VisiblePosition FrameSelection::modifyExtendingRight(TextGranularity granularity
     return pos;
 }
 
-VisiblePosition FrameSelection::modifyExtendingForward(TextGranularity granularity, EUserTriggered userTriggered)
+VisiblePosition FrameSelection::modifyExtendingForward(TextGranularity granularity)
 {
     VisiblePosition pos(m_selection.extent(), m_selection.affinity());
     switch (granularity) {
@@ -800,7 +794,7 @@ VisiblePosition FrameSelection::modifyExtendingForward(TextGranularity granulari
         pos = pos.next(CannotCrossEditingBoundary);
         break;
     case WordGranularity:
-        pos = nextWordPositionForPlatform(pos, userTriggered);
+        pos = nextWordPositionForPlatform(pos);
         break;
     case SentenceGranularity:
         pos = nextSentencePosition(pos);
@@ -837,7 +831,7 @@ VisiblePosition FrameSelection::modifyExtendingForward(TextGranularity granulari
     return pos;
 }
 
-VisiblePosition FrameSelection::modifyMovingRight(TextGranularity granularity, EUserTriggered userTriggered, bool* reachedBoundary)
+VisiblePosition FrameSelection::modifyMovingRight(TextGranularity granularity, bool* reachedBoundary)
 {
     if (reachedBoundary)
         *reachedBoundary = false;
@@ -867,7 +861,7 @@ VisiblePosition FrameSelection::modifyMovingRight(TextGranularity granularity, E
     case ParagraphBoundary:
     case DocumentBoundary:
         // FIXME: Implement all of the above.
-        pos = modifyMovingForward(granularity, userTriggered, reachedBoundary);
+        pos = modifyMovingForward(granularity, reachedBoundary);
         break;
     case LineBoundary:
         pos = rightBoundaryOfLine(startForPlatform(), directionOfEnclosingBlock(), reachedBoundary);
@@ -879,7 +873,7 @@ VisiblePosition FrameSelection::modifyMovingRight(TextGranularity granularity, E
     return pos;
 }
 
-VisiblePosition FrameSelection::modifyMovingForward(TextGranularity granularity, EUserTriggered userTriggered, bool* reachedBoundary)
+VisiblePosition FrameSelection::modifyMovingForward(TextGranularity granularity, bool* reachedBoundary)
 {
     if (reachedBoundary)
         *reachedBoundary = false;
@@ -909,7 +903,7 @@ VisiblePosition FrameSelection::modifyMovingForward(TextGranularity granularity,
             pos = VisiblePosition(m_selection.extent(), m_selection.affinity()).next(CannotCrossEditingBoundary, reachedBoundary);
         break;
     case WordGranularity:
-        pos = nextWordPositionForPlatform(currentPosition, userTriggered);
+        pos = nextWordPositionForPlatform(currentPosition);
         break;
     case SentenceGranularity:
         pos = nextSentencePosition(currentPosition);
@@ -962,7 +956,7 @@ VisiblePosition FrameSelection::modifyMovingForward(TextGranularity granularity,
     return pos;
 }
 
-VisiblePosition FrameSelection::modifyExtendingLeft(TextGranularity granularity, EUserTriggered userTriggered)
+VisiblePosition FrameSelection::modifyExtendingLeft(TextGranularity granularity)
 {
     VisiblePosition pos(m_selection.extent(), m_selection.affinity());
 
@@ -980,15 +974,15 @@ VisiblePosition FrameSelection::modifyExtendingLeft(TextGranularity granularity,
         break;
     case WordGranularity:
         if (directionOfEnclosingBlock() == TextDirection::LTR)
-            pos = previousWordPosition(pos, nextWordWhitespaceModeInIOS(userTriggered));
+            pos = previousWordPosition(pos);
         else
-            pos = nextWordPositionForPlatform(pos, userTriggered);
+            pos = nextWordPositionForPlatform(pos);
         break;
     case LineBoundary:
         if (directionOfEnclosingBlock() == TextDirection::LTR)
-            pos = modifyExtendingBackward(granularity, userTriggered);
+            pos = modifyExtendingBackward(granularity);
         else
-            pos = modifyExtendingForward(granularity, userTriggered);
+            pos = modifyExtendingForward(granularity);
         break;
     case SentenceGranularity:
     case LineGranularity:
@@ -996,7 +990,7 @@ VisiblePosition FrameSelection::modifyExtendingLeft(TextGranularity granularity,
     case SentenceBoundary:
     case ParagraphBoundary:
     case DocumentBoundary:
-        pos = modifyExtendingBackward(granularity, userTriggered);
+        pos = modifyExtendingBackward(granularity);
         break;
     case DocumentGranularity:
         ASSERT_NOT_REACHED();
@@ -1008,7 +1002,7 @@ VisiblePosition FrameSelection::modifyExtendingLeft(TextGranularity granularity,
     return pos;
 }
        
-VisiblePosition FrameSelection::modifyExtendingBackward(TextGranularity granularity, EUserTriggered userTriggered)
+VisiblePosition FrameSelection::modifyExtendingBackward(TextGranularity granularity)
 {
     VisiblePosition pos(m_selection.extent(), m_selection.affinity());
 
@@ -1021,7 +1015,7 @@ VisiblePosition FrameSelection::modifyExtendingBackward(TextGranularity granular
         pos = pos.previous(CannotCrossEditingBoundary);
         break;
     case WordGranularity:
-        pos = previousWordPosition(pos, nextWordWhitespaceModeInIOS(userTriggered));
+        pos = previousWordPosition(pos);
         break;
     case SentenceGranularity:
         pos = previousSentencePosition(pos);
@@ -1058,7 +1052,7 @@ VisiblePosition FrameSelection::modifyExtendingBackward(TextGranularity granular
     return pos;
 }
 
-VisiblePosition FrameSelection::modifyMovingLeft(TextGranularity granularity, EUserTriggered userTriggered, bool* reachedBoundary)
+VisiblePosition FrameSelection::modifyMovingLeft(TextGranularity granularity, bool* reachedBoundary)
 {
     if (reachedBoundary)
         *reachedBoundary = false;
@@ -1088,7 +1082,7 @@ VisiblePosition FrameSelection::modifyMovingLeft(TextGranularity granularity, EU
     case ParagraphBoundary:
     case DocumentBoundary:
         // FIXME: Implement all of the above.
-        pos = modifyMovingBackward(granularity, userTriggered, reachedBoundary);
+        pos = modifyMovingBackward(granularity, reachedBoundary);
         break;
     case LineBoundary:
         pos = leftBoundaryOfLine(startForPlatform(), directionOfEnclosingBlock(), reachedBoundary);
@@ -1100,7 +1094,7 @@ VisiblePosition FrameSelection::modifyMovingLeft(TextGranularity granularity, EU
     return pos;
 }
 
-VisiblePosition FrameSelection::modifyMovingBackward(TextGranularity granularity, EUserTriggered userTriggered, bool* reachedBoundary)
+VisiblePosition FrameSelection::modifyMovingBackward(TextGranularity granularity, bool* reachedBoundary)
 {
     if (reachedBoundary)
         *reachedBoundary = false;
@@ -1129,7 +1123,7 @@ VisiblePosition FrameSelection::modifyMovingBackward(TextGranularity granularity
             pos = VisiblePosition(m_selection.extent(), m_selection.affinity()).previous(CannotCrossEditingBoundary, reachedBoundary);
         break;
     case WordGranularity:
-        pos = previousWordPosition(currentPosition, nextWordWhitespaceModeInIOS(userTriggered));
+        pos = previousWordPosition(currentPosition);
         break;
     case SentenceGranularity:
         pos = previousSentencePosition(currentPosition);
@@ -1336,27 +1330,27 @@ bool FrameSelection::modify(EAlteration alter, SelectionDirection direction, Tex
     switch (direction) {
     case DirectionRight:
         if (alter == AlterationMove)
-            position = modifyMovingRight(granularity, userTriggered, &reachedBoundary);
+            position = modifyMovingRight(granularity, &reachedBoundary);
         else
-            position = modifyExtendingRight(granularity, userTriggered);
+            position = modifyExtendingRight(granularity);
         break;
     case DirectionForward:
         if (alter == AlterationExtend)
-            position = modifyExtendingForward(granularity, userTriggered);
+            position = modifyExtendingForward(granularity);
         else
-            position = modifyMovingForward(granularity, userTriggered, &reachedBoundary);
+            position = modifyMovingForward(granularity, &reachedBoundary);
         break;
     case DirectionLeft:
         if (alter == AlterationMove)
-            position = modifyMovingLeft(granularity, userTriggered, &reachedBoundary);
+            position = modifyMovingLeft(granularity, &reachedBoundary);
         else
-            position = modifyExtendingLeft(granularity, userTriggered);
+            position = modifyExtendingLeft(granularity);
         break;
     case DirectionBackward:
         if (alter == AlterationExtend)
-            position = modifyExtendingBackward(granularity, userTriggered);
+            position = modifyExtendingBackward(granularity);
         else
-            position = modifyMovingBackward(granularity, userTriggered, &reachedBoundary);
+            position = modifyMovingBackward(granularity, &reachedBoundary);
         break;
     }
 
@@ -2151,7 +2145,7 @@ void FrameSelection::updateAppearance()
     // Construct a new VisibleSolution, since m_selection is not necessarily valid, and the following steps
     // assume a valid selection. See <https://bugs.webkit.org/show_bug.cgi?id=69563> and <rdar://problem/10232866>.
 #if ENABLE(TEXT_CARET)
-    VisiblePosition endVisiblePosition = paintBlockCursor ? modifyExtendingForward(CharacterGranularity, NotUserTriggered) : oldSelection.visibleEnd();
+    VisiblePosition endVisiblePosition = paintBlockCursor ? modifyExtendingForward(CharacterGranularity) : oldSelection.visibleEnd();
     VisibleSelection selection(oldSelection.visibleStart(), endVisiblePosition);
 #else
     VisibleSelection selection(oldSelection.visibleStart(), oldSelection.visibleEnd());
index af595ef..4484afa 100644 (file)
@@ -299,16 +299,16 @@ private:
     VisiblePosition positionForPlatform(bool isGetStart) const;
     VisiblePosition startForPlatform() const;
     VisiblePosition endForPlatform() const;
-    VisiblePosition nextWordPositionForPlatform(const VisiblePosition&, EUserTriggered);
-
-    VisiblePosition modifyExtendingRight(TextGranularity, EUserTriggered);
-    VisiblePosition modifyExtendingForward(TextGranularity, EUserTriggered);
-    VisiblePosition modifyMovingRight(TextGranularity, EUserTriggered, bool* reachedBoundary = nullptr);
-    VisiblePosition modifyMovingForward(TextGranularity, EUserTriggered, bool* reachedBoundary = nullptr);
-    VisiblePosition modifyExtendingLeft(TextGranularity, EUserTriggered);
-    VisiblePosition modifyExtendingBackward(TextGranularity, EUserTriggered);
-    VisiblePosition modifyMovingLeft(TextGranularity, EUserTriggered, bool* reachedBoundary = nullptr);
-    VisiblePosition modifyMovingBackward(TextGranularity, EUserTriggered, bool* reachedBoundary = nullptr);
+    VisiblePosition nextWordPositionForPlatform(const VisiblePosition&);
+
+    VisiblePosition modifyExtendingRight(TextGranularity);
+    VisiblePosition modifyExtendingForward(TextGranularity);
+    VisiblePosition modifyMovingRight(TextGranularity, bool* reachedBoundary = nullptr);
+    VisiblePosition modifyMovingForward(TextGranularity, bool* reachedBoundary = nullptr);
+    VisiblePosition modifyExtendingLeft(TextGranularity);
+    VisiblePosition modifyExtendingBackward(TextGranularity);
+    VisiblePosition modifyMovingLeft(TextGranularity, bool* reachedBoundary = nullptr);
+    VisiblePosition modifyMovingBackward(TextGranularity, bool* reachedBoundary = nullptr);
 
     LayoutUnit lineDirectionPointForBlockDirectionNavigation(EPositionType);
 
index 871fb64..a1a3903 100644 (file)
@@ -2335,7 +2335,7 @@ inline bool SearchBuffer::isWordStartMatch(size_t start, size_t length) const
 
     size_t wordBreakSearchStart = start + length;
     while (wordBreakSearchStart > start)
-        wordBreakSearchStart = findNextWordFromIndex(StringView(m_buffer.data(), m_buffer.size()), wordBreakSearchStart, NextWordDirection::Backward);
+        wordBreakSearchStart = findNextWordFromIndex(StringView(m_buffer.data(), m_buffer.size()), wordBreakSearchStart, false /* backwards */);
     return wordBreakSearchStart == start;
 }
 
index 4947893..5399b08 100644 (file)
@@ -761,7 +761,6 @@ VisiblePosition endOfWord(const VisiblePosition& c, EWordSide side)
     return nextBoundary(p, endWordBoundary);
 }
 
-template <NextWordModeInIOS nextWordModeInIOS>
 static unsigned previousWordPositionBoundary(StringView text, unsigned offset, BoundarySearchContextAvailability mayHaveMoreContext, bool& needMoreContext)
 {
     if (mayHaveMoreContext && !startOfLastWordBoundaryContext(text.substring(0, offset))) {
@@ -769,17 +768,14 @@ static unsigned previousWordPositionBoundary(StringView text, unsigned offset, B
         return 0;
     }
     needMoreContext = false;
-    return findNextWordFromIndex(text, offset, NextWordDirection::Backward, nextWordModeInIOS);
+    return findNextWordFromIndex(text, offset, false);
 }
 
-VisiblePosition previousWordPosition(const VisiblePosition& position, NextWordModeInIOS nextWordModeInIOS)
+VisiblePosition previousWordPosition(const VisiblePosition& position)
 {
-    if (nextWordModeInIOS == NextWordModeInIOS::LegacyStopBeforeWord) // FIXME: Remove this code path.
-        return position.honorEditingBoundaryAtOrBefore(previousBoundary(position, previousWordPositionBoundary<NextWordModeInIOS::LegacyStopBeforeWord>));
-    return position.honorEditingBoundaryAtOrBefore(previousBoundary(position, previousWordPositionBoundary<NextWordModeInIOS::StopAfterWord>));
+    return position.honorEditingBoundaryAtOrBefore(previousBoundary(position, previousWordPositionBoundary));
 }
 
-template <NextWordModeInIOS nextWordModeInIOS>
 static unsigned nextWordPositionBoundary(StringView text, unsigned offset, BoundarySearchContextAvailability mayHaveMoreContext, bool& needMoreContext)
 {
     if (mayHaveMoreContext && endOfFirstWordBoundaryContext(text.substring(offset)) == text.length() - offset) {
@@ -787,14 +783,12 @@ static unsigned nextWordPositionBoundary(StringView text, unsigned offset, Bound
         return text.length();
     }
     needMoreContext = false;
-    return findNextWordFromIndex(text, offset, NextWordDirection::Forward, nextWordModeInIOS);
+    return findNextWordFromIndex(text, offset, true);
 }
 
-VisiblePosition nextWordPosition(const VisiblePosition& position, NextWordModeInIOS nextWordModeInIOS)
+VisiblePosition nextWordPosition(const VisiblePosition& position)
 {
-    if (nextWordModeInIOS == NextWordModeInIOS::LegacyStopBeforeWord) // FIXME: Remove this code path.
-        return position.honorEditingBoundaryAtOrAfter(nextBoundary(position, nextWordPositionBoundary<NextWordModeInIOS::LegacyStopBeforeWord>));
-    return position.honorEditingBoundaryAtOrAfter(nextBoundary(position, nextWordPositionBoundary<NextWordModeInIOS::StopAfterWord>));
+    return position.honorEditingBoundaryAtOrAfter(nextBoundary(position, nextWordPositionBoundary));
 }
 
 bool isStartOfWord(const VisiblePosition& p)
index d085c12..6717eb1 100644 (file)
@@ -26,7 +26,6 @@
 #pragma once
 
 #include "EditingBoundary.h"
-#include "TextBoundaries.h"
 #include "VisibleSelection.h"
 
 namespace WebCore {
@@ -41,8 +40,8 @@ enum EWordSide { RightWordIfOnBoundary = false, LeftWordIfOnBoundary = true };
 // words
 WEBCORE_EXPORT VisiblePosition startOfWord(const VisiblePosition &, EWordSide = RightWordIfOnBoundary);
 WEBCORE_EXPORT VisiblePosition endOfWord(const VisiblePosition &, EWordSide = RightWordIfOnBoundary);
-WEBCORE_EXPORT VisiblePosition previousWordPosition(const VisiblePosition&, NextWordModeInIOS = NextWordModeInIOS::LegacyStopBeforeWord);
-WEBCORE_EXPORT VisiblePosition nextWordPosition(const VisiblePosition&, NextWordModeInIOS = NextWordModeInIOS::LegacyStopBeforeWord);
+WEBCORE_EXPORT VisiblePosition previousWordPosition(const VisiblePosition &);
+WEBCORE_EXPORT VisiblePosition nextWordPosition(const VisiblePosition &);
 VisiblePosition rightWordPosition(const VisiblePosition&, bool skipsSpaceWhenMovingRight);
 VisiblePosition leftWordPosition(const VisiblePosition&, bool skipsSpaceWhenMovingRight);
 bool isStartOfWord(const VisiblePosition&);
index 2a38d4f..e780ff6 100644 (file)
@@ -61,11 +61,11 @@ unsigned startOfLastWordBoundaryContext(StringView text)
 
 #if !PLATFORM(COCOA)
 
-int findNextWordFromIndex(StringView text, int position, NextWordDirection direction, NextWordModeInIOS)
+int findNextWordFromIndex(StringView text, int position, bool forward)
 {
     UBreakIterator* it = wordBreakIterator(text);
 
-    if (direction == NextWordDirection::Forward) {
+    if (forward) {
         position = ubrk_following(it, position);
         while (position != UBRK_DONE) {
             // We stop searching when the character preceeding the break is alphanumeric.
index 952b536..9a873af 100644 (file)
@@ -47,10 +47,7 @@ namespace WebCore {
 
     void findWordBoundary(StringView, int position, int* start, int* end);
     void findEndWordBoundary(StringView, int position, int* end);
-
-    enum class NextWordDirection : bool { Forward, Backward };
-    enum class NextWordModeInIOS : bool { LegacyStopBeforeWord, StopAfterWord };
-    int findNextWordFromIndex(StringView, int position, NextWordDirection, NextWordModeInIOS = NextWordModeInIOS::LegacyStopBeforeWord);
+    int findNextWordFromIndex(StringView, int position, bool forward);
 
 }
 
index 942b3a6..4090b66 100644 (file)
@@ -229,12 +229,11 @@ void findEndWordBoundary(StringView text, int position, int* end)
     findWordBoundary(text, position, &start, end);
 }
 
-int findNextWordFromIndex(StringView text, int position, NextWordDirection direction, NextWordModeInIOS whitespaceModeInIOS)
+int findNextWordFromIndex(StringView text, int position, bool forward)
 {   
 #if USE(APPKIT)
-    UNUSED_PARAM(whitespaceModeInIOS);
     NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:text.createNSStringWithoutCopying().get()];
-    int result = [attributedString nextWordFromIndex:position forward:direction == NextWordDirection::Forward];
+    int result = [attributedString nextWordFromIndex:position forward:forward];
     [attributedString release];
     return result;
 #else
@@ -244,31 +243,14 @@ int findNextWordFromIndex(StringView text, int position, NextWordDirection direc
     int pos = position;
     UBreakIterator* boundary = wordBreakIterator(text);
     if (boundary) {
-        if (direction == NextWordDirection::Forward) {
-            if (whitespaceModeInIOS == NextWordModeInIOS::StopAfterWord) {
-                while (static_cast<unsigned>(pos) < text.length() && isWordDelimitingCharacter(text[pos])) {
-                    pos = ubrk_following(boundary, pos);
-                    if (pos == UBRK_DONE)
-                        return text.length();
-                }
-            }
+        if (forward) {
             do {
                 pos = ubrk_following(boundary, pos);
                 if (pos == UBRK_DONE)
-                    return text.length();
+                    pos = text.length();
             } while (static_cast<unsigned>(pos) < text.length() && (pos == 0 || !isSkipCharacter(text[pos - 1])) && isSkipCharacter(text[pos]));
-
-            // ICU would skip the trailing whitespace. Go back.
-            if (whitespaceModeInIOS == NextWordModeInIOS::StopAfterWord && isWordDelimitingCharacter(text[pos - 1]))
-                pos = ubrk_preceding(boundary, pos);
         }
         else {
-            if (whitespaceModeInIOS == NextWordModeInIOS::StopAfterWord && pos && isWordDelimitingCharacter(text[pos - 1])) {
-                pos = ubrk_preceding(boundary, pos);
-                if (pos == UBRK_DONE)
-                    return 0;
-            }
-
             do {
                 pos = ubrk_preceding(boundary, pos);
                 if (pos == UBRK_DONE)