diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 4a800ce8bf6..0f60230fb7f 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -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)); } /** diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 577de37fda7..111d83d7537 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -476,9 +476,7 @@ - + onpopupshowing="UpdateDynamicShortcutTooltipText(this);"/> #ifdef CAN_DRAW_IN_TITLEBAR diff --git a/mobile/android/base/Tab.java b/mobile/android/base/Tab.java index e2bb1fea487..1a88969381e 100644 --- a/mobile/android/base/Tab.java +++ b/mobile/android/base/Tab.java @@ -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(); mPluginLayers = new HashMap(); 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 { diff --git a/mobile/android/base/Tabs.java b/mobile/android/base/Tabs.java index 98e214f9b74..735380f65f7 100644 --- a/mobile/android/base/Tabs.java +++ b/mobile/android/base/Tabs.java @@ -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")); diff --git a/mobile/android/base/toolbar/BrowserToolbar.java b/mobile/android/base/toolbar/BrowserToolbar.java index b26e9e9a233..5d57a599bb1 100644 --- a/mobile/android/base/toolbar/BrowserToolbar.java +++ b/mobile/android/base/toolbar/BrowserToolbar.java @@ -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: