Closed
Bug 363858
Opened 18 years ago
Closed 17 years ago
[FIX][reflow branch] Options in selects can have padding and margin now, which can result in exponential growth
Categories
(Core :: Layout: Form Controls, defect, P4)
Tracking
()
VERIFIED
FIXED
mozilla1.9beta2
People
(Reporter: martijn.martijn, Assigned: bzbarsky)
References
(Depends on 1 open bug)
Details
(Keywords: regression, testcase, Whiteboard: [dbaron-1.9:RwCr])
Attachments
(3 files)
796 bytes,
text/html
|
Details | |
20.71 KB,
patch
|
dbaron
:
review+
dbaron
:
superreview+
|
Details | Diff | Splinter Review |
1.28 KB,
patch
|
dbaron
:
review+
dbaron
:
superreview+
|
Details | Diff | Splinter Review |
See upcoming testcase.
<option>'s (and <optgroup>'s) can now have margin and padding, which can result in really long comboboxes, like demonstrated in the testcase.
This changed between 2006-12-07 and 2006-12-08, so very likely something that changed with the landing of the reflow branch.
Reporter | ||
Comment 1•18 years ago
|
||
Assignee | ||
Comment 2•18 years ago
|
||
I get some asserts too. The issue is that IntrinsicForContainer returns an unconstrained pref width in the case when the percentages add up to 100% and a very large pref width when they just add up to close to 100%.
I'm really not quite sure what we can do about this, short of using !important to fix the margins/padding/borders of options inside a select. Or somehow getting rid of the "min width is pref width" thing that <select> does. I suppose we could get rid of it if we disabled all wrapping of options and just used the min-width of the block.
David, does anything obvious jump out at you here?
Oh, and a fieldset with a legend which has a div with percent padding/margins asa child has a similar problem, I bet...
Flags: blocking1.9?
Flags: blocking1.9? → blocking1.9+
Updated•17 years ago
|
OS: Windows XP → All
Comment 3•17 years ago
|
||
See also bug 370872
Comment 5•17 years ago
|
||
Here are the reduced testcases from duplicate bug 370872:
attachment 256781 [details]
attachment 280133 [details]
Updated•17 years ago
|
Whiteboard: [dbaron-1.9:RwCr]
Priority: -- → P4
Comment 6•17 years ago
|
||
One interesting thing I just discovered:
On Linux, the first time I click on a very-wide <select>, I get a dropdown menu. BUT subsequent clicking on the <select> won't make it come back. The only ways I can get it to come back are to either reload or to click a different drop-down menu.
e.g. on attachment 248667 [details]:
Click the huge <select>.
--> wide dropdown appears.
Click elsewhere to make it disappear.
Click the big <select> again.
--> ***nothing drops down***!!! Weeeeeeird...
Click a smaller <select>.
--> smaller dropdown appears.
Click elsewhere to make it disappear.
Click big select again.
--> wide dropdown appears again. Yay!
Assignee | ||
Comment 7•17 years ago
|
||
Can't return GetPrefWidth for GetMinWidth, since the former can be unconstrained...
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Attachment #289275 -
Flags: superreview?(dbaron)
Attachment #289275 -
Flags: review?(dbaron)
Assignee | ||
Comment 8•17 years ago
|
||
As a note, I'll fix fieldsets in bug 404123, I think.
Target Milestone: --- → mozilla1.9 M10
Assignee | ||
Updated•17 years ago
|
Summary: [reflow branch] Options in selects can have padding and margin now, which can result in exponential growth → [FIX][reflow branch] Options in selects can have padding and margin now, which can result in exponential growth
Comment on attachment 289275 [details] [diff] [review]
Proposed patch
r+sr=dbaron
Attachment #289275 -
Flags: superreview?(dbaron)
Attachment #289275 -
Flags: superreview+
Attachment #289275 -
Flags: review?(dbaron)
Attachment #289275 -
Flags: review+
Assignee | ||
Updated•17 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 11•17 years ago
|
||
Luckily, the tests caught it. ;)
Attachment #291167 -
Flags: review?(dbaron)
Comment 12•17 years ago
|
||
Could this have regressed bug 406729?
Assignee | ||
Comment 13•17 years ago
|
||
Not likely, since this code isn't used by the url bar...
The scrolling fix in that date range is a more likely culprit imo.
Reporter | ||
Comment 14•17 years ago
|
||
Verified fixed, using the testcase with:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b2pre) Gecko/2007120405 Minefield/3.0b2pre
Status: RESOLVED → VERIFIED
Comment on attachment 291167 [details] [diff] [review]
Missed a file in the patch
>Index: layout/forms/nsListControlFrame.cpp
> nscoord
> nsListControlFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
> {
>- // We don't want to have options wrapping unless they absolutely
>- // have to, so our min width is our pref width.
>+ // Scrollframes typically have an intrinsic min width of 0, but
>+ // that's not how we want to behave.
dholbert changed that today (?), but you may still want to override to add the scrollbar width
> nscoord result;
> DISPLAY_MIN_WIDTH(this, result);
>
>- result = GetPrefWidth(aRenderingContext);
>+ result = GetScrolledFrame()->GetMinWidth(aRenderingContext);
>+ nsBoxLayoutState bls(PresContext(), aRenderingContext);
>+ result += GetDesiredScrollbarSizes(&bls).LeftRight();
Are there ever cases where listboxes don't have scrollbars? Should you check GetScrollbarStyles().mVertical ? And what's the difference between GetScrollbarMetrics (which nsHTMLScrollFrame::GetPrefWidth uses) and GetDesiredScrollbarSizes?
Attachment #291167 -
Flags: superreview+
Attachment #291167 -
Flags: review?(dbaron)
Attachment #291167 -
Flags: review+
Comment 16•17 years ago
|
||
(In reply to comment #15)
> >+ // Scrollframes typically have an intrinsic min width of 0, but
> >+ // that's not how we want to behave.
>
> dholbert changed that today (?)
Correct -- see bug 402567.
Assignee | ||
Comment 17•17 years ago
|
||
> but you may still want to override to add the scrollbar width
Yes, I do. I saw that patch, and it adds the scrollbar width sometimes but not always. Here we do want it always, since caller unconditionally subtracts it.
> Are there ever cases where listboxes don't have scrollbars?
No. But there are times when a list control frame doesn't have a scrollbar: when it's the dropdown for a combobox with not too many items in it. Nevertheless, we want to include the scrollbar with in the value in that case (since caller unconditionally subtracts it).
> And what's the difference
None, if all you want is the pref size in the direction perpendicular to the scrollbar. GetScrollbarMetrics is a static method that takes a pointer to a box and returns its GetMinSize/GetPrefSize (plus margin) as an nsSize.
GetDesiredScrollbarSizes takes the vertical and horizontal scrollbar boxes, gets the pref sizes (as nsSize), adds the margins, and returns the width of the vertical scrollbar and the height of the horizontal one, as well as information about which side the scrollbar is on (which my caller ignores).
Comment 18•17 years ago
|
||
(In reply to comment #17)
> > but you may still want to override to add the scrollbar width
>
> Yes, I do. I saw that patch, and it adds the scrollbar width sometimes but not
> always. Here we do want it always, since caller unconditionally subtracts it.
Actually, the final checked-in patch, "fix v3b", never adds scrollbar width. It just returns the scrolled frame's min-width.
But it sounds like that probably doesn't affect you here, because you want to _always_ add scrollbar width.
For reference, "fix v3b" is at:
https://bugzilla.mozilla.org/attachment.cgi?id=291471&action=diff
You need to log in
before you can comment on or make changes to this bug.
Description
•