diff --git a/mobile/chrome/content/browser-ui.js b/mobile/chrome/content/browser-ui.js index 3ccdfd9ec90a..dfe64a5a8d02 100644 --- a/mobile/chrome/content/browser-ui.js +++ b/mobile/chrome/content/browser-ui.js @@ -319,7 +319,6 @@ var BrowserUI = { this._edit.focus(); bookmark.hidden = true; urllist.hidden = true; - this.openDefaultHistory(); } else if (aMode == PANELMODE_BOOKMARK) { toolbar.setAttribute("mode", "view"); @@ -412,6 +411,7 @@ var BrowserUI = { // URL textbox events case "click": this._showMode(PANELMODE_EDIT); + this.openDefaultHistory(); break; case "input": if (this._edit.value) { diff --git a/mobile/chrome/content/browser.css b/mobile/chrome/content/browser.css index 1e8ddc64401a..78e4f8caa141 100644 --- a/mobile/chrome/content/browser.css +++ b/mobile/chrome/content/browser.css @@ -5,3 +5,7 @@ deckbrowser { #urlbar-edit { -moz-binding: url("chrome://browser/content/urlbar.xml#autocomplete-aligned"); } + +richlistitem[type="documenttab"] { + -moz-binding: url("chrome://browser/content/deckbrowser.xml#documenttab"); +} diff --git a/mobile/chrome/content/browser.js b/mobile/chrome/content/browser.js index 086eacd080ac..e4e6d564f5bc 100644 --- a/mobile/chrome/content/browser.js +++ b/mobile/chrome/content/browser.js @@ -65,7 +65,8 @@ var Browser = { _content : null, _titleChanged : function(aEvent) { - if (aEvent.target != this.content.browser.contentDocument) + var browser = this.content.browser; + if (!browser || aEvent.target != browser.contentDocument) return; document.title = "Fennec - " + aEvent.target.title; @@ -94,13 +95,16 @@ var Browser = { styleSheets.loadAndRegisterSheet(styleURI, styleSheets.AGENT_SHEET); this._content = document.getElementById("content"); + this._content.progressListenerCreator = function (content, browser) { + return new ProgressController(content, browser); + }; + + this._content.newTab(true); this._content.addEventListener("DOMTitleChanged", this, true); this._content.addEventListener("overpan", this, false); this._content.addEventListener("DOMUpdatePageReport", gPopupBlockerObserver.onUpdatePageReport, false); BrowserUI.init(); - this._progressController = new ProgressController(this.content); - this._spatialNavigation = new SpatialNavigation(this.content); this.setupGeolocationPrompt(); @@ -148,7 +152,13 @@ var Browser = { }, setupGeolocationPrompt: function() { - var geolocationService = Cc["@mozilla.org/geolocation/service;1"].getService(Ci.nsIGeolocationService); + try { + var geolocationService = Cc["@mozilla.org/geolocation/service;1"].getService(Ci.nsIGeolocationService); + } + catch (ex) { + return; + } + geolocationService.prompt = function(request) { var notificationBox = Browser.getNotificationBox(); @@ -218,6 +228,8 @@ var Browser = { case "cmd_fullscreen": case "cmd_addons": case "cmd_downloads": + case "cmd_newTab": + case "cmd_closeTab": isSupported = true; break; default: @@ -237,6 +249,7 @@ var Browser = { switch (cmd) { case "cmd_menu": + this.content.tabListVisible = !this.content.tabListVisible; controls.collapsed = !controls.collapsed; break; case "cmd_fullscreen": @@ -270,6 +283,11 @@ var Browser = { case "cmd_downloads": Cc["@mozilla.org/download-manager-ui;1"].getService(Ci.nsIDownloadManagerUI).show(window); break; + case "cmd_newTab": + this.newTab(); + break; + case "cmd_closeTab": + this.content.removeTab(this.content.browser); } }, @@ -277,6 +295,10 @@ var Browser = { return document.getElementById("notifications"); }, + newTab: function() { + this.content.newTab(true); + BrowserUI._showMode(PANELMODE_EDIT); + }, findState: FINDSTATE_FIND, openFind: function(aState) { @@ -305,9 +327,9 @@ var Browser = { } }; -function ProgressController(aTabBrowser) { +function ProgressController(aTabBrowser, aBrowser) { this._tabbrowser = aTabBrowser; - this.init(aTabBrowser.browser); + this.init(aBrowser); } ProgressController.prototype = { @@ -315,7 +337,6 @@ ProgressController.prototype = { init : function(aBrowser) { this._browser = aBrowser; - this._browser.addProgressListener(this, Components.interfaces.nsIWebProgress.NOTIFY_ALL); // FIXME: until we can get proper canvas repainting hooked up, update the canvas every 300ms var tabbrowser = this._tabbrowser; @@ -341,6 +362,7 @@ ProgressController.prototype = { if (aStateFlags & Ci.nsIWebProgressListener.STATE_IS_DOCUMENT) { if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP) { aWebProgress.DOMWindow.focus(); + this._tabbrowser.updateBrowser(this._browser, true); this._tabbrowser.updateCanvasState(true); //aWebProgress.DOMWindow.scrollbars.visible = false; } @@ -388,6 +410,7 @@ ProgressController.prototype = { if (aWebProgress.DOMWindow == this._browser.contentWindow) { BrowserUI.setURI(); + this._tabbrowser.updateBrowser(this._browser, false); this._tabbrowser.updateCanvasState(); } }, diff --git a/mobile/chrome/content/browser.xul b/mobile/chrome/content/browser.xul index e665381c1a70..735b6b68899c 100644 --- a/mobile/chrome/content/browser.xul +++ b/mobile/chrome/content/browser.xul @@ -74,6 +74,9 @@ + + + @@ -102,6 +105,8 @@ + + @@ -200,7 +205,8 @@ - + diff --git a/mobile/chrome/content/deckbrowser.xml b/mobile/chrome/content/deckbrowser.xml index 49162f833bdb..5412e60b1876 100644 --- a/mobile/chrome/content/deckbrowser.xml +++ b/mobile/chrome/content/deckbrowser.xml @@ -9,21 +9,26 @@ - + + + + + - - + + + + + this._zoomLevel = 1; @@ -38,6 +43,12 @@ // this._stack.addEventListener("dblclick", this.stackEventHandler, true); this._stack.addEventListener("DOMMouseScroll", this.stackEventHandler, true); + var self = this; + var obs = Components.classes["@mozilla.org/observer-service;1"]. + getService(Components.interfaces.nsIObserverService); + obs.addObserver(function(subject, topic, data) self.destroyEarliestBrowser(), + "memory-pressure", false); + this._dragStartTimeout = -1; @@ -65,10 +76,29 @@ - return document.getAnonymousElementByAttribute(this, "anonid", "browser"); + + + + return document.getAnonymousElementByAttribute(this, "anonid", "display-list"); + + + + + + return document.getAnonymousElementByAttribute(this, "anonid", "tab-list"); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -597,4 +919,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mobile/chrome/locale/en-US/browser.dtd b/mobile/chrome/locale/en-US/browser.dtd index 162e43f4ca9a..4bae6f6af821 100644 --- a/mobile/chrome/locale/en-US/browser.dtd +++ b/mobile/chrome/locale/en-US/browser.dtd @@ -15,6 +15,9 @@ + + + diff --git a/mobile/chrome/skin/browser.css b/mobile/chrome/skin/browser.css index 8aff5e00e6cc..1da67cec2989 100644 --- a/mobile/chrome/skin/browser.css +++ b/mobile/chrome/skin/browser.css @@ -246,6 +246,37 @@ toolbarbutton.browser-control-button { _moz-box-align: start; } +/* tab list */ + +.tab-list-container { + background-color: rgb(123,125,123); +} + +.tab-list { + -moz-appearance: none; + margin: 0; + padding: 4px; + background-color: rgb(123,125,123); +} + +richlistitem[type="documenttab"] { + -moz-appearance: none; + border: 1px solid transparent; + -moz-border-radius: 5px; + background: none; + padding: 4px; +} + +richlistitem[type="documenttab"][selected="true"] { + border: 1px solid white !important; +} + +.newtab-button { + -moz-appearance: none; + background-color: rgba(207,207,207,0.9); + font-size: 24pt; +} + /* autocomplete */ #popup_autocomplete {