Bug 907881 - Update normal cursor position when moving beyond its bounds in TopSitesCursorWrapper. r=wesj
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Fri, 23 Aug 2013 13:09:24 -0700
changeset 144079 1a8030bb148e6b8ed0d8b99de8cc415540e54caf
parent 144078 69ef645c0690c46871c2027bc78f309d37f00d82
child 144080 39301b836507f0aa3d63a9e9e40c728239341c69
push id2335
push usermleibovic@mozilla.com
push dateFri, 23 Aug 2013 20:09:42 +0000
treeherderfx-team@1a8030bb148e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswesj
bugs907881
milestone26.0a1
Bug 907881 - Update normal cursor position when moving beyond its bounds in TopSitesCursorWrapper. r=wesj
mobile/android/base/db/BrowserDB.java
--- a/mobile/android/base/db/BrowserDB.java
+++ b/mobile/android/base/db/BrowserDB.java
@@ -402,21 +402,26 @@ public class BrowserDB {
         public boolean moveToNext() { return moveToPosition(mIndex + 1); }
         @Override
         public boolean moveToPrevious() { return moveToPosition(mIndex - 1); }
 
         @Override
         public boolean moveToPosition(int position) {
             mIndex = position;
 
-            // move the real cursor as  if we were stepping through it to this position
-            // be careful not to move it to far, and to account for any pinned sites
+            // Move the real cursor as if we were stepping through it to this position.
+            // Account for pinned sites, and be careful to update its position to the
+            // minimum or maximum position, even if we're moving beyond its bounds.
             int before = getPinnedBefore(position);
             int p2 = position - before;
-            if (p2 >= -1 && p2 <= mCursor.getCount()) {
+            if (p2 <= -1) {
+                super.moveToPosition(-1);
+            } else if (p2 >= mCursor.getCount()) {
+                super.moveToPosition(mCursor.getCount());
+            } else {
                 super.moveToPosition(p2);
             }
 
             return !(isBeforeFirst() || isAfterLast());
         }
 
         @Override
         public long getLong(int columnIndex) {