Closed Bug 810595 Opened 13 years ago Closed 13 years ago

input text size attribute ignored

Categories

(Core :: Layout: Form Controls, defect)

16 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: brunis, Unassigned)

Details

Attachments

(1 file)

Attached file html5-tests.html
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0 Build ID: 20121025210744 Steps to reproduce: used size attribute in input=text Actual results: a size=1 is equal to a size=7, but it does seem to scale nicely. so the formula seems to be n+6. Expected results: size=1 should be a size=1
Comment on attachment 680363 [details] html5-tests.html ><!DOCTYPE html> ><html> ><head> ><meta charset="utf-8"> ><title>Html5 playground</title> ></head> ><body> ><form> > <label for="size1">Amount</label><input id="size1" size="1" type="text"><br> > <label for="size2">Amount</label><input id="size2" size="2" type="text"><br> > <label for="size3">Amount</label><input id="size3" size="3" type="text"><br> > <label for="size4">Amount</label><input id="size4" size="4" type="text"><br> > <label for="size5">Amount</label><input id="size5" size="5" type="text"><br> > <label for="size6">Amount</label><input id="size6" size="6" type="text"><br> > <label for="size7">Amount</label><input id="size7" size="7" type="text"><br> > <label for="size8">Amount</label><input id="size8" size="8" type="text"><br> > <label>pay now?</label><input type="checkbox"><br> > <input value="submit" type="submit"> ></form> ></body> ></html>
Attachment #680363 - Attachment mime type: text/plain → text/html
You're using a variable-width font. What "size" should do there is define like so in the spec at http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#converting-a-character-width-to-pixels : The converting a character width to pixels algorithm returns (size-1)×avg + max, where size is the character width to convert, avg is the average character width of the primary font for the element for which the algorithm is being run, in pixels, and max is the maximum character width of that same font, also in pixels. So the width you get for a variable width font depends on the exact font and the ratio of "max" to "avg" for that font. It sounds like in your particular font that ratio is about 7. For me, it's about 3. So everything is working as it should, at first glance.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
ok, i get a far better result with font-family: sans; and as expected a perfect match with a monospace font. Thanks for teaching me html! :) But shouldn't firefox pick a sans/monospace font for input then? .. i mean.. I didn't pick the font.. the defaults are bad the way i see it :)
The font we use for text inputs is the "-moz-field" system font, which on Linux means whatever font GTK is set to use in things created with gtk_entry_new. Are you seeing us use a different font from other GTK apps for text fields in your case?
It seems to be the Ubuntu default font that has this issue. Tried 10 others and they have no issues. I'll submit a bug with Ubuntu. Sorry to have unnecessarily bothered you.
No bother. Please do keep reporting issues as you run into them!
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: