Closed Bug 454667 Opened 16 years ago Closed 16 years ago

Add ability to close tabs

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
fennec1.0a1

People

(Reporter: madhava, Assigned: mfinkle)

Details

(Whiteboard: UI polish)

Attachments

(2 files, 1 obsolete file)

Right now, there's now visible way to close a tab in Fennec (there may be a key combination).  We should have one!

Along these lines: http://blog.seanmartell.com/wp-content/uploads/2008/09/fennec_screen_4.jpg
Assignee: nobody → mark.finkle
Attached patch WIP 1: first pass patch (obsolete) — Splinter Review
This patch adds the (x) image over the tab thumbnail and support clicking the (x) to close the tab.

The patch has some problems: Clicking (x) for the selected tab seems to work ok, but trying to close a tab that is not selected (the current tab) results in some "this.browser = null" errors. For some reason the display list is not updating fast enough(?)
Target Milestone: Fennec A2 → Fennec A1
Whiteboard: UI polish
Attached patch full patchSplinter Review
This patch can remove the selected or any unselected tab. It also hides the "remove" button if there is only 1 tab
Attachment #338406 - Attachment is obsolete: true
Attachment #339948 - Flags: review?(gavin.sharp)
Comment on attachment 339948 [details] [diff] [review]
full patch

>diff --git a/chrome/content/deckbrowser.xml b/chrome/content/deckbrowser.xml

>+            if (!nextTab)
>+              return;

We probably want to remove the current tab and add a new blank one in this case to match tabbrowser behavior, right? Can do in a followup (we have a bunch of other tabbrowser-compat bugs to fix).

>+      <constructor><![CDATA[
>+        let close = document.getAnonymousElementByAttribute(this, "anonid", "close");
>+        let closefn = new Function("event", parentNode.getAttribute("onclosetab"));

explicit "this.parentNode" would be clearer.

>+        var self = this;
>+        close.addEventListener("mousedown", function(event) { closefn.call(self, event); event.stopPropagation(); }, true);
>+      ]]></constructor>

Can you use a <handler> for this instead?
Attachment #339948 - Flags: review?(gavin.sharp) → review+
(In reply to comment #4)
> (From update of attachment 339948 [details] [diff] [review])
> >diff --git a/chrome/content/deckbrowser.xml b/chrome/content/deckbrowser.xml
> 
> >+            if (!nextTab)
> >+              return;
> 
> We probably want to remove the current tab and add a new blank one in this case
> to match tabbrowser behavior, right? Can do in a followup (we have a bunch of
> other tabbrowser-compat bugs to fix).

Followup sounds good

> 
> >+      <constructor><![CDATA[
> >+        let close = document.getAnonymousElementByAttribute(this, "anonid", "close");
> >+        let closefn = new Function("event", parentNode.getAttribute("onclosetab"));
> 
> explicit "this.parentNode" would be clearer.

Done

> 
> >+        var self = this;
> >+        close.addEventListener("mousedown", function(event) { closefn.call(self, event); event.stopPropagation(); }, true);
> >+      ]]></constructor>
> 
> Can you use a <handler> for this instead?

I'll test out a patch to get it working. The handler is currently on the image, not the richlistitem, but we probably do stuff like that in the tree.

Followup bug 457635

http://hg.mozilla.org/mobile-browser/rev/385a8f06a09c (missed a review comment)
http://hg.mozilla.org/mobile-browser/rev/f18cbb0c115a (main landing)
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
verified in 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: