Bug 1248128 - The fallback caret-move handling from bug 1153237 should be more selective to avoid undesired side-effects. r=roc
authorJonathan Kew <jkew@mozilla.com>
Wed, 17 Feb 2016 12:05:10 +0000
changeset 322824 12fb5bc313d7d9ffaf570db7238c95d4f0ed873b
parent 322823 4d75bd6fd234c402084b1683034dd1b71adec555
child 322825 c44734ba6500fca79424cf1f2d397162bbb55127
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1248128, 1153237
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1248128 - The fallback caret-move handling from bug 1153237 should be more selective to avoid undesired side-effects. r=roc
layout/generic/nsSelection.cpp
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -2139,23 +2139,22 @@ nsFrameSelection::PhysicalMove(int16_t a
                           eVisual);
   if (NS_FAILED(rv)) {
     // If we tried to do a line move, but couldn't move in the given direction,
     // then we'll "promote" this to a line-edge move instead.
     if (mapping.amounts[aAmount] == eSelectLine) {
       rv = MoveCaret(mapping.direction, aExtend, mapping.amounts[aAmount + 1],
                      eVisual);
     }
-    // And if it was an intra-line move that failed, just move to line-edge
-    // in the given direction.
-    else if (mapping.amounts[aAmount] < eSelectLine) {
-      nsCOMPtr<nsISelectionController> controller = do_QueryInterface(mShell);
-      if (controller) {
-        rv = controller->CompleteMove(mapping.direction == eDirNext, aExtend);
-      }
+    // And if it was a next-word move that failed (which can happen when
+    // eat_space_to_next_word is true, see bug 1153237), then just move forward
+    // to the line-edge.
+    else if (mapping.amounts[aAmount] == eSelectWord &&
+             mapping.direction == eDirNext) {
+      rv = MoveCaret(eDirNext, aExtend, eSelectEndLine, eVisual);
     }
   }
 
   return rv;
 }
 
 nsresult
 nsFrameSelection::CharacterMove(bool aForward, bool aExtend)