mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 996657 - Factor out code to check valid cursor positions (r=wesj)
This commit is contained in:
parent
668197dc1b
commit
fa4f791d3f
@ -125,11 +125,15 @@ public class TopSitesCursorWrapper implements Cursor {
|
||||
count = Math.max(minSize, pinnedCursor.getCount() + topCursor.getCount());
|
||||
}
|
||||
|
||||
private static boolean cursorHasValidPosition(Cursor c) {
|
||||
return (!c.isBeforeFirst() && !c.isAfterLast());
|
||||
}
|
||||
|
||||
private void updateRowState() {
|
||||
if (!pinnedCursor.isBeforeFirst() && !pinnedCursor.isAfterLast()) {
|
||||
if (cursorHasValidPosition(pinnedCursor)) {
|
||||
currentRowType = RowType.PINNED;
|
||||
currentCursor = pinnedCursor;
|
||||
} else if (!topCursor.isBeforeFirst() && !topCursor.isAfterLast()) {
|
||||
} else if (cursorHasValidPosition(topCursor)) {
|
||||
currentRowType = RowType.TOP;
|
||||
currentCursor = topCursor;
|
||||
} else if (currentPosition >= 0 && currentPosition < minSize) {
|
||||
@ -274,7 +278,7 @@ public class TopSitesCursorWrapper implements Cursor {
|
||||
updateTopCursorPosition(position);
|
||||
updateRowState();
|
||||
|
||||
return (!isBeforeFirst() && !isAfterLast());
|
||||
return cursorHasValidPosition(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user