User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8b2) Gecko/20050524 Firefox/1.0+ Build Identifier: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8b2) Gecko/20050524 Firefox/1.0+ If a XUL listbox is in a box with another XUL element, both with flex="1", the listbox comes out much bigger than the other element. Testcases to be attached. Reproducible: Always
+kw testcase, although i have no idea what i'm meant to be seeing/not seeing here..
The listbox and tree in both examples should be the same size; they're not.
confirmed with linux trunk 2005052401 ==> xul
Listboxes have a default size of 200x200. Trees have a default size of 0x0. (ignoring margins, borders, etc.) Thus the listbox will be 200px larger.
Sorry but this explanation makes no sense. Nothing in any XUL documentation or specifications leads me to believe that this behavior is correct, and absolutely every other case works according to the flex attributes. Why should listboxes be any different, and why should the default size affect how it works with the flex attribute? I'm sorry, but this is a bug.
The default height of the listbox is 200. The default height of the tree is 0. If the height of the window is 800 pixels, there will be 600 pixels of remaining space. Since both elements are equally flexible (flex="1"), the remaining space will be divided equally among both elements, which is 600 divided by 2 = 300 pixels per element. The listbox will become 500 pixels and the tree will be 300 pixels. Which is what I see happening in a recent Firefox build.
OK I think I understand what you're saying, and setting the width and height to 0 works as a workaround. I would put forth however that trees and lists, at least, should have the same "default" size because <vbox> <listbox height="0" flex="1"/> <tree flex="1"/> </vbox> isn't how I, or I believe most people, would expect that to work in order to get equal-sized boxes.
You can use <vbox equalsize="always"> <listbox flex="1"/> <tree flex="1"/> </vbox> if you want the children to be the same size. I don't see any reason to change the default size of listboxes/trees which have been in place for a long time, just for this particular circumstance. You shouldn't be relying on any particular default size for an element anyway since it may vary by platform/theme.