Closed Bug 453535 Opened 13 years ago Closed 13 years ago

Cannot style INPUT TYPE=FILE completely (width is not applied correctly)


(Core :: Layout: Form Controls, defect)

Not set





(Reporter: josh.sickmate, Unassigned)




(3 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/2008072820 Firefox/3.0.1
Build Identifier: 

An INPUT TYPE=FILE element does not apply a width set with css (i.e. width: property) correctly.

The element is always the same width.

Reproducible: Always

Steps to Reproduce:
Create a HTML document with three INPUTs, and use CSS to give them three different widths, 50px, 100px and 150px.
Actual Results:  
The inputboxes will all be the same width, and content to the right will overlap the element.

Expected Results:  
The inputboxes will be the width specified.

I would expect that the button would always remain the same size (large enough to hold the label in the users langauge), wheres the textbox would change in size. Only if the requested size is smaller than the button size should the button be made smaller, and the textbox not shown at all.
Added a screenshot of how this looks in Firefox 3.0 beta 5
Added an example of how it should look
Attached file Testcase
The testcase used to create the screenshot
This bug is NOT a duplicate bug 52500, but rather a specific bug on a specific issue with a specific proposed solution.
How is this different from bug 290327?  (See 52500 comment 148.)
I'm going to mark this duplicate of bug 290327, which does in fact cover this very issue.  I'm really sorry I didn't see it before asking that a bug be filed. :(

Please take a look at bug 290327 comment 10 and let me know what you think of that approach?
Oh, if you do want to dive into code, the relevant code should be in layout/forms/nsFileControlFrame.cpp.  You want the GetMinWidth(), GetPrefWidth(), and Reflow() methods.

You might want to compare to what nsComboboxControlFrame.cpp does, since it sounds to me like the desired behavior of the two is the same.
Closed: 13 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 290327
You need to log in before you can comment on or make changes to this bug.