Bug 614606 - Find in Page does not scroll down when hitting the previous button the first time [r=mfinkle]
authorVivien Nicolas <21@vingtetun.org>
Thu, 09 Dec 2010 10:08:12 -0500
changeset 67084 6d02cd1d0496f358f0f8bdc5af7fd94daffc3af2
parent 67083 483195a099aec0bdc1d10bb2d6f60fd96bf8b53c
child 67085 ee4f128c02c88aed6b209ff85e27a0a6d5d8a908
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs614606
Bug 614606 - Find in Page does not scroll down when hitting the previous button the first time [r=mfinkle]
mobile/chrome/content/content.js
--- a/mobile/chrome/content/content.js
+++ b/mobile/chrome/content/content.js
@@ -910,24 +910,24 @@ var FindHandler = {
     }
 
     if (findResult == Ci.nsITypeAheadFind.FIND_NOTFOUND) {
       sendAsyncMessage("FindAssist:Show", { rect: null , result: findResult });
       return;
     }
 
     let selection = this._fastFind.currentWindow.getSelection();
-    if (!selection.rangeCount) {
+    if (!selection.rangeCount || selection.isCollapsed) {
       // The selection can be into an input or a textarea element
       let nodes = content.document.querySelectorAll("input[type='text'], textarea");
       for (let i = 0; i < nodes.length; i++) {
         let node = nodes[i];
         if (node instanceof Ci.nsIDOMNSEditableElement && node.editor) {
           selection = node.editor.selectionController.getSelection(Ci.nsISelectionController.SELECTION_NORMAL);
-          if (selection.rangeCount)
+          if (selection.rangeCount && !selection.isCollapsed)
             break;
         }
       }
     }
 
     let scroll = Util.getScrollOffset(content);
     for (let frame = this._fastFind.currentWindow; frame != content; frame = frame.parent) {
       let rect = frame.frameElement.getBoundingClientRect();