From 830ac578642f511c8a30e79e6422da3b2eccd192 Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Mon, 20 Jul 2009 16:22:22 -0400 Subject: [PATCH 1/5] Bug 505033: Only show close button when in fullscreen mode, r=gavin --- mobile/chrome/content/browser-ui.js | 4 ++-- mobile/chrome/content/browser.js | 8 ++++++++ mobile/themes/hildon/browser.css | 6 ++++++ mobile/themes/wince/browser-high.css | 6 ++++++ mobile/themes/wince/browser-low.css | 6 ++++++ 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/mobile/chrome/content/browser-ui.js b/mobile/chrome/content/browser-ui.js index d26fd9b97dd8..bd6b7b05359b 100644 --- a/mobile/chrome/content/browser-ui.js +++ b/mobile/chrome/content/browser-ui.js @@ -232,7 +232,7 @@ 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"); } }, @@ -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) { diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index 9c2448984fdd..eb3808f10f9d 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -138,6 +138,14 @@ var Browser = { ws.updateSize(w, h); } 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); function viewportHandler(bounds, boundsSizeChanged) { self._canvasBrowser.viewportHandler(bounds, boundsSizeChanged); diff --git a/mobile/themes/hildon/browser.css b/mobile/themes/hildon/browser.css index 54ee8b6fd635..a687c6b4167e 100644 --- a/mobile/themes/hildon/browser.css +++ b/mobile/themes/hildon/browser.css @@ -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"); } diff --git a/mobile/themes/wince/browser-high.css b/mobile/themes/wince/browser-high.css index 9358e2f8abff..455dbae84a80 100644 --- a/mobile/themes/wince/browser-high.css +++ b/mobile/themes/wince/browser-high.css @@ -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"); } diff --git a/mobile/themes/wince/browser-low.css b/mobile/themes/wince/browser-low.css index d9a2acd9be4c..da9c26d9b608 100644 --- a/mobile/themes/wince/browser-low.css +++ b/mobile/themes/wince/browser-low.css @@ -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"); } From 5998798fedf4676a249f567459b868d06c01e20f Mon Sep 17 00:00:00 2001 From: Ben Combee Date: Tue, 21 Jul 2009 11:28:29 -0400 Subject: [PATCH 2/5] Bug 500835: Kinetic scrolling doesn't stop on page change, r=mfinkle --- mobile/chrome/content/InputHandler.js | 18 ++++++++++++++---- mobile/chrome/content/browser-ui.js | 4 ++-- mobile/chrome/content/browser.js | 7 ++++++- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/mobile/chrome/content/InputHandler.js b/mobile/chrome/content/InputHandler.js index 5eeed08fca42..7f488239221c 100644 --- a/mobile/chrome/content/InputHandler.js +++ b/mobile/chrome/content/InputHandler.js @@ -88,6 +88,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); @@ -154,6 +158,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(); @@ -447,7 +457,7 @@ function KineticData(owner) { // In preferences this value is an int. We divide so that it can be a percent. this._decelerationRate = gPrefService.getIntPref("browser.ui.kinetic.decelerationRate") / 100; } - catch (e) { + catch (e) { this._updateInterval = 33; this._emaAlpha = .8; this._decelerationRate = .15; @@ -488,13 +498,13 @@ KineticData.prototype = { let dx = Math.round(self._speedX * self._updateInterval); let dy = Math.round(self._speedY * self._updateInterval); // dump("dx, dy: " + dx + " " + dy + "\n"); - + let panned = self._owner._dragBy(dx, dy); if (!panned) { self.endKinetic(); return; } - + if (self._speedX < 0) { self._speedX = Math.min(self._speedX + self._decelerationRate, 0); } else if (self._speedX > 0) { @@ -537,7 +547,7 @@ KineticData.prototype = { let me = mb[i]; let timeDiff = me.t - prev.t; - + this._speedX = ema( ((me.sx - prev.sx) / timeDiff), this._speedX, this._emaAlpha); this._speedY = ema( ((me.sy - prev.sy) / timeDiff), this._speedY, this._emaAlpha); diff --git a/mobile/chrome/content/browser-ui.js b/mobile/chrome/content/browser-ui.js index bd6b7b05359b..39f580c1048c 100644 --- a/mobile/chrome/content/browser-ui.js +++ b/mobile/chrome/content/browser-ui.js @@ -235,7 +235,7 @@ var BrowserUI = { document.getElementById("toolbar-main").setAttribute("dialog", "true"); } }, - + popDialog : function popDialog() { // Passing null means we pop the topmost dialog if (this._dialogs.length) @@ -828,7 +828,7 @@ var FolderPicker = { this._panel.height = window.innerHeight; this._panel.hidden = false; BrowserUI.pushDialog(this); - + this._control = aControl; let folders = document.getElementById("folder-items"); diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index eb3808f10f9d..5b4f9e8eb480 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -1120,7 +1120,7 @@ var HelperAppDialog = { if (!this._launcher.MIMEInfo.hasDefaultHandler) document.getElementById("helperapp-open").disabled = true; - + let toolbar = document.getElementById("toolbar-main"); let top = toolbar.top + toolbar.boxObject.height; let container = document.getElementById("helperapp-container"); @@ -1241,6 +1241,11 @@ 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() { From aaefbd90d4efcc285f679ec4a79772599f677a28 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas <21@vingtetun.org> Date: Tue, 21 Jul 2009 11:37:29 -0400 Subject: [PATCH 3/5] Bug 500678: Manage text off-center in Bookmarks Manager, r=mfinkle --- mobile/themes/hildon/platform.css | 4 +++- mobile/themes/wince/platform.css | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mobile/themes/hildon/platform.css b/mobile/themes/hildon/platform.css index becdbcd3ac7a..5aaafeab55b9 100644 --- a/mobile/themes/hildon/platform.css +++ b/mobile/themes/hildon/platform.css @@ -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; } diff --git a/mobile/themes/wince/platform.css b/mobile/themes/wince/platform.css index 1bfd2bd2ddb2..d7a2fd17dda5 100644 --- a/mobile/themes/wince/platform.css +++ b/mobile/themes/wince/platform.css @@ -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; } From cb9bc442930ed947b1a5b5aff7f88917d6e83360 Mon Sep 17 00:00:00 2001 From: Gavin Sharp Date: Tue, 21 Jul 2009 20:05:01 -0400 Subject: [PATCH 4/5] Bug 500710: double clicking in the url bar should select all, r=vingtetun --- mobile/app/mobile.js | 2 +- mobile/chrome/content/browser-ui.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/mobile/app/mobile.js b/mobile/app/mobile.js index 633e5ca292eb..e7ad4db6a146 100644 --- a/mobile/app/mobile.js +++ b/mobile/app/mobile.js @@ -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); diff --git a/mobile/chrome/content/browser-ui.js b/mobile/chrome/content/browser-ui.js index 39f580c1048c..e401343dc6e4 100644 --- a/mobile/chrome/content/browser-ui.js +++ b/mobile/chrome/content/browser-ui.js @@ -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); @@ -576,6 +578,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"; From b49ec38f3d0fb1a7b88b07bae9bdbc35f3f2682f Mon Sep 17 00:00:00 2001 From: Stuart Parmenter Date: Wed, 22 Jul 2009 06:12:02 -0700 Subject: [PATCH 5/5] fix up network loading bugs --- mobile/chrome/content/browser.js | 31 +++++++++++++++++-------------- mobile/chrome/content/browser.xul | 11 ++++++----- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index 1334e8124da7..f2b8b85f33d0 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -248,11 +248,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()); @@ -331,6 +332,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) @@ -462,8 +465,10 @@ var Browser = { this.setPluginState(true); } - bv.commitBatchOperation(); + + + dump("end startup\n"); }, shutdown: function() { @@ -520,6 +525,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, @@ -1476,21 +1484,13 @@ ProgressController.prototype = { } }, - _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(); @@ -1590,7 +1590,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() { @@ -1615,7 +1615,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 @@ -1628,6 +1628,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); diff --git a/mobile/chrome/content/browser.xul b/mobile/chrome/content/browser.xul index 54459bc3eba7..10d847fd82c8 100644 --- a/mobile/chrome/content/browser.xul +++ b/mobile/chrome/content/browser.xul @@ -180,8 +180,8 @@ - - + + @@ -242,9 +242,11 @@ + - + + @@ -444,9 +446,8 @@ - - +