Closed Bug 494194 Opened 15 years ago Closed 15 years ago

button to close fullscreen screens

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(fennec1.0b3+)

VERIFIED FIXED
Tracking Status
fennec 1.0b3+ ---

People

(Reporter: madhava, Assigned: mfinkle)

References

Details

Attachments

(2 files, 2 obsolete files)

We need a way to get out of the awesomescreen, and we can generalize this to provide a app-quit button and a way to get out of the bookmark screen once the bookmark button is out of the title bar (see bug 494191).

See attached image.
Attached image sketch of solution
didn't take the first time, for some reason
tracking-fennec: --- → ?
also - the icon doesn't have to be an arrow
Blocks: 477628
tracking-fennec: ? → 1.0b3+
Attached patch patch (obsolete) — Splinter Review
This patch adds a simple mechanism for dialogs to register themselves with the application. When registered, the application knows it is visible and will close the dialog when the special button is pressed. If no dialog is visible and the special button is pressed, the app will closed.

* ctrl+w is also hooked up to the mechanism
* dialogs must implement a "close" method for the mechanism to work
* current support: awesomebar autocomplete, bookmark list, bookmark editor, bookmark folder picker
* The patch changes the toolbarbutton style to 17mm as this matches the 64px buttons and allows the special close button to position correctly
Assignee: nobody → mark.finkle
Attachment #384217 - Flags: review?(gavin.sharp)
Blocks: 501766
Comment on attachment 384217 [details] [diff] [review]
patch

>diff --git a/chrome/content/browser-ui.js b/chrome/content/browser-ui.js

> var BrowserUI = {

>+  _closeOrQuit: function _closeOrQuit() {
>+    // Close dialogs until we have none left, then close the application
>+    let dialog = this.activeDialog;
>+    if (dialog)
>+      dialog.close();
>+    else
>+      CommandUpdater.doCommand("cmd_quit");

The comment doesn't really match the method or method (only closes one dialog).

>+  get activeDialog() {
>+    // Return the topmost dialog
>+    if (this._dialogs.length)
>+      return this._dialogs[0];
>+    return null;
>+  },

>+  set activeDialog(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")
>+      return;
>+    }
>+
>+    // 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")
>+  },

This is a really strange API, I wouldn't expect it to be possible for activeDialog to be non-null right after I set it to null... How about a pushDialog()/popDialog() API instead?

>-  close: function() {
>+  close: function BH_close() {

>-    if (this._editor.isEditing)
>-      this._editor.stopEditing();
>+    // Note: the _editor will have already saved the data, if needed, by the time
>+    // this method is called.

What guarantees this?
(In reply to comment #7)
> (From update of attachment 384217 [details] [diff] [review])
> >diff --git a/chrome/content/browser-ui.js b/chrome/content/browser-ui.js
> 
> >+  _closeOrQuit: function _closeOrQuit() {
> >+    // Close dialogs until we have none left, then close the application
> >+    let dialog = this.activeDialog;
> >+    if (dialog)
> >+      dialog.close();
> >+    else
> >+      CommandUpdater.doCommand("cmd_quit");
> 
> The comment doesn't really match the method or method (only closes one dialog).

Change comment to:
// Close active dialog, if we have one. If not then close the application.

> This is a really strange API, I wouldn't expect it to be possible for
> activeDialog to be non-null right after I set it to null... How about a
> pushDialog()/popDialog() API instead?

Added pushDialog(aDialog) and popDialog(). I kept the readonly activeDialog property

> >-    if (this._editor.isEditing)
> >-      this._editor.stopEditing();
> >+    // Note: the _editor will have already saved the data, if needed, by the time
> >+    // this method is called.
> 
> What guarantees this?

The "close" method is called from the "onclose" event in the binding _after_ the data has been saved.
Attached patch patch 2 - addresses comments (obsolete) — Splinter Review
Unbitrotted and addressed comments
Attachment #384217 - Attachment is obsolete: true
Attachment #387278 - Flags: review?(gavin.sharp)
Attachment #384217 - Flags: review?(gavin.sharp)
Same as patch 2, but adds the pushDialog/popDialog needed for the BookmarkList
Attachment #387278 - Attachment is obsolete: true
Attachment #387288 - Flags: review?(gavin.sharp)
Attachment #387278 - Flags: review?(gavin.sharp)
Comment on attachment 387288 [details] [diff] [review]
patch 3 - missed bookmarklist

(In reply to comment #8)
> The "close" method is called from the "onclose" event in the binding _after_
> the data has been saved.

My question was more "why is onclose garanteed to fire after things have been saved", but I guess stopEditing is what fires the "close" event.

>diff --git a/chrome/content/browser-ui.js b/chrome/content/browser-ui.js

>+  _closeOrQuit: function _closeOrQuit() {

>+  get activeDialog() {
>+    // Return the topmost dialog
>+    if (this._dialogs.length)
>+      return this._dialogs[0];
>+    return null;

Don't really need to bother with the length check, right? Can return || null if you really care about null vs. undefined (and the strict warning, I guess?).

>+  pushDialog : function pushDialog(aDialog) {

>+    if (aDialog) {

Doesn't make any sense to call this with a null argument, right?

Doesn't FolderPicker need the same cmd_close/pushDialog/popDialog treatment? This seems to mess up the close button icon in the bookmark folder list popup (appears slightly offscreen), at least on Mac. And what about HelperAppDialog? I guess it's not as big/modal so maybe it doesn't make sense using this button?
Attachment #387288 - Flags: review?(gavin.sharp) → review+
(In reply to comment #11)
> (From update of attachment 387288 [details] [diff] [review])
> (In reply to comment #8)
> > The "close" method is called from the "onclose" event in the binding _after_
> > the data has been saved.
> 
> My question was more "why is onclose garanteed to fire after things have been
> saved", but I guess stopEditing is what fires the "close" event.

right

> >+  get activeDialog() {
> >+    // Return the topmost dialog
> >+    if (this._dialogs.length)
> >+      return this._dialogs[0];
> >+    return null;
> 
> Don't really need to bother with the length check, right? Can return || null if
> you really care about null vs. undefined (and the strict warning, I guess?).

Closer inspection reveals an error here. It should be | return this._dialogs[this._dialogs.length - 1]; |, so I kept the "if"

> >+  pushDialog : function pushDialog(aDialog) {
> 
> >+    if (aDialog) {
> 
> Doesn't make any sense to call this with a null argument, right?

Right, but that doesn't mean it won't happen. I removed the uneeded "return" in there though.

> Doesn't FolderPicker need the same cmd_close/pushDialog/popDialog treatment?
> This seems to mess up the close button icon in the bookmark folder list popup
> (appears slightly offscreen), at least on Mac. And what about HelperAppDialog?
> I guess it's not as big/modal so maybe it doesn't make sense using this button?

I added the code for FolderPicker and fixed the height of the header to match the URLbar.

HelperAppDialog doesn't need this yet, but we could add it later.
pushed: http://hg.mozilla.org/mobile-browser/rev/31dc31f6f1d9
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
verfied with beta3
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: