From d97d9bbbf6b07b042b978a43a9d6cccc3116bcfa Mon Sep 17 00:00:00 2001 From: "chanial%noos.fr" Date: Sun, 17 Aug 2003 11:11:42 +0000 Subject: [PATCH] bug 213228: new toolkit independence bug, part 7: update and use the new toolkit widgetry. tabbrowser.xml: bug 205341, 112697, 210760 by jag, bug 121234, 133503 by neil, bug 206668 by shliang. not ported: bug 169589, [mac] ctrl-tab no longer moves btwn frames bug 203960, go back group bug 104778, remember what user typed when switching tabs. bug 103720, prefill URI when opening new tab. --- toolkit/content/widgets/tabbrowser.xml | 157 +++++++++++++++---------- 1 file changed, 95 insertions(+), 62 deletions(-) diff --git a/toolkit/content/widgets/tabbrowser.xml b/toolkit/content/widgets/tabbrowser.xml index 6b648a62b274..bab9b9474760 100644 --- a/toolkit/content/widgets/tabbrowser.xml +++ b/toolkit/content/widgets/tabbrowser.xml @@ -43,7 +43,7 @@ xmlns="http://www.mozilla.org/xbl" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xbl="http://www.mozilla.org/xbl"> - + @@ -51,7 +51,7 @@ - @@ -79,6 +79,7 @@ @@ -166,7 +167,8 @@ onProgressChange : function (aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, - aCurTotalProgress, aMaxTotalProgress) { + aCurTotalProgress, aMaxTotalProgress) + { if (!this.mBlank && this.mTabBrowser.mCurrentTab == this.mTab) { for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) { var p = this.mTabBrowser.mProgressListeners[i]; @@ -177,15 +179,11 @@ } } }, - + onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus) { if (!aRequest) return; - - //ignore local/resource:/chrome: files - if (aStatus == NS_NET_STATUS_READ_FROM || aStatus == NS_NET_STATUS_WROTE_TO) - return; var oldBlank = this.mBlank; @@ -205,16 +203,16 @@ aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) { if (this.mBlank) this.mBlank = false; - + this.mTab.removeAttribute("busy"); - + var location = aRequest.QueryInterface(nsIChannel).URI; if (this.mIcon) { this.mTab.setAttribute("image", this.mIcon); mIcon = ""; } else if (this.mTabBrowser.shouldLoadFavIcon(location)) - this.mTabBrowser.loadFavIcon(location, "image", this.mTab); + this.mTabBrowser.loadFavIcon(location, "image", this.mTab); if (this.mTab.label == this.mTabBrowser.mStringBundle.getString("tabs.loading")) this.mTabBrowser.setTabTitle(this.mTab); @@ -244,10 +242,9 @@ }, onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage) { - //ignore local/resource:/chrome: files - if (this.mBlank || aStatus == NS_NET_STATUS_READ_FROM || aStatus == NS_NET_STATUS_WROTE_TO) + if (this.mBlank) return; - + if (this.mTabBrowser.mCurrentTab == this.mTab) { for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) { var p = this.mTabBrowser.mProgressListeners[i]; @@ -257,7 +254,8 @@ } }, - onSecurityChange : function(aWebProgress, aRequest, aState) { + onSecurityChange : function(aWebProgress, aRequest, aState) + { if (this.mTabBrowser.mCurrentTab == this.mTab) { for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) { var p = this.mTabBrowser.mProgressListeners[i]; @@ -309,17 +307,7 @@ + + + + + + + + + + + + + + + + ]]> @@ -614,7 +637,7 @@ // Get the first tab all hooked up with a title listener and popup blocking listener. this.mCurrentBrowser.addEventListener("DOMTitleChanged", this.onTitleChanged, false); - + this.setTabTitle(this.mCurrentTab); // Hook up our favicon. @@ -671,7 +694,7 @@ t.setAttribute("label", this.mStringBundle.getString("tabs.untitled")); else t.setAttribute("label", aURI); - + t.setAttribute("crop", "end"); t.maxWidth = 250; t.minWidth = 30; @@ -695,12 +718,12 @@ this.mPanelContainer.appendChild(b); b.addEventListener("DOMTitleChanged", this.onTitleChanged, false); - + if (this.mStrip.collapsed) this.setStripVisibilityTo(true); this.mPrefs.setBoolPref("browser.tabs.forceHide", false); - + // wire up a progress listener for the new browser object. var position = this.mTabContainer.childNodes.length-1; var tabListener = (this.mTabProgressListener)(this, t, blank); @@ -719,7 +742,7 @@ ]]> - + @@ -737,7 +760,7 @@ ]]> - + - + @@ -787,7 +810,7 @@ // Remove our title change and blocking listeners oldBrowser.removeEventListener("DOMTitleChanged", this.onTitleChanged, false); - + // We are no longer the primary content area. oldBrowser.setAttribute("type", "content"); @@ -805,7 +828,7 @@ newIndex = index; var oldTab = aTab; - + // clean up the before/afterselected attributes before removing the tab oldTab.selected = false; @@ -828,8 +851,13 @@ @@ -838,10 +866,10 @@ @@ -965,23 +993,23 @@ var url = transferUtils.retrieveURLFromData(aXferData.data, aXferData.flavour.contentType); // valid urls don't contain spaces ' '; if we have a space it isn't a valid url so bail out - if (!url || !url.length || url.indexOf(" ", 0) != -1) + if (!url || !url.length || url.indexOf(" ", 0) != -1) return; - + var bgLoad = this.mPrefs.getBoolPref("browser.tabs.loadInBackground"); - if (aEvent.target.localName == "tabs") { + var tab = null; + if (aEvent.originalTarget.localName != "tab") { // We're adding a new tab. - var tab = this.addTab(getShortcutOrURI(url)); - if (!bgLoad) - this.selectedTab = tab; + tab = this.addTab(getShortcutOrURI(url)); } - else if (aEvent.target.localName == "tab") { + else { // Load in an existing tab. - this.getBrowserForTab(aEvent.target).loadURI(getShortcutOrURI(url)); - if (this.mCurrentTab != aEvent.target && !bgLoad) - this.selectedTab = aEvent.target; + tab = aEvent.originalTarget; + this.getBrowserForTab(tab).loadURI(getShortcutOrURI(url)); } + if (this.mCurrentTab != tab && !bgLoad) + this.selectedTab = tab; ]]> @@ -1207,7 +1235,12 @@ - + + +