Simplify code for getting selected text.

As suggested by rniwa in review
https://chromiumcodereview.appspot.com/18041002/

This will match the corresponding change in WebKit:
https://bugs.webkit.org/show_bug.cgi?id=118684

BUG=none
TEST=layouttest

Review URL: https://chromiumcodereview.appspot.com/19357002

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