Closed
Bug 252783
Opened 20 years ago
Closed 20 years ago
text input doesn't consider letter-spacing for sizing
Categories
(Core :: Layout: Form Controls, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: onlynone, Assigned: MatsPalmgren_bugz)
Details
(Keywords: testcase)
Attachments
(3 files, 1 obsolete file)
454 bytes,
text/html
|
Details | |
23.23 KB,
image/png
|
Details | |
1.31 KB,
patch
|
bzbarsky
:
review+
MatsPalmgren_bugz
:
superreview+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040626 Webimpala/0.9.1 (Firefox/0.9.1) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040626 Webimpala/0.9.1 (Firefox/0.9.1) A text form input seems to ignore the "letter-spacing" style information when calculating it's width. It seems to calculate the width based on there being no letter-spacing. Now I don't know if style information is supposed to be considered when picking a size for a form element, but setting the "font-size" does affect the size of an input. The following html snippet gives shows what I mean: <p>The following text input has a size of 10, a maxlength of 10, and a letter-spacing of 0em. Ten characters fit inside the input nicely.</p> <input type="text" size="10" maxlength="10" style="letter-spacing: 0em"> <p>The following text input has a size of 10, a maxlength of 10, and a letter-spacing of 1em. The letter-spacing is ignored when calculating the width of the input, as you can see by typing 10 characters and having it scroll.</p> <input type="text" size="10" maxlength="10" style="letter-spacing: 1em"> <p>The following text input has a size of 10, a maxlength of 10, and a font-size of 20pt. Here, some style information (font-size) *is* used to calculate the input's width (and height in this case).</p> <input type="text" size="10" maxlength="10" style="font-size: 20pt"> Like I said, I don't know how much style information is supposed to be used when calculating the size of an input, but it seems that since some information is used then it might be best to be consistent... (of course this is probably one of those things left up to the user-agents I'm sure) Reproducible: Always Steps to Reproduce: 1. Specify a size of 10 on a text input form element 2. Give the input a style consiting of "letter-spacing: 1em" 3. Check the resulting page Actual Results: You won't be able to fit 10 of characters into the input without it scrolling to the right. Expected Results: I expected that the input would be wider to accomodate the extra letter-spacing.
Assignee | ||
Comment 1•20 years ago
|
||
Assignee | ||
Comment 2•20 years ago
|
||
Taking bug, this is a trivial fix if we want to do it...
Assignee: nobody → mats.palmgren
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: testcase
OS: Windows 2000 → All
Summary: text input doesn't consider letter-spacing for sizing → [FIX] text input doesn't consider letter-spacing for sizing
Assignee | ||
Comment 3•20 years ago
|
||
Assignee | ||
Comment 4•20 years ago
|
||
Assignee | ||
Updated•20 years ago
|
Attachment #154138 -
Flags: superreview?(dbaron)
Attachment #154138 -
Flags: review?(bzbarsky)
Comment on attachment 154138 [details] [diff] [review] Patch rev. 1 >+ // Increment width with cols * letter-spacing. >+ { >+ const nsStyleText* textStyle = GetStyleText(); >+ if (eStyleUnit_Coord == textStyle->mLetterSpacing.GetUnit()) { >+ nscoord letterSpacing = textStyle->mLetterSpacing.GetCoordValue(); Why have a |const nsStyleText*| varable when you could have a |const nsStyleCoord&| variable, e.g.: const nsStyleCoord& lsCoord = GetStyleText()->mLetterSpacing; etc. With that, sr=dbaron
Attachment #154138 -
Flags: superreview?(dbaron) → superreview+
Assignee | ||
Comment 6•20 years ago
|
||
Updated as suggested in comment 5
Attachment #154138 -
Attachment is obsolete: true
Assignee | ||
Updated•20 years ago
|
Attachment #154138 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 7•20 years ago
|
||
Comment on attachment 154151 [details] [diff] [review] Patch rev. 2 Moving sr=dbaron from comment 5
Attachment #154151 -
Flags: superreview+
Attachment #154151 -
Flags: review?(bzbarsky)
Comment 8•20 years ago
|
||
Comment on attachment 154151 [details] [diff] [review] Patch rev. 2 r=bzbarsky
Attachment #154151 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 9•20 years ago
|
||
FYI, I did check all the other form controls and they seem to work except <input type="file"> which I filed bug 252863 on.
Assignee | ||
Comment 10•20 years ago
|
||
Checked in to trunk 2004-08-07 15:04 PDT -> FIXED
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Summary: [FIX] text input doesn't consider letter-spacing for sizing → text input doesn't consider letter-spacing for sizing
You need to log in
before you can comment on or make changes to this bug.
Description
•