From 23c790aeb9aa3703db78bc7bc4dbde8bfea0c2e9 Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Wed, 8 Jul 2009 10:55:07 -0400 Subject: [PATCH] Bug 494194: button to close fullscreen screens, r=gavin --- mobile/chrome/content/bindings.xml | 11 +++ mobile/chrome/content/browser-ui.js | 63 +++++++++++++++--- mobile/chrome/content/browser.xul | 5 +- mobile/themes/hildon/browser.css | 20 +++++- .../hildon/images/fullscreen-close-40.png | Bin 0 -> 1240 bytes .../themes/hildon/images/fullscreen-up-40.png | Bin 0 -> 1060 bytes mobile/themes/hildon/jar.mn | 2 + mobile/themes/hildon/platform.css | 4 +- mobile/themes/wince/browser.css | 20 +++++- .../wince/images/fullscreen-close-40.png | Bin 0 -> 1240 bytes .../themes/wince/images/fullscreen-up-40.png | Bin 0 -> 1060 bytes mobile/themes/wince/jar.mn | 2 + mobile/themes/wince/platform.css | 4 +- 13 files changed, 112 insertions(+), 19 deletions(-) create mode 100644 mobile/themes/hildon/images/fullscreen-close-40.png create mode 100644 mobile/themes/hildon/images/fullscreen-up-40.png create mode 100644 mobile/themes/wince/images/fullscreen-close-40.png create mode 100644 mobile/themes/wince/images/fullscreen-up-40.png diff --git a/mobile/chrome/content/bindings.xml b/mobile/chrome/content/bindings.xml index 6f081bc6f32..102ecd74458 100644 --- a/mobile/chrome/content/bindings.xml +++ b/mobile/chrome/content/bindings.xml @@ -115,6 +115,8 @@ this.hidden = false; this._popupOpen = true; + BrowserUI.pushDialog(this); + this.invalidate(); ]]> @@ -129,6 +131,15 @@ this.hidden = true; this._popupOpen = false; + + BrowserUI.popDialog(); + ]]> + + + + + diff --git a/mobile/chrome/content/browser-ui.js b/mobile/chrome/content/browser-ui.js index 535a46106a3..31f22a8380f 100644 --- a/mobile/chrome/content/browser-ui.js +++ b/mobile/chrome/content/browser-ui.js @@ -74,12 +74,12 @@ const kDefaultFavIconURL = "chrome://browser/skin/images/favicon-default-30.png" }); var BrowserUI = { - _panel : null, _edit : null, _throbber : null, _autocompleteNavbuttons : null, _favicon : null, _faviconLink : null, + _dialogs: [], _titleChanged : function(aDocument) { var browser = Browser.selectedBrowser; @@ -193,6 +193,40 @@ var BrowserUI = { } }, + _closeOrQuit: function _closeOrQuit() { + // Close active dialog, if we have one. If not then close the application. + let dialog = this.activeDialog; + if (dialog) + dialog.close(); + else + CommandUpdater.doCommand("cmd_quit"); + }, + + get activeDialog() { + // Return the topmost dialog + if (this._dialogs.length) + return this._dialogs[this._dialogs.length - 1]; + return null; + }, + + pushDialog : function pushDialog(aDialog) { + // 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") + } + }, + + popDialog : function popDialog() { + // Passing null means we pop the topmost dialog + if (this._dialogs.length) + this._dialogs.pop(); + + // If no more dialogs are being displayed, remove the attr for CSS + if (!this._dialogs.length) + document.getElementById("toolbar-main").removeAttribute("dialog") + }, + switchPane : function(id) { document.getElementById("panel-items").selectedPanel = document.getElementById(id); }, @@ -611,7 +645,7 @@ var BrowserUI = { goQuitApplication(); break; case "cmd_close": - close(); + this._closeOrQuit(); break; case "cmd_menu": break; @@ -654,7 +688,7 @@ var BookmarkHelper = { _panel: null, _editor: null, - edit: function(aURI) { + edit: function BH_edit(aURI) { let itemId = PlacesUtils.getMostRecentBookmarkForURI(aURI); if (itemId == -1) return; @@ -680,6 +714,7 @@ var BookmarkHelper = { this._panel = document.getElementById("bookmark-container"); this._panel.top = (top < 0 ? 0 : top); this._panel.hidden = false; + BrowserUI.pushDialog(this); let self = this; setTimeout(function() { @@ -690,18 +725,20 @@ var BookmarkHelper = { window.addEventListener("keypress", this, true); }, - close: function() { + close: function BH_close() { window.removeEventListener("keypress", this, true); BrowserUI.updateStar(); - if (this._editor.isEditing) - this._editor.stopEditing(); - this._panel.hidden = true; - + // Note: the _editor will have already saved the data, if needed, by the time + // this method is called, since this method is called via the "close" event. this._editor.parentNode.removeChild(this._editor); + this._editor = null; + + this._panel.hidden = true; + BrowserUI.popDialog(); }, - handleEvent: function(aEvent) { + handleEvent: function BH_handleEvent(aEvent) { if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE) this.close(); } @@ -716,6 +753,7 @@ var BookmarkList = { this._panel.width = window.innerWidth; this._panel.height = window.innerHeight; this._panel.hidden = false; + BrowserUI.pushDialog(this); this._bookmarks = document.getElementById("bookmark-items"); this._bookmarks.manageUI = false; @@ -733,6 +771,7 @@ var BookmarkList = { this._bookmarks.blur(); this._panel.hidden = true; + BrowserUI.popDialog(); }, toggleManage: function() { @@ -759,10 +798,11 @@ var FolderPicker = { show: function(aControl) { this._panel = document.getElementById("folder-container"); - this._panel.hidden = false; this._panel.width = window.innerWidth; this._panel.height = window.innerHeight; - + this._panel.hidden = false; + BrowserUI.pushDialog(this); + this._control = aControl; let folders = document.getElementById("folder-items"); @@ -771,6 +811,7 @@ var FolderPicker = { close: function() { this._panel.hidden = true; + BrowserUI.popDialog(); }, moveItem: function() { diff --git a/mobile/chrome/content/browser.xul b/mobile/chrome/content/browser.xul index 8d694dd31de..96d783ce158 100644 --- a/mobile/chrome/content/browser.xul +++ b/mobile/chrome/content/browser.xul @@ -251,6 +251,7 @@ + @@ -416,7 +417,7 @@ + command="cmd_close"/> &foldersHeader.label; + command="cmd_close"/> diff --git a/mobile/themes/hildon/browser.css b/mobile/themes/hildon/browser.css index 6d6ecbd78db..54ee8b6fd63 100644 --- a/mobile/themes/hildon/browser.css +++ b/mobile/themes/hildon/browser.css @@ -62,6 +62,17 @@ toolbarbutton.urlbar-button { list-style-image: url("chrome://browser/skin/images/bookmarks-active-64.png"); } +#tool-app-close { + 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[dialog="true"] #tool-app-close { + list-style-image: url("chrome://browser/skin/images/fullscreen-up-40.png"); +} + /* URL bar cap buttons */ toolbarbutton.urlbar-cap-button { margin: 0; @@ -290,7 +301,10 @@ toolbarbutton.page-button { /* URL List and autocomplete navigation popup ------------------------------ */ #tool-bookmarks-close, #tool-folders-close { - list-style-image: url("chrome://browser/skin/images/bookmarks-active-64.png"); + min-height: 0 !important; + min-width: 0 !important; + margin-top: -40px; /* keep pixels */ + list-style-image: url("chrome://browser/skin/images/fullscreen-up-40.png"); } #bookmarklist-container { @@ -303,6 +317,10 @@ toolbarbutton.page-button { padding: 2.2mm; /* core spacing */ } +#folder-header { + height: 21.4mm; /* fake the height of the URLbar: 17mm + 2.2mm + 2.2mm */ +} + #bookmark-items, #folder-items { -moz-appearance: none !important; background-color: rgb(255,255,255); diff --git a/mobile/themes/hildon/images/fullscreen-close-40.png b/mobile/themes/hildon/images/fullscreen-close-40.png new file mode 100644 index 0000000000000000000000000000000000000000..b01722dd6093088d2bdfefafbb78d69f84424222 GIT binary patch literal 1240 zcmV;}1Sk86P)bx(z)2Hz7$hDHCk~rUxTpsv>iXR5%>$rf_DGgZNQ~jBL1N^g zk+%tGcJ zKMO}Xlgacm09i{*iyWpAWD4N=`Z^1DKqZ2$t*zd0fGQ~|vHJmTY-}iiKA$fv9<|D& z0d8(?Dvjmk<*)!$dHz=s3@bpD=lcbmo0~gGI+~uI{&F|_h6G$$SqTX^GBWaOOiWBw zZf-8?=;(N7u~;6ZrKLRy)OUDzxHdL6_5%8Lc6N4Kt=31Wsi}YO8Q|>fY-UzgR#jVD z8;gsJWBvX8nZ?D$*GET3S#ol6qrUIN#DwPpSzTS7(r#~WcTjzUkLDc%(q61wSY2J+ z7LX=CRa#oAz`?S!vl(CkIXO8gCnY5*kkixC9+%6d!NH1(ir~i)%7>mu10<6;pcG>4 zM~aN!1s&v#nVA_`lBCS?@^Y6Rjz?4(FW^Jt(EuYNB9zA3+S;~vM{DoThK7a{g@uJ@ z+-`Ru$eW0;5pH2&ft8h&;dIgv%7>muA3<3JkRO5SD=I4R^9#tnzCM7!a0&NR;<>chB`uh4{ zkawwBF5*MSvjs@|sUm^FPTCPF1HtixxI>B47z~oEQUp-Pvz5ivkd5gb#PYFa1%bOw z&1gp^rV0fJ&#rg zMI-oEQ&ZCeg1UrA;!%=gz+EwZ5m4(SZH?ydB#a4|10&%ED& zU;qo4zy`p#Q&Uri>7^!`)?w6s1A+l8U;>-EF5Py!-Ayk=hkAQ^Z8$&dhu|9wU;&f1 z)sgjhz1~C$uQNVA-bVDcZyh=Kgl{l_1x$Xs3#vZp7n{v?xw^VKdueGYaejW@HaIwF z<@Ivcg}LDazTgwS!N6H8YN6In?4(nq0}yqdr}gmO;c$389?!pf@rk3RrY5nwyW37R zFLiNoF&-b-xSk?GjDWBV90>SzL@t`&iFJ=Y!(em3i;9o`#^ZiY8q#ldM*9KBDpJBX z{$})v^n&z{-&^E10|0u2|4-OMC;*Kc!BqQCfB^u1zHb6w0v>q)0000|f literal 0 HcmV?d00001 diff --git a/mobile/themes/hildon/images/fullscreen-up-40.png b/mobile/themes/hildon/images/fullscreen-up-40.png new file mode 100644 index 0000000000000000000000000000000000000000..397498e79c9b8b241436572a51a415def39c960e GIT binary patch literal 1060 zcmV+<1l#+GP)?ZUgLAF38x=H_lhA$g|(47WRd1DkTyD8CYLy5V&PzZzw5i3LzkpdMpn88G+ zp85xPF0aaUDYfS?TvGDb8kvZOFQ&>{o$Db z=~~PW?CJ-QAqoY<`?&6Jtrhf`S5m=HTEUqYiFwZ+AKzj%E=j29RrOYt6x6 zkQEgbJ<3!kdZZoXG6m8R-&s~x*1WW|l=A<9Kme2Gfq?!Ra8{4zP`RckRFf6i}e(Ke@yfwI#^g( z$jRktqJ&N%zErrHni@7eJ>BK=`D`?F$LsaVJLy9wDIT2GK8YvZK@13kr)5)1OG{cD z%|4@iO~_!XP6DZ*1}E{vJ4h$hnEdcg6JH6E3ipa;p9;g1C_+dS@Q9tH6FDY76x5J< z;y~KoN;mPl!NI{^Lfx&duIBeQD*RG{V=^S`@9+1NmzOhI597TGYDhhCAf54+jv7?~B_94f7+qLc&xWiHVC)yId|!zHu{vE7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`&iFJ=Y!(em3i;9o`#^ZiY8q#ldM*9KBDpJBX z{$})v^n&z{-&^E10|0u2|4-OMC;*Kc!BqQCfB^u1zHb6w0v>q)0000|f literal 0 HcmV?d00001 diff --git a/mobile/themes/wince/images/fullscreen-up-40.png b/mobile/themes/wince/images/fullscreen-up-40.png new file mode 100644 index 0000000000000000000000000000000000000000..397498e79c9b8b241436572a51a415def39c960e GIT binary patch literal 1060 zcmV+<1l#+GP)?ZUgLAF38x=H_lhA$g|(47WRd1DkTyD8CYLy5V&PzZzw5i3LzkpdMpn88G+ zp85xPF0aaUDYfS?TvGDb8kvZOFQ&>{o$Db z=~~PW?CJ-QAqoY<`?&6Jtrhf`S5m=HTEUqYiFwZ+AKzj%E=j29RrOYt6x6 zkQEgbJ<3!kdZZoXG6m8R-&s~x*1WW|l=A<9Kme2Gfq?!Ra8{4zP`RckRFf6i}e(Ke@yfwI#^g( z$jRktqJ&N%zErrHni@7eJ>BK=`D`?F$LsaVJLy9wDIT2GK8YvZK@13kr)5)1OG{cD z%|4@iO~_!XP6DZ*1}E{vJ4h$hnEdcg6JH6E3ipa;p9;g1C_+dS@Q9tH6FDY76x5J< z;y~KoN;mPl!NI{^Lfx&duIBeQD*RG{V=^S`@9+1NmzOhI597TGYDhhCAf54+jv7?~B_94f7+qLc&xWiHVC)yId|!zHu{vE7HcT@!GkU!2%thk6Q3JJ56Sal=#RkE|FDS+(%3G8d zkhJgy?GN9ps;VM>zke+kC*=0_cFXwqxOH}R_R7}QRxw_%3Hcreh#ZJ;Qo4n4bj~RJ z5`B&?8V7h3!ZVog8JqhP