Bug 1153237 - nsFrameSelection::PhysicalMove should fall back to CompleteMove if an intra-line move fails to execute completely. r=roc a=ritu
authorJonathan Kew <jkew@mozilla.com>
Mon, 04 Jan 2016 12:33:45 +0000
changeset 312569 7366d77f97e91136bd1f05bdf86fc5327e03b4ed
parent 312568 aa83b5c4359889ea26e3545dd9ef891b17629e64
child 312570 9ef49ec1f925eeea8bbb2058e9a1dfb05e75476c
push id1040
push userraliiev@mozilla.com
push dateMon, 29 Feb 2016 17:11:22 +0000
treeherdermozilla-release@8c3167321162 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, ritu
bugs1153237
milestone45.0a2
Bug 1153237 - nsFrameSelection::PhysicalMove should fall back to CompleteMove if an intra-line move fails to execute completely. r=roc a=ritu
layout/generic/nsSelection.cpp
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -2145,16 +2145,24 @@ 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);
+      }
+    }
   }
 
   return rv;
 }
 
 nsresult
 nsFrameSelection::CharacterMove(bool aForward, bool aExtend)
 {