Bug 16789 - Problem of using "size" attribute to determine width of text input field
Summary: Problem of using "size" attribute to determine width of text input field
Status: RESOLVED DUPLICATE of bug 15312
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 523.x (Safari 3)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-08 19:04 PST by Yuzhu Shen
Modified: 2009-03-24 18:41 PDT (History)
1 user (show)

See Also:


Attachments
Snapshot (402.95 KB, image/jpeg)
2008-01-08 19:05 PST, Yuzhu Shen
no flags Details
An example for the problem. (544 bytes, text/html)
2008-01-08 19:07 PST, Yuzhu Shen
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yuzhu Shen 2008-01-08 19:04:24 PST
When using "size" attribute to determine the width of text input field, "its value refers to the (integer) number of characters" (HTML 4.0.1). Webkit (Safari 3.0.4 / 523.15) multiplies character width with this "size" value to determine the width, while IE & FF seem to use a non-linear algorithm.

The html file in the attachment illustrates the difference between these browsers, please view it in various browsers and observe the width of the input fields.

This problem affects many popular Chinese websites. For example: (Please refer to the attachment for snapshot.)

http://vip.bokee.com/register.php
http://www.5show.com/
http://www.cnfol.com/
http://www.people.com.cn/
http://www.92wy.com/
http://www.uusee.com/
http://www.wangyou.com/index2.html
Comment 1 Yuzhu Shen 2008-01-08 19:05:29 PST
Created attachment 18338 [details]
Snapshot
Comment 2 Yuzhu Shen 2008-01-08 19:07:18 PST
Created attachment 18339 [details]
An example for the problem.
Comment 3 zsurocking 2008-03-10 02:41:02 PDT
I think this bug lies in RenderTextControl::calcPrefWidths().
It's better to use tmAveCharWidth rather than "using 0 as the nominal character"

Also, in order to match IE, Firefox use "tmAveCharWidth * size + tmMaxCharWidth - 4" as the actual pixel width of the input text filed.
The code is here:
http://lxr.mozilla.org/mozilla/source/layout/forms/nsTextControlFrame.cpp
in nsTextControlFrame::CalcIntrinsicSize
Comment 4 Ojan Vafai 2009-03-24 18:41:04 PDT

*** This bug has been marked as a duplicate of 15312 ***