Don't create multiple WebRange objects for getting selection text.

Editable HTML content is very laggy when it is relatively large. Lag
is caused by creation of WebRange object with given location and offset.
Bigger the editable content and farther the location, the more the lag.

Currently we create WebRange object twice - once for checking presence
of text (plain) and again for fetching actual plain text. It causes the
lag to double the actual value. This patch removes unneccessary double
creation of WebRange.

Sample page and traces showing the lag and improvement with this patch
are attached with the bug.

BUG=396051

R=avi,jochen,yosin

TBR=jochen

TESTS=None

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

Cr-Commit-Position: refs/heads/master@{#308261}
1 file changed