Fix InputMethodController::setCompositionFromExistingText

IME only knows plain text characters, while Chrome sees extra collapsed white spaces, thus IME and Chrome may assign different numeric values to the same position. E.g. when you put the cursor at the beginning of the input field in http://jsfiddle.net/N2sp3/7/show/, while IME thinks the composition starts at position 0, Chrome sees the leading new line in html and thus thinks the starting position is 1.

Currently InputMethodController::setCompositionFromExistingText receives plain text composition offsets from IME, compositionStart and compositionEnd, and simply assigns them to m_compositionStart and m_compositionEnd. The former are plain text offsets excluding collapsed white spaces, while the later are used in a way that assumes collapsed white spaces are included, thus simple assignment such as m_compositionStart = compositionStart will give incorrect results when there are collapsed white spaces.

Instead Chrome should convert the offsets by calling PlainTextRange::createRange.

BUG=376909
TEST=load the example URL http://jsfiddle.net/N2sp3/7/show/ on android, make sure the input method is the default english keyboard, delete characters from the end, and confirm that all characters can be deleted properly.

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

git-svn-id: svn://svn.chromium.org/blink/trunk@177813 bbb929c8-8fbe-4397-9dbb-9b2b20218538