Increase the text padding insets for TextFields on Windows with DirectWrite enabled...
commit3478fc9ac46e2be4283cea9c609c27a0d83bdb86
authorananta <ananta@chromium.org>
Fri, 13 Mar 2015 19:42:25 +0000 (13 12:42 -0700)
committerCommit bot <commit-bot@chromium.org>
Fri, 13 Mar 2015 19:43:03 +0000 (13 19:43 +0000)
tree771630a6867d972a5a65a959e4b0cc172daaf1f5
parentbed8fdc7a0995427e0af24e63693ad790920b612
Increase the text padding insets for TextFields on Windows with DirectWrite enabled for UI font metrics by 1 px.

DirectWrite font metrics are 1, 2 px larger than their GDI counterparts. The default font height is used to calculate the
textfield height.

When the selection rectangle is drawn around text, the bounds of the selection rectangle are calculated based on the rectangle
comprising the text which is based off the font used to render the text.

While the above logic works well in the normal case, it does not work if the text field starts rendering Devnagri or text with
larger dimensions. Reason being the text height is a touch larger for these fonts.

To account for that, the proposal is to set the text padding for textfields on Windows with DirectWrite to 4px instead of the
traditional 3px.

This works well in my testing.

BUG=445366
TBR=msw
TEST=Navigate to http://www.indianrail.gov.in/hindex.html. Bring up the bookmark bubble. The bookmark highlight in the name field in the bubble should not be shifted upwards.

Review URL: https://codereview.chromium.org/1007633002

Cr-Commit-Position: refs/heads/master@{#320553}
ui/views/controls/textfield/textfield.cc