mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
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.
This commit is contained in:
parent
b78705d80a
commit
d97d9bbbf6
@ -51,7 +51,7 @@
|
||||
|
||||
<content>
|
||||
<xul:stringbundle src="chrome://global/locale/tabbrowser.properties"/>
|
||||
<xul:tabbox flex="1"
|
||||
<xul:tabbox flex="1" xbl:inherits="handleCtrlPageUpDown"
|
||||
onselect="if (!('updateCurrentBrowser' in this.parentNode) || event.target.localName != 'tabpanels') return; this.parentNode.updateCurrentBrowser();">
|
||||
<xul:hbox class="tabbrowser-strip chromeclass-toolbar" collapsed="true" tooltip="_child" context="_child">
|
||||
<xul:tooltip onpopupshowing="event.preventBubble(); if (document.tooltipNode.hasAttribute('label')) { this.setAttribute('label', document.tooltipNode.getAttribute('label')); return true; } return false;"/>
|
||||
@ -79,6 +79,7 @@
|
||||
|
||||
<xul:tabs class="tabbrowser-tabs" closebutton="true" flex="1"
|
||||
onclick="this.parentNode.parentNode.parentNode.onTabClick(event);"
|
||||
onmousedown="this.parentNode.parentNode.parentNode.updateContextTab(event);"
|
||||
ondragover="nsDragAndDrop.dragOver(event, this.parentNode.parentNode.parentNode);
|
||||
event.stopPropagation();"
|
||||
ondragdrop="nsDragAndDrop.drop(event, this.parentNode.parentNode.parentNode);
|
||||
@ -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];
|
||||
@ -183,10 +185,6 @@
|
||||
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;
|
||||
|
||||
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
|
||||
@ -244,8 +242,7 @@
|
||||
},
|
||||
|
||||
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) {
|
||||
@ -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 @@
|
||||
<body>
|
||||
<![CDATA[
|
||||
var iconURL = this.buildFavIconString(aURI);
|
||||
if (!this.mMissedIconCache) {
|
||||
var cacheService = Components.classes['@mozilla.org/network/cache-service;1'].getService(Components.interfaces.nsICacheService);
|
||||
this.mMissedIconCache = cacheService.createSession("MissedIconCache", Components.interfaces.nsICache.STORE_ANYWHERE, true);
|
||||
if (!this.mMissedIconCache)
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
var entry = this.mMissedIconCache.openCacheEntry(iconURL, Components.interfaces.nsICache.ACCESS_READ, true);
|
||||
}
|
||||
catch (exc) {}
|
||||
var entry = this.openCacheEntry(iconURL, Components.interfaces.nsICache.ACCESS_READ);
|
||||
if (!entry)
|
||||
aElt.setAttribute(aAttr, iconURL);
|
||||
else {
|
||||
@ -334,7 +322,10 @@
|
||||
<parameter name="aURI"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var entry = this.mMissedIconCache.openCacheEntry(aURI, Components.interfaces.nsICache.ACCESS_READ_WRITE, true);
|
||||
var entry = this.openCacheEntry(aURI, Components.interfaces.nsICache.ACCESS_READ_WRITE);
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
if (entry.accessGranted == Components.interfaces.nsICache.ACCESS_WRITE)
|
||||
// It's a new entry. Just write a bit of metadata in to the entry.
|
||||
entry.setMetaDataElement("Icon", "Missed");
|
||||
@ -344,6 +335,27 @@
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="openCacheEntry">
|
||||
<parameter name="key"/>
|
||||
<parameter name="access"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
try {
|
||||
if (!this.mMissedIconCache) {
|
||||
var cacheService = Components.classes['@mozilla.org/network/cache-service;1'].getService(Components.interfaces.nsICacheService);
|
||||
this.mMissedIconCache = cacheService.createSession("MissedIconCache", Components.interfaces.nsICache.STORE_ANYWHERE, true);
|
||||
if (!this.mMissedIconCache)
|
||||
return null;
|
||||
}
|
||||
return this.mMissedIconCache.openCacheEntry(key, access, true);
|
||||
}
|
||||
catch (e) {
|
||||
return null;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="updateTitlebar">
|
||||
<body>
|
||||
<![CDATA[
|
||||
@ -369,11 +381,22 @@
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="updateContextTab">
|
||||
<parameter name="aEvent"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (aEvent.originalTarget.localName == "tab")
|
||||
this.mContextTab = aEvent.originalTarget;
|
||||
else
|
||||
this.mContextTab = document.popupNode;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="updatePopupMenu">
|
||||
<parameter name="aPopupMenu"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this.mContextTab = document.popupNode;
|
||||
var disabled = this.mPanelContainer.childNodes.length == 1;
|
||||
var menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-multiple");
|
||||
for (var i = 0; i < menuItems.length; i++)
|
||||
@ -828,8 +851,13 @@
|
||||
<body>
|
||||
<![CDATA[
|
||||
var l = this.mPanelContainer.childNodes.length;
|
||||
for (var i = 0; i < l; i++)
|
||||
this.mPanelContainer.childNodes[i].webNavigation.reload(true);
|
||||
for (var i = 0; i < l; i++) {
|
||||
try {
|
||||
this.mPanelContainer.childNodes[i].reload();
|
||||
} catch (e) {
|
||||
// ignore failure to reload so others will be reloaded
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
@ -838,10 +866,10 @@
|
||||
<parameter name="aTab"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
var l = this.mPanelContainer.childNodes.length;
|
||||
for (var i = 0; i < l; i++)
|
||||
if (this.mTabContainer.childNodes[i] == aTab)
|
||||
this.mPanelContainer.childNodes[i].webNavigation.reload(true);
|
||||
if (aTab.localName != "tab")
|
||||
aTab = this.mCurrentTab;
|
||||
|
||||
this.getBrowserForTab(aTab).reload();
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
@ -970,18 +998,18 @@
|
||||
|
||||
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;
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
@ -1207,7 +1235,12 @@
|
||||
</implementation>
|
||||
|
||||
<handlers>
|
||||
<handler event="keypress" modifiers="control" keycode="vk_f4" action="this.removeCurrentTab();"/>
|
||||
<handler event="keypress" modifiers="control" keycode="VK_F4">
|
||||
<![CDATA[
|
||||
if (this.mTabBox.handleCtrlPageUpDown)
|
||||
this.removeCurrentTab();
|
||||
]]>
|
||||
</handler>
|
||||
|
||||
<handler event="DOMWindowClose">
|
||||
<![CDATA[
|
||||
|
Loading…
Reference in New Issue
Block a user