mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 976426 - Update progress on LOCATION_CHANGE and LOADED only if tab is loading. r=lucasr
This commit is contained in:
parent
f016a787f6
commit
316891bb1b
@ -67,7 +67,7 @@ public class Tab {
|
|||||||
private Context mAppContext;
|
private Context mAppContext;
|
||||||
private ErrorType mErrorType = ErrorType.NONE;
|
private ErrorType mErrorType = ErrorType.NONE;
|
||||||
private static final int MAX_HISTORY_LIST_SIZE = 50;
|
private static final int MAX_HISTORY_LIST_SIZE = 50;
|
||||||
private int mLoadProgress;
|
private volatile int mLoadProgress;
|
||||||
|
|
||||||
public static final int STATE_DELAYED = 0;
|
public static final int STATE_DELAYED = 0;
|
||||||
public static final int STATE_LOADING = 1;
|
public static final int STATE_LOADING = 1;
|
||||||
@ -635,7 +635,7 @@ public class Tab {
|
|||||||
setHasTouchListeners(false);
|
setHasTouchListeners(false);
|
||||||
setBackgroundColor(DEFAULT_BACKGROUND_COLOR);
|
setBackgroundColor(DEFAULT_BACKGROUND_COLOR);
|
||||||
setErrorType(ErrorType.NONE);
|
setErrorType(ErrorType.NONE);
|
||||||
setLoadProgress(LOAD_PROGRESS_LOCATION_CHANGE);
|
setLoadProgressIfLoading(LOAD_PROGRESS_LOCATION_CHANGE);
|
||||||
|
|
||||||
Tabs.getInstance().notifyListeners(this, Tabs.TabEvents.LOCATION_CHANGE, oldUrl);
|
Tabs.getInstance().notifyListeners(this, Tabs.TabEvents.LOCATION_CHANGE, oldUrl);
|
||||||
}
|
}
|
||||||
@ -672,7 +672,7 @@ public class Tab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void handleContentLoaded() {
|
void handleContentLoaded() {
|
||||||
setLoadProgress(LOAD_PROGRESS_LOADED);
|
setLoadProgressIfLoading(LOAD_PROGRESS_LOADED);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void saveThumbnailToDB() {
|
protected void saveThumbnailToDB() {
|
||||||
@ -776,6 +776,22 @@ public class Tab {
|
|||||||
mLoadProgress = progressPercentage;
|
mLoadProgress = progressPercentage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the tab load progress to the given percentage only if the tab is
|
||||||
|
* currently loading.
|
||||||
|
*
|
||||||
|
* about:neterror can trigger a STOP before other page load events (bug
|
||||||
|
* 976426), so any post-START events should make sure the page is loading
|
||||||
|
* before updating progress.
|
||||||
|
*
|
||||||
|
* @param progressPercentage Percentage to set progress to (0-100)
|
||||||
|
*/
|
||||||
|
void setLoadProgressIfLoading(int progressPercentage) {
|
||||||
|
if (getState() == STATE_LOADING) {
|
||||||
|
setLoadProgress(progressPercentage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the tab load progress percentage.
|
* Gets the tab load progress percentage.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user