User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040626 Firefox/0.9.1
The following XUL demonstrates the problem. The tabs will appear in the
incorrect order : first, second, fourth, third.
<!-- XML Start here -->
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<tab id="fourthTab" label="fourth" hidden="true"/>
<label value="First page"/>
<label value="second page"/>
<label value="third page"/>
<label value="fourth page"/>
<!-- XML End -->
Steps to Reproduce:
1. View code placed in 'Details' in mozilla browser
Third tab appears after the Fourth tab, rather then where it should appear, before.
Display the tabs in the order they are defined in the XUL - First, Second,
This bug occurs at least in FF 9.x, 1.0PR and Mozilla Navigator, on OSes Win98,
Win2000 and Debian Linux.
Created attachment 160748 [details]
Looks like frame construction gets confused about where the frame for the
In particular, the problem is that the XBL inserts a spacer at the beginning of
the child list of the <tabs> and that in nsCSSFrameConstructor::ContentInserted
we call nsCSSFrameConstructor::FindPreviousSibling to find the previous sibling.
But we use aIndexInContainer as the place to start looking, and our index in
the content iterator is actually one larger (because of the anonymous content
See the XXX comment before the FindPreviousSibling() call in ContentInserted();
that's biting us here, basically.
Created attachment 160758 [details] [diff] [review]
Assert fired by that testcase
I think the best thing to do here would be to make GetInsertionPoint() return
not only the insertion point but also the index of the content in the insertion
point.... That would replace aIndexInContainer for the following manipulations,
Alternately, we need to fix FindPreviousSibling() to not start with
aIndexInContainer, since that can end up bogus.
*** Bug 366116 has been marked as a duplicate of this bug. ***
A hack(?) would be to wrap the tabs <children> with <hbox>, which has the added side-effect of making ordinal on <tab>s work as expected (since consumers don't have to understand the spacers on the ends of the <tabs>). Of course, doing that causes crashes (why wouldn't it? eXtremely Unstable Languages are the best!), so I'm not going to pursue cleaning up the theme to look right.
(In reply to comment #6)
>A hack(?) would be to wrap the tabs <children> with <hbox>
Unfortunately this stops the tabs from flexing properly, so it's no use.
I'm pretty sure setting .collapsed instead should mitigate these problems (at least some of them).
Fixed by checkin for bug 307394. Checked in test.