Closed Bug 102440 Opened 20 years ago Closed 4 years ago

Mozilla obeys invalid maxwidth attribute on text form controls


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






(Reporter: smoehle, Assigned: dbaron)


(Depends on 1 open bug, )


(Keywords: dev-doc-complete, testcase)


(3 files)

The above url has a form with an text input that has a maxwidth attribute:

<INPUT TYPE="TEXT" NAME="email" SIZE="30" maxwidth="40">

As far as I can tell, there is no version of HTML that has a maxwidth attribute
for text input controls.  I think the author of the page probably meant
maxlength, but I really am not sure.

Mozilla, however, obeys this maxwidth attribute rendering the text control 40
pixels wide.  In fact it takes it over the size attribute which has a reasonable
value.  As a result, the form is unusable in Mozilla as the text input control
is far too narrow to actually type in.

Both NN4 and Opera ignore the maxwidth attribute and render the text control 30
characters wide which is what I think Mozilla should do as well.

Tested with Mozilla trunk build 2001092906 on Linux.
Attached file Simplified test case
confirming.  <div> elements do not seem to do maxwidth..

now, we have maxwidth in XUL, but I don't see how this would affect HTML
Ever confirmed: true
Keywords: testcase
The problem is the GfxText uses the nsBox for part of it's sizing and the 
nsIBox::AddCSSMaxSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize)

Checks for a XULATom:maxwidth and name space none and it should really only be 
looking at the XUL namespace.

Or somehow the nsBox needs to NOT do this when sizing an HTML control.

Over to evaughan
Assignee: rods → evaughan
Reassigning to Alex.
Assignee: eric → alexsavulov
Target Milestone: --- → mozilla1.1
*** Bug 131597 has been marked as a duplicate of this bug. ***
I also see this on Win2k using RC1 (build id: 2002041711). 

This html:
<input type="text" name="foo" maxwidth="3" size="5">
displays on mozilla as a VERY thin line.
In IE 5.5 and netscape 4.7 it displays as a text box.

*** Bug 207373 has been marked as a duplicate of this bug. ***
OS->all based on last 2 comments
OS: Linux → All
Target Milestone: mozilla1.1alpha → Future
We should just move the maxwidth XUL stuff into the XUL attribute-mapping code
(which we should create).
Depends on: 216838
Assignee: alexsavulov → nobody
QA Contact: madhur → layout.form-controls
Duplicate of this bug: 645137
(In reply to comment #11)
> *** Bug 645137 has been marked as a duplicate of this bug. ***

Thanks, Boris.  I just needed to use a different name, other than maxWidth, for my custom attribute name.
Depends on: 644514
Attached patch patchSplinter Review
This started off as bug 644514 patch 2, but it really doesn't have anything to do with that bug, and a lot to do with this one, so let's put it here.
Assignee: nobody → dbaron
Attachment #527168 - Flags: review?(bzbarsky)
Flags: in-testsuite?
Comment on attachment 527168 [details] [diff] [review]

r=me, but add some tests, please?
Attachment #527168 - Flags: review?(bzbarsky) → review+
Comment on attachment 527168 [details] [diff] [review]

>           <html:input anonid="input"
>                       class="autocomplete-textbox urlbar-input textbox-input uri-element-right-align"
>-                      flex="1" allowevents="true"
>+                      style="-moz-box-flex: 1" allowevents="true"
Instead of inline style please put this in toolkit/content/textbox.css
ok... I also had to put it in menulist.css, since menulist.xml doesn't use the textbox-input class.
Closed: 10 years ago
Priority: -- → P4
Hardware: x86 → All
Resolution: --- → FIXED
Target Milestone: Future → mozilla6
(In reply to comment #17)
> ok... I also had to put it in menulist.css, since menulist.xml doesn't use the
> textbox-input class.

That might be a bug, or it might be a limitation of XBL1. I'll look into it.
Updated documentation by adding a note to Firefox 6 for developers; this was never documented as supported, so it's more of a relnote type issue.
Blocks: 659982
Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20100101 Firefox/6.0

Verified issue on Windows XP, Windows 7, Mac OS X 10.6 and Ubuntu, using the test case from Comment 12. 

Setting resolution to VERIFIED FIXED.
Pushed by
Make nsBox more careful about accepting XUL attributes only on XUL elements. r=bzbarsky
Closed: 10 years ago4 years ago
You need to log in before you can comment on or make changes to this bug.