Closed Bug 343585 Opened 18 years ago Closed 18 years ago

tab scrolling: scenario where open link in background doesn't enable the scroll button

Categories

(Firefox :: Tabbed Browser, defect, P1)

x86
Windows XP
defect

Tracking

()

RESOLVED FIXED
Firefox 2 beta2

People

(Reporter: moco, Assigned: asaf)

References

Details

(Keywords: fixed1.8.1, regression, Whiteboard: [mustfix] (assuming scroll indicators stay))

Attachments

(1 file)

tab scrolling:  scenario where open link in background doesn't enable the scroll button

to reproduce:

1)  open up enough tabs where you get the scroll box arrows
2)  click the right scroll box arrow until it disabled
3)  open a new link in the background

the right scroll box arrow continues to appear disabled.  note, it is clickable and will do the correct thing if you click on it.
Status: NEW → ASSIGNED
Keywords: regression
Priority: -- → P1
Target Milestone: --- → Firefox 2 beta1
Target Milestone: Firefox 2 beta1 → Firefox 2 beta2
I was trying to fix this by adding a DOMNodeInserted handler (phase=capturing) in the scrollbox binding (which contains the scrollbox-innerbox into which the <xu:tab>s are added). For some reason, the event isn't always dispatched (or doesn't bubble?). The handler is never called when i'm adding the second tab. and is _almost_ never called when i'm adding tabs in the background.

CCing Smaug, Boris and jst.
I think it would be less hackish if a new (internal?) XUL event was invented, a box-changed event, that would fire when a box changed size.

The scrollbox would watch that, and adjust its arrows accordingly.
s/in the scrollbox binding/in the arrowscrollbox binding
Flags: blocking-firefox2?
(In reply to comment #1)
> I was trying to fix this by adding a DOMNodeInserted handler (phase=capturing)
> in the scrollbox binding (which contains the scrollbox-innerbox into which the
> <xu:tab>s are added). For some reason, the event isn't always dispatched (or
> doesn't bubble?). The handler is never called when i'm adding the second tab.
> and is _almost_ never called when i'm adding tabs in the background.
> 

I do get the DOMNodeInserted event every time, but the style of the right arrow button isn't updated.

Flags: blocking-firefox2? → blocking-firefox2+
Smaug: This turns out to be a xbl issue, it looks like my handler isn't attached at the same time the binding is applied (i.e. once I do get DOMNodeInserted dispatched, i do get it for each new tab); tested on windows (1.8.1).
I'm going to work around this in tabbrowser.xml and file a separate bug on something like comment 2.
Keywords: uiwanted
Whiteboard: [mustfix] (assuming scroll indicators stay)
Attached patch patchSplinter Review
This also fixes bug 338254
Attachment #229944 - Flags: superreview?(mconnor)
Attachment #229944 - Flags: review?(sspitzer)
Attachment #229944 - Flags: superreview?(mconnor) → superreview+
Comment on attachment 229944 [details] [diff] [review]
patch

r=sspitzer, but a couple nits (and questions)

1)  nit, _delaydUpdate -> _delayedUpdate

2)  can this temporary workaround function be made into a method so we don't have to duplicate the code (and the comment?)  also, please log a spin off bug on a non-temporary fix.
 
3)  we've discussed this in another bug, but the reason you are removing this TabFoo event hander is "they're being dispatched from the tabbrowser binding itself".  Should we log a bug on removing the TabSelect handler?

-      <handler event="TabClose"  action="this.adjustTabstrip(true);"/>
Attachment #229944 - Flags: review?(sspitzer) → review+
related to this code is also bug #342105 (Close button not shown if there is only one tab) which as a patch, but I have not review or tested yet.

I'll wait until after asaf lands this one to re-work that patch.
Blocks: 342105
"(assuming scroll indicators stay)"

ben/mconnor/beltzner/pkasting, I'm under the impression that scroll indicators are staying.  is that the wrong assumption?
(In reply to comment #10)
> "(assuming scroll indicators stay)"
> 
> ben/mconnor/beltzner/pkasting, I'm under the impression that scroll indicators
> are staying.  is that the wrong assumption?

I have asked ben and beltzenr to use the current trunk patch and give their thoughts on this particular issue.  They have both told me they will do so.
(In reply to comment #8)
> (From update of attachment 229944 [details] [diff] [review] [edit])
> r=sspitzer, but a couple nits (and questions)
> 
> 1)  nit, _delaydUpdate -> _delayedUpdate

will do on checkin.

> 2)  can this temporary workaround function be made into a method so we don't
> have to duplicate the code (and the comment?)

I don't think it's worth it, because:
 * the setTimeout call, together with the that i'm passing different values to adjustTabstrip.
 * There are only two places which need this sort-of-hacky workaround.
 * I don't want to expose this as part of the tabbrowser API.

> also, please log a spin off bug on a non-temporary fix.

will do.

> 3)  we've discussed this in another bug, but the reason you are removing this
> TabFoo event hander is "they're being dispatched from the tabbrowser binding
> itself".  Should we log a bug on removing the TabSelect handler?
> 
> -      <handler event="TabClose"  action="this.adjustTabstrip(true);"/>

Yes, though TabSelect is still fired from the tabbox binding (see bug 343096); note we could move whatever it does now to the onselect handler.
Note to self: also file a bug on the DOMNodeInserted listener issue.
>  * the setTimeout call, together with the that i'm passing different values >to adjustTabstrip.

can't you do: 

setTimeout(_delayedUpdate, 0, this.mTabContainer, true);
setTimeout(_delayedUpdate, 0, this.mTabContainer, false);

and make your method take two arguments, aTabContainer and a boolean that you pass to adjustTabstrip?
As I noted somewhere else, we shouldn't add <method>s in which "this" doesn't point to the binding (this is always the case for callbacks).
With sspitzer agreement (on IRC), landed this on trunk without adding a general method (see comment 8, comment 12 and comment 14).

mozilla/toolkit/content/widgets/tabbrowser.xml 1.169
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
> As I noted somewhere else....

from https://bugzilla.mozilla.org/show_bug.cgi?id=343251#c146

> I don't see how "this" (in my original _handleAllTabsSelect() method) 
> points to something other than the binding.  Can you elaborate?

asaf wrote:

"When you're passing a callback method to methods like addEventListener and
setTimeout, "this" doesn't point to the js object in which the callback
function is scoped in (when the method is called)."

thanks for fixing this, asaf.
Filed bug 345399.
Attachment #229944 - Flags: approval1.8.1?
Comment on attachment 229944 [details] [diff] [review]
patch

a=mconnor on behalf of drivers for checkin to the 1.8 branch
Attachment #229944 - Flags: approval1.8.1? → approval1.8.1+
1.8 branch: mozilla/toolkit/content/widgets/tabbrowser.xml 1.103.2.56
Keywords: fixed1.8.1
Blocks: 360473
No longer blocks: 360473
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: