Closed Bug 222990 Opened 21 years ago Closed 21 years ago

[FIX]Changing select element style mistakenly alters its height

Categories

(Core :: Layout: Form Controls, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla1.6alpha

People

(Reporter: chris+bugzilla, Assigned: bzbarsky)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5) Gecko/20031007
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.5) Gecko/20031007

We have reproduced this bug in Mozilla 1.5 on Mac OSX and Windows 2000.

When JavaScript changes the class of a <select> element, and the subsequent
class has a different hard-coded width value, the height of the select changes.

In our test HTML, we alternate between two styles:
   .large { width: 100px; height: 30px }
   .small { width: 0px }


Reproducible: Always

Steps to Reproduce:
1. Go to the test URL
2. Click "Reduce"
3. Click "Enlarge"

Actual Results:  
The select has a reduced height.

Expected Results:  
The height should not have been affected.

We tried the following potential workarounds, all of which still exhibited the bug:
  * set the height to 30px in the .small style
  * set the width to between 1 and 4 pixels in the .small style

The following change prevented the bug's appearance:
  * set the width to 5 or more pixels in the .small style
Nope, pure reflow bug..
Assignee: dom_bugs → form
Component: DOM Style → Layout: Form Controls
Taking.
Assignee: form → bzbarsky
Priority: -- → P1
Summary: Changing select element style mistakenly alters its height → [FIX]Changing select element style mistakenly alters its height
Target Milestone: --- → mozilla1.6alpha
Attached patch FixSplinter Review
You have fallen into a Special Case.... <sigh>
Comment on attachment 133739 [details] [diff] [review]
Fix

roc, would you review?	The problem is that the "width is 0" special case fucks
up the height, and this gets cached.  So we keep losing the borderpadding width
on every iteration...
Attachment #133739 - Flags: superreview?(roc)
Attachment #133739 - Flags: review?(roc)
Attachment #133739 - Flags: superreview?(roc)
Attachment #133739 - Flags: superreview+
Attachment #133739 - Flags: review?(roc)
Attachment #133739 - Flags: review+
Fixed.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
+    aDesiredSize.height = dispHeight + aBorderPadding.top + aBorderPadding.bottom;;

nit: there's one semicolon too much
Doh.  Fixed.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: