Font metrics reported by DirectWrite are a touch larger than those reported by GDI...
commit63ebd5da9c9957773b48e335d01ffd90231db3a5
authorananta <ananta@chromium.org>
Fri, 23 Jan 2015 03:16:02 +0000 (22 19:16 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 23 Jan 2015 03:17:27 +0000 (23 03:17 +0000)
treee14093fb787172a7f45f5eaf8583ba8192a428c8
parentda5dd9776a6f08332b582404b6e2ae2bfde631f4
Font metrics reported by DirectWrite are a touch larger than those reported by GDI on Windows.

As a result the selection rectangle in RenderText at times fills the textfield completely leading to ugliness.

The fix is to ensure that the RenderText centering baseline which is used to calculate the line offsets is greater than the font list baseline. This is achieved by
calculating the baseline shift via a floating point division and rounding up.

BUG=445366
TEST=Covered by gfx_unittest RenderTextTest.CenteringBaselineTest, RenderTestText.CenteringBaselineTestForUniscribeFonts

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

Cr-Commit-Position: refs/heads/master@{#312753}
ui/gfx/render_text.cc
ui/gfx/render_text_unittest.cc