fix select text if multiple lines are the same width

Text selection works by building a region on the UI side, then
finding the text that matches the rectangles making up the
decomposed region on the webkit side.

If multiple consecutive lines of text are the same width, the
region will combine them into a single rectangle instead of
one rectangle per line.

If the rectangle chooses a single line, it's safe to pick the
center of the line in Y, and that's what the old code does. The
new code also tries the top and bottom of the rectangle, in
case the rectangle spans multiple lines of text, but falls
back to the old behavior so not to regress.

fixes http://b/issue?id=2166748
1 file changed