100706. Tabbrowser stuff. r=jag, sr=blake

This commit is contained in:
hyatt%netscape.com 2001-09-24 04:38:41 +00:00
parent 7d881264b3
commit 67241b3ae6
10 changed files with 92 additions and 12 deletions

View File

@ -140,6 +140,12 @@ pref("browser.frames.enabled", true);
// form submission
pref("browser.forms.submit.backwards_compatible", true);
// Tab browser preferences.
pref("browser.tabs.opentabfor.middleclick", false);
pref("browser.tabs.opentabfor.urlbar", false);
pref("browser.tabs.opentabfor.bookmarks", false);
pref("browser.tabs.opentabfor.personaltoolbar", false);
// view source
pref("view_source.syntax_highlight", true);
pref("view_source.wrap_long_lines", false);

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

View File

@ -4,3 +4,9 @@
tab[busy] {
list-style-image: url("chrome://global/skin/loading.gif");
}
.tabbrowser-closebox {
list-style-image: url("chrome://global/skin/closebox.gif");
margin-bottom: 3px;
margin-right: 2px;
}

View File

@ -233,6 +233,7 @@ classic.jar:
skin/classic/global/check-check.gif (global/check-check.gif)
skin/classic/global/check-radio-disabled.gif (global/check-radio-disabled.gif)
skin/classic/global/check-radio.gif (global/check-radio.gif)
skin/classic/global/closebox.gif (global/closebox.gif)
skin/classic/global/columnselect.gif (global/columnselect.gif)
skin/classic/global/console-error-caret.gif (global/console-error-caret.gif)
skin/classic/global/console-error-dash.gif (global/console-error-dash.gif)

View File

@ -4,3 +4,9 @@
tab[busy] {
list-style-image: url("chrome://communicator/skin/icons/loading.gif");
}
.tabbrowser-closebox {
list-style-image: url("chrome://global/skin/icons/closebox.gif");
margin-bottom: 3px;
margin-right: 2px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

View File

@ -402,6 +402,7 @@ modern.jar:
skin/modern/global/icons/alert-message.gif (global/icons/alert-message.gif)
skin/modern/global/icons/alert-question.gif (global/icons/alert-question.gif)
skin/modern/global/icons/alert-security.gif (global/icons/alert-security.gif)
skin/modern/global/icons/closebox.gif (global/icons/closebox.gif)
skin/modern/global/menu/mbgrip-btm-act.gif (global/menu/mbgrip-btm-act.gif)
skin/modern/global/menu/mbgrip-btm.gif (global/menu/mbgrip-btm.gif)
skin/modern/global/menu/mbgrip-mid-act.gif (global/menu/mbgrip-mid-act.gif)

View File

@ -898,7 +898,12 @@ function BrowserLoadURL()
if (url.match(/^view-source:/)) {
BrowserViewSourceOfURL(url.replace(/^view-source:/, ""), null);
} else {
loadURI(getShortcutOrURI(url));
if (pref && pref.GetBoolPref("browser.tabs.opentabfor.urlbar") && getBrowser().localName == "tabbrowser") {
var t = getBrowser().addTab(getShortcutOrURI(url)); // open link in new tab
getBrowser().selectedTab = t;
}
else
loadURI(getShortcutOrURI(url));
_content.focus();
}
}

View File

@ -160,7 +160,14 @@
return true; // do nothing
return false;
case 1: // if middle button clicked
if (pref && pref.GetBoolPref("middlemouse.openNewWindow")) { // and the pref is on
if (pref && pref.GetBoolPref("browser.tabs.opentabfor.middleclick") && getBrowser &&
getBrowser() && getBrowser().localName == "tabbrowser") {
var t = getBrowser().addTab(href); // open link in new tab
getBrowser().selectedTab = t;
event.preventBubble();
return true;
}
else if (pref && pref.GetBoolPref("middlemouse.openNewWindow")) {
openNewWindowWith(href); // open link in new window
event.preventBubble();
return true;

View File

@ -47,15 +47,15 @@
<content>
<xul:tabbox onselect="this.parentNode.updateCurrentBrowser();">
<xul:stack collapsed="true" tooltip="_child">
<xul:tooltip onpopupshowing="event.preventBubble(); if (document.tooltipNode.label) { this.childNodes[0].value = document.tooltipNode.label; return true; } return false;">
<xul:tooltip onpopupshowing="event.preventBubble(); if (document.tooltipNode.getAttribute('label')) { this.childNodes[0].value = document.tooltipNode.getAttribute('label'); return true; } return false;">
<xul:label style="margin:0px; padding:0px;" value="Dummy"/>
</xul:tooltip>
<xul:tabs flex="1">
<xul:tab flex="1" maxwidth="150" class="tabbrowser-tab" label="Blank" crop="center"/>
<xul:tabs style="padding-left:1px; padding-top: 1px;" flex="1">
<xul:tab flex="1" maxwidth="150" class="tabbrowser-tab" label="(Untitled)" crop="center"/>
</xul:tabs>
<xul:hbox mousethrough="always">
<xul:hbox mousethrough="always" align="center">
<spacer flex="1"/>
<xul:button label="Close Tab" onclick="this.parentNode.parentNode.parentNode.parentNode.removeCurrentTab();"/>
<xul:image mousethrough="never" class="tabbrowser-closebox" label="Close Tab" onclick="this.parentNode.parentNode.parentNode.parentNode.removeCurrentTab();"/>
</xul:hbox>
</xul:stack>
<xul:tabpanels flex="1" style="margin:0px; padding:0px; border:0px;">
@ -135,6 +135,7 @@
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
this.mTab.setAttribute("busy", "true");
this.mTab.label = "Loading...";
if (this.mTabBrowser.mCurrentTab == this.mTab)
this.mTabBrowser.mIsBusy = true;
}
@ -142,7 +143,8 @@
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
this.mTab.removeAttribute("busy");
if (this.mTab.label == "Loading...")
this.mTab.label = "Done";
this.mTab.label = "(Untitled)";
if (this.mTabBrowser.mCurrentTab == this.mTab)
this.mTabBrowser.mIsBusy = false;
}
@ -205,6 +207,25 @@
</body>
</method>
<method name="updateTitlebar">
<body>
<![CDATA[
var newTitle = "";
var docTitle;
if (this.docShell.contentViewer)
docTitle = this.contentDocument.title;
if (docTitle) {
newTitle += this.ownerDocument.documentElement.getAttribute("titlepreface");
newTitle += docTitle;
newTitle += this.ownerDocument.documentElement.getAttribute("titlemenuseparator");
}
newTitle += this.ownerDocument.documentElement.getAttribute("titlemodifier");
window.title = newTitle;
]]>
</body>
</method>
<method name="updateCurrentBrowser">
<body>
<![CDATA[
@ -225,6 +246,9 @@
p.onLocationChange(webProgress, null, loc);
}
// Update the window title.
this.updateTitlebar();
// If the new tab is busy, and our current state is not busy, then
// we need to fire a start to all progress listeners.
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
@ -268,8 +292,13 @@
if (this.parentNode.childNodes[i] == this)
break;
}
var tab = this.parentNode.parentNode.parentNode.mTabContainer.childNodes[i];
var tabBrowser = this.parentNode.parentNode.parentNode;
var tab = tabBrowser.mTabContainer.childNodes[i];
tab.setAttribute("label", this.contentDocument.title);
if (tab == tabBrowser.mCurrentTab)
this.parentNode.parentNode.parentNode.updateTitlebar();
]]>
</body>
</method>
@ -318,7 +347,6 @@
this.mTabContainer.appendChild(t);
b.setAttribute("type", "content");
b.setAttribute("src", aURI);
b.setAttribute("contextmenu", this.getAttribute("contentcontextmenu"));
b.setAttribute("tooltip", this.getAttribute("contenttooltip"));
@ -335,6 +363,8 @@
b.webProgress.addProgressListener(tabListener);
this.mTabListeners[position] = tabListener;
b.loadURI(aURI, nsIWebNavigation.LOAD_FLAGS_NONE);
return t;
]]>
</body>
@ -387,7 +417,7 @@
if (!this.mTabbedMode)
// Just perform a direct wiring to the single active browser.
this.mCurrentBrowser.webProgress.addProgressListener(aListener);
this.mCurrentBrowser.addProgressListener(aListener);
]]>
</body>
</method>
@ -406,7 +436,7 @@
if (!this.mTabbedMode)
// Just do a direct removal.
this.mCurrentBrowser.webProgress.removeProgressListener(aListener);
this.mCurrentBrowser.removeProgressListener(aListener);
]]>
</body>
</method>
@ -778,6 +808,24 @@
onget="return this.webNavigation.document;"
readonly="true"/>
<method name="addProgressListener">
<parameter name="aListener"/>
<body>
<![CDATA[
this.webProgress.addProgressListener(aListener);
]]>
</body>
</method>
<method name="removeProgressListener">
<parameter name="aListener"/>
<body>
<![CDATA[
this.webProgress.removeProgressListener(aListener);
]]>
</body>
</method>
<constructor>
// wire up session history
// XXXdwh On a dynamic skin switch, we should be checking our box object to obtain