Bug 907881 - Update normal cursor position when moving beyond its bounds in TopSitesCursorWrapper. r=wesj

This commit is contained in:
Margaret Leibovic 2013-08-23 13:09:24 -07:00
parent e43a59734a
commit ed14d537ac

View File

@ -407,11 +407,16 @@ public class BrowserDB {
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);
}