This commit is contained in:
Roy Frostig 2009-07-24 15:53:34 -07:00
Родитель 936f43b007 0a020cf3f4
Коммит 0874fc97b3
10 изменённых файлов: 86 добавлений и 27 удалений

Просмотреть файл

@ -217,7 +217,7 @@ pref("browser.xul.error_pages.enabled", true);
// various and sundry awesomebar prefs (should remove/re-evaluate
// these once bug 447900 is fixed)
pref("browser.urlbar.clickSelectsAll", true);
pref("browser.urlbar.doubleClickSelectsAll", false);
pref("browser.urlbar.doubleClickSelectsAll", true);
pref("browser.urlbar.autoFill", false);
pref("browser.urlbar.matchOnlyTyped", false);
pref("browser.urlbar.matchBehavior", 1);

Просмотреть файл

@ -67,6 +67,10 @@ function InputHandler() {
/* when set to true, next click won't be dispatched */
this._suppressNextClick = true;
/* used to cancel actions with browser window changes */
window.addEventListener("URLChanged", this, true);
window.addEventListener("TabSelect", this, true);
/* used to stop everything if mouse leaves window on desktop */
window.addEventListener("mouseout", this, true);
@ -195,6 +199,12 @@ InputHandler.prototype = {
if (this._ignoreEvents)
return;
/* changing URL or selected a new tab will immediately stop active input handlers */
if (aEvent.type == "URLChanged" || aEvent.type == "TabSelect") {
this.grab(null);
return;
}
if (this._suppressNextClick && aEvent.type == "click") {
this._suppressNextClick = false;
aEvent.stopPropagation();

Просмотреть файл

@ -232,10 +232,10 @@ var BrowserUI = {
// If we have a dialog push it on the stack and set the attr for CSS
if (aDialog) {
this._dialogs.push(aDialog);
document.getElementById("toolbar-main").setAttribute("dialog", "true")
document.getElementById("toolbar-main").setAttribute("dialog", "true");
}
},
popDialog : function popDialog() {
// Passing null means we pop the topmost dialog
if (this._dialogs.length)
@ -243,7 +243,7 @@ var BrowserUI = {
// If no more dialogs are being displayed, remove the attr for CSS
if (!this._dialogs.length)
document.getElementById("toolbar-main").removeAttribute("dialog")
document.getElementById("toolbar-main").removeAttribute("dialog");
},
switchPane : function(id) {
@ -323,7 +323,9 @@ var BrowserUI = {
this._favicon.addEventListener("error", this, false);
this._autocompleteNavbuttons = document.getElementById("autocomplete_navbuttons");
document.getElementById("urlbar-editarea").addEventListener("click", this, false);
let urlbarEditArea = document.getElementById("urlbar-editarea");
urlbarEditArea.addEventListener("click", this, false);
urlbarEditArea.addEventListener("mousedown", this, false);
document.getElementById("tabs").addEventListener("TabSelect", this, true);
@ -580,6 +582,14 @@ var BrowserUI = {
this._editToolbar(false);
}
break;
case "mousedown":
if (aEvent.detail == 2 &&
aEvent.button == 0 &&
gPrefService.getBoolPref("browser.urlbar.doubleClickSelectsAll")) {
this._edit.editor.selectAll();
aEvent.preventDefault();
}
break;
// Favicon events
case "error":
this._favicon.src = "chrome://browser/skin/images/default-favicon.png";
@ -832,7 +842,7 @@ var FolderPicker = {
this._panel.height = window.innerHeight;
this._panel.hidden = false;
BrowserUI.pushDialog(this);
this._control = aControl;
let folders = document.getElementById("folder-items");

Просмотреть файл

@ -260,11 +260,12 @@ var Browser = {
_selectedTab : null,
windowUtils: window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils),
_isStartup : true,
startup: function() {
var self = this;
dump("begin startup\n");
let container = document.getElementById("tile-container");
let bv = this._browserView = new BrowserView(container, getVisibleRect());
@ -348,6 +349,8 @@ var Browser = {
if (e.target != window)
return;
dump(window.innerWidth + "," + window.innerHeight + "\n");
// XXX is this code right here actually needed?
let w = window.innerWidth;
let maximize = (document.documentElement.getAttribute("sizemode") == "maximized");
if (maximize && w > screen.width)
@ -375,6 +378,14 @@ var Browser = {
bv.commitBatchOperation();
}
window.addEventListener("resize", resizeHandler, false);
function fullscreenHandler() {
if (!window.fullScreen)
document.getElementById("toolbar-main").setAttribute("fullscreen", "true");
else
document.getElementById("toolbar-main").removeAttribute("fullscreen");
}
window.addEventListener("fullscreen", fullscreenHandler, false);
// initialize input handling
ih = new InputHandler();
@ -479,8 +490,10 @@ var Browser = {
this.setPluginState(true);
}
bv.commitBatchOperation();
dump("end startup\n");
},
shutdown: function() {
@ -537,6 +550,9 @@ var Browser = {
},
endLoading: function() {
if (!this._pageLoading)
alert("endLoading when page is already done\n");
this._pageLoading = false;
clearTimeout(this._loadingTimeout);
// in order to ensure we commit our current batch,
@ -1550,23 +1566,20 @@ ProgressController.prototype = {
if (this.browser.markupDocumentViewer.textZoom != kDefaultTextZoom)
this.browser.markupDocumentViewer.textZoom = kDefaultTextZoom;
}
// broadcast a URLChanged message for consumption by InputHandler
let event = document.createEvent("Events");
event.initEvent("URLChanged", true, false);
this.browser.dispatchEvent(event);
},
_networkStop: function() {
_networkStop: function _networkStop() {
this._tab.setLoading(false);
if (Browser.selectedBrowser == this.browser) {
Browser.endLoading();
BrowserUI.update(TOOLBARSTATE_LOADED);
this.browser.docShell.isOffScreenBrowser = true;
if (Browser._isStartup) {
// force the urlbar into position
//ws.panTo(0, -BrowserUI.toolbarH);
// now we can set the viewport to a real size and draw the page
//ws.endUpdateBatch();
Browser._isStartup = false;
}
Browser.endLoading();
}
this._tab.updateThumbnail();
@ -1666,7 +1679,7 @@ Tab.prototype = {
load: function(uri) {
dump("cb set src\n");
this._browser.setAttribute("src", uri);
dump("cb set src\n");
dump("cb end src\n");
},
create: function() {
@ -1691,7 +1704,7 @@ Tab.prototype = {
let scaledHeight = kDefaultBrowserWidth * (window.innerHeight / window.innerWidth);
let browser = this._browser = document.createElement("browser");
browser.setAttribute("style", "overflow: hidden; visibility: hidden; width: " + kDefaultBrowserWidth + "px; height: " + scaledHeight + "px;");
browser.setAttribute("style", "overflow: -moz-hidden-unscrollable; visibility: hidden; width: " + kDefaultBrowserWidth + "px; height: " + scaledHeight + "px;");
browser.setAttribute("type", "content");
// Attach the popup contextmenu
@ -1704,6 +1717,9 @@ Tab.prototype = {
// Append the browser to the document, which should start the page load
document.getElementById("browsers").appendChild(browser);
// stop about:blank from loading
browser.stop();
// Attach a separate progress listener to the browser
this._listener = new ProgressController(this);
browser.addProgressListener(this._listener);

Просмотреть файл

@ -180,8 +180,8 @@
<scrollbox id="scrollbox" style="-moz-box-orient: vertical; overflow: scroll;" top="0" left="0" flex="1">
<scrollbox id="scrollbox" style="overflow: scroll;" top="0" left="0" flex="1">
<vbox>
<!-- Main Toolbar -->
<toolbar id="toolbar-main" class="panel-dark" style="width: 800px;">
<hbox id="urlbar-container" flex="1">
@ -242,9 +242,11 @@
<toolbarbutton id="tool-panel-open" class="page-button button-image" command="cmd_panel"/>
</vbox>
</hbox>
</vbox>
</scrollbox>
<stack>
<stack flex="1">
<notificationbox id="notifications" top="0" left="0"/>
<!-- popup for find toolbar -->
@ -444,9 +446,8 @@
</hbox>
</stack>
<box>
<html:div style="position: relative; overflow: hidden; max-width: 0px; max-height: 0px; visibility: hidden;">
<html:div style="position: relative; overflow: -moz-hidden-unscrollable; max-width: 0px; max-height: 0px; visibility: hidden;">
<html:div id="browsers" style="position: absolute;"/>
</html:div>
</box>

Просмотреть файл

@ -63,13 +63,19 @@ toolbarbutton.urlbar-button {
}
#tool-app-close {
visibility: hidden;
min-height: 0 !important;
min-width: 0 !important;
margin-top: -40px; /* keep pixels */
list-style-image: url("chrome://browser/skin/images/fullscreen-close-40.png");
}
#toolbar-main[fullscreen="true"] #tool-app-close {
visibility: visible;
}
#toolbar-main[dialog="true"] #tool-app-close {
visibility: visible;
list-style-image: url("chrome://browser/skin/images/fullscreen-up-40.png");
}

Просмотреть файл

@ -127,7 +127,9 @@ toolbarbutton:not(.show-text) .toolbarbutton-text {
display: none !important;
}
toolbarbutton:not(.show-text) .toolbarbutton-icon {
toolbarbutton:not(.show-text) .toolbarbutton-icon,
toolbarbutton:not([image]) .toolbarbutton-icon,
toolbarbutton[image=''] .toolbarbutton-icon {
-moz-margin-end: 0;
}

Просмотреть файл

@ -48,13 +48,19 @@
}
#tool-app-close {
visibility: hidden;
min-height: 0 !important;
min-width: 0 !important;
margin-top: -40px; /* keep pixels */
list-style-image: url("chrome://browser/skin/images/fullscreen-close-40.png");
}
#toolbar-main[fullscreen="true"] #tool-app-close {
visibility: visible;
}
#toolbar-main[dialog="true"] #tool-app-close {
visibility: visible;
list-style-image: url("chrome://browser/skin/images/fullscreen-up-40.png");
}

Просмотреть файл

@ -48,13 +48,19 @@
}
#tool-app-close {
visibility: hidden;
min-height: 0 !important;
min-width: 0 !important;
margin-top: -17px; /* keep pixels */
list-style-image: url("chrome://browser/skin/images/fullscreen-close-24.png");
}
#toolbar-main[fullscreen="true"] #tool-app-close {
visibility: visible;
}
#toolbar-main[dialog="true"] #tool-app-close {
visibility: visible;
list-style-image: url("chrome://browser/skin/images/fullscreen-up-24.png");
}

Просмотреть файл

@ -106,7 +106,9 @@ toolbarbutton:not(.show-text) .toolbarbutton-text {
display: none !important;
}
toolbarbutton:not(.show-text) .toolbarbutton-icon {
toolbarbutton:not(.show-text) .toolbarbutton-icon,
toolbarbutton:not([image]) .toolbarbutton-icon,
toolbarbutton[image=''] .toolbarbutton-icon {
-moz-margin-end: 0;
}