Merge fx-team to m-c

This commit is contained in:
Wes Kocher 2014-02-26 18:13:35 -08:00
commit 89351d9fd2
5 changed files with 23 additions and 20 deletions

View File

@ -4801,9 +4801,8 @@ const nodeToShortcutMap = {
"tabview-button": "key_tabview",
};
const gDynamicTooltipCache = new Map();
function UpdateDynamicShortcutTooltipText(popupTriggerNode) {
let label = document.getElementById("dynamic-shortcut-tooltip-label");
let nodeId = popupTriggerNode.id;
function UpdateDynamicShortcutTooltipText(aTooltip) {
let nodeId = aTooltip.triggerNode.id;
if (!gDynamicTooltipCache.has(nodeId) && nodeId in nodeToTooltipMap) {
let strId = nodeToTooltipMap[nodeId];
let args = [];
@ -4816,8 +4815,7 @@ function UpdateDynamicShortcutTooltipText(popupTriggerNode) {
}
gDynamicTooltipCache.set(nodeId, gNavigatorBundle.getFormattedString(strId, args));
}
let desiredLabel = gDynamicTooltipCache.get(nodeId);
label.setAttribute("value", desiredLabel);
aTooltip.setAttribute("label", gDynamicTooltipCache.get(nodeId));
}
/**

View File

@ -476,9 +476,7 @@
</hbox>
<tooltip id="dynamic-shortcut-tooltip"
onpopupshowing="UpdateDynamicShortcutTooltipText(this.triggerNode)">
<label id="dynamic-shortcut-tooltip-label"/>
</tooltip>
onpopupshowing="UpdateDynamicShortcutTooltipText(this);"/>
</popupset>
#ifdef CAN_DRAW_IN_TITLEBAR

View File

@ -74,6 +74,12 @@ public class Tab {
public static final int STATE_SUCCESS = 2;
public static final int STATE_ERROR = 3;
public static final int LOAD_PROGRESS_INIT = 10;
public static final int LOAD_PROGRESS_START = 20;
public static final int LOAD_PROGRESS_LOCATION_CHANGE = 60;
public static final int LOAD_PROGRESS_LOADED = 80;
public static final int LOAD_PROGRESS_STOP = 100;
private static final int DEFAULT_BACKGROUND_COLOR = Color.WHITE;
public enum ErrorType {
@ -112,6 +118,7 @@ public class Tab {
mPluginViews = new ArrayList<View>();
mPluginLayers = new HashMap<Object, Layer>();
mState = shouldShowProgress(url) ? STATE_SUCCESS : STATE_LOADING;
mLoadProgress = LOAD_PROGRESS_INIT;
// At startup, the background is set to a color specified by LayerView
// when the LayerView is created. Shortly after, this background color
@ -628,6 +635,7 @@ public class Tab {
setHasTouchListeners(false);
setBackgroundColor(DEFAULT_BACKGROUND_COLOR);
setErrorType(ErrorType.NONE);
setLoadProgress(LOAD_PROGRESS_LOCATION_CHANGE);
Tabs.getInstance().notifyListeners(this, Tabs.TabEvents.LOCATION_CHANGE, oldUrl);
}
@ -639,6 +647,7 @@ public class Tab {
}
void handleDocumentStart(boolean showProgress, String url) {
setLoadProgress(LOAD_PROGRESS_START);
setState(showProgress ? STATE_LOADING : STATE_SUCCESS);
updateIdentityData(null);
setReaderEnabled(false);
@ -649,6 +658,7 @@ public class Tab {
final String oldURL = getURL();
final Tab tab = this;
tab.setLoadProgress(LOAD_PROGRESS_STOP);
ThreadUtils.getBackgroundHandler().postDelayed(new Runnable() {
@Override
public void run() {
@ -659,7 +669,11 @@ public class Tab {
ThumbnailHelper.getInstance().getAndProcessThumbnailFor(tab);
}
}, 500);
}
}
void handleContentLoaded() {
setLoadProgress(LOAD_PROGRESS_LOADED);
}
protected void saveThumbnailToDB() {
try {

View File

@ -51,11 +51,6 @@ public class Tabs implements GeckoEventListener {
private AccountManager mAccountManager;
private OnAccountsUpdateListener mAccountListener = null;
private static final int LOAD_PROGRESS_START = 20;
private static final int LOAD_PROGRESS_LOCATION_CHANGE = 60;
private static final int LOAD_PROGRESS_LOADED = 80;
private static final int LOAD_PROGRESS_STOP = 100;
public static final int LOADURL_NONE = 0;
public static final int LOADURL_NEW_TAB = 1 << 0;
public static final int LOADURL_USER_ENTERED = 1 << 1;
@ -440,7 +435,6 @@ public class Tabs implements GeckoEventListener {
} else if (event.equals("Tab:Select")) {
selectTab(tab.getId());
} else if (event.equals("Content:LocationChange")) {
tab.setLoadProgress(LOAD_PROGRESS_LOCATION_CHANGE);
tab.handleLocationChange(message);
} else if (event.equals("Content:SecurityChange")) {
tab.updateIdentityData(message.getJSONObject("identity"));
@ -454,20 +448,19 @@ public class Tabs implements GeckoEventListener {
if ((state & GeckoAppShell.WPL_STATE_START) != 0) {
boolean showProgress = message.getBoolean("showProgress");
tab.handleDocumentStart(showProgress, message.getString("uri"));
tab.setLoadProgress(LOAD_PROGRESS_START);
notifyListeners(tab, Tabs.TabEvents.START);
} else if ((state & GeckoAppShell.WPL_STATE_STOP) != 0) {
tab.handleDocumentStop(message.getBoolean("success"));
tab.setLoadProgress(LOAD_PROGRESS_STOP);
notifyListeners(tab, Tabs.TabEvents.STOP);
}
}
} else if (event.equals("Content:LoadError")) {
tab.setLoadProgress(LOAD_PROGRESS_LOADED);
tab.handleContentLoaded();
notifyListeners(tab, Tabs.TabEvents.LOAD_ERROR);
} else if (event.equals("Content:PageShow")) {
notifyListeners(tab, TabEvents.PAGE_SHOW);
} else if (event.equals("DOMContentLoaded")) {
tab.handleContentLoaded();
String backgroundColor = message.getString("bgColor");
if (backgroundColor != null) {
tab.setBackgroundColor(backgroundColor);
@ -476,7 +469,6 @@ public class Tabs implements GeckoEventListener {
tab.setBackgroundColor(Color.WHITE);
}
tab.setErrorType(message.optString("errorType"));
tab.setLoadProgress(LOAD_PROGRESS_LOADED);
notifyListeners(tab, Tabs.TabEvents.LOADED);
} else if (event.equals("DOMTitleChanged")) {
tab.updateTitle(message.getString("title"));

View File

@ -470,8 +470,9 @@ public class BrowserToolbar extends GeckoRelativeLayout
// Progress-related handling
switch (msg) {
case START:
updateProgressVisibility(tab, 0);
updateProgressVisibility(tab, Tab.LOAD_PROGRESS_INIT);
// Fall through.
case ADDED:
case LOCATION_CHANGE:
case LOAD_ERROR:
case LOADED: