Bug 32981

Summary: with (large) padding, text string in text input field is not pushed down accordingly.
Product: WebKit Reporter: Philippe Wittenbergh <phiw2>
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: UNCONFIRMED ---    
Severity: Normal CC: adele, joepeck, joone, les_sion, priyajeet.hora, rainboxx, roc
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.6   
Attachments:
Description Flags
minimal testcase
none
screenshot of test case none

Description Philippe Wittenbergh 2009-12-27 23:38:45 PST
Created attachment 45545 [details]
minimal testcase

In the test case: an input field (text field, input[type="text"]) has 400px padding-top. However, the text string ('abcd' in textcase) inside the input field is placed in the vertical center (~200px from top).

Expected: test string positioned at the bottom of the textfield.

(test case is a reduction from the search field on YouTube)

Correct: Firefox 3.6 +, Opera 10.0, 10.5, IE 8.
Fails: WebKit latest, Safari 4

See partly related Gecko bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=525897

The Gecko 'bug' is visible on sites such as Apple.com and YouTube.com
Comment 1 Philippe Wittenbergh 2009-12-27 23:40:49 PST
Created attachment 45547 [details]
screenshot of test case

left: WebKit latest nightly
right: Minefield (Gecko latest nightly)
Comment 2 Joseph Pecoraro 2010-04-26 19:21:41 PDT
There is explicit code in RenderTextControlSingleLine::layout to center the text of an <input type="text"> and <input type="search">. Can anyone comment on whether or not this is something that WebKit wants to fix or not?
Comment 3 Joseph Pecoraro 2010-04-26 19:29:06 PDT
(In reply to comment #2)
> There is explicit code in RenderTextControlSingleLine::layout to center the
> text of an <input type="text"> and <input type="search">. Can anyone comment on
> whether or not this is something that WebKit wants to fix or not?

At r58177:
http://trac.webkit.org/browser/trunk/WebCore/rendering/RenderTextControlSingleLine.cpp#L234
Comment 4 Adele Peterson 2010-04-26 21:26:05 PDT
We do intentionally center text.  It might be to match historical WebKit behavior.  We should not change this without doing significant investigation to make sure we wouldn't regress layout on existing websites.
Comment 5 Alumni 2011-01-12 08:07:06 PST
(In reply to comment #4)
> We do intentionally center text.  It might be to match historical WebKit behavior.  We should not change this without doing significant investigation to make sure we wouldn't regress layout on existing websites.

Is there any way a developer could achieve the results of all other browsers in webkit?

The following code works in IE6/Firefox/Opera, but not in any webkit browser:

label { position:absolute; top:50px; left:25px; }
input { border:1px solid black; height:100px; padding:70px 25px 10px; width:300px; }
...
<label for="sometext">The text:</label>
<input type="text" id="sometext" placeholder="Enter text here"/>
Comment 6 Darth 2011-03-21 01:53:01 PDT
Downstream bug http://code.google.com/p/chromium/issues/detail?id=76883
Test case from it http://jingwei.li/temp/bug.html

Webkit differs from Firefox.
Comment 7 Matt 2011-09-25 05:44:02 PDT
Are there any plans to fix this misbehaviour? It is really annoying to not be able to proper align the text within input fields. All other major browser are doing this right, except Webkit/Safari.

See this jsfiddle for another test case: http://jsfiddle.net/7Rncd/.