RESOLVED DUPLICATE of bug 15312 16789
Problem of using "size" attribute to determine width of text input field
https://bugs.webkit.org/show_bug.cgi?id=16789
Summary Problem of using "size" attribute to determine width of text input field
Yuzhu Shen
Reported 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
Attachments
Snapshot (402.95 KB, image/jpeg)
2008-01-08 19:05 PST, Yuzhu Shen
no flags
An example for the problem. (544 bytes, text/html)
2008-01-08 19:07 PST, Yuzhu Shen
no flags
Yuzhu Shen
Comment 1 2008-01-08 19:05:29 PST
Created attachment 18338 [details] Snapshot
Yuzhu Shen
Comment 2 2008-01-08 19:07:18 PST
Created attachment 18339 [details] An example for the problem.
zsurocking
Comment 3 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
Ojan Vafai
Comment 4 2009-03-24 18:41:04 PDT
*** This bug has been marked as a duplicate of 15312 ***
Note You need to log in before you can comment on or make changes to this bug.