Trigger spell check/remove markers if spell checker gets enabled/disabled.

With this change when spell checker is turned off the misspelling markers
disappear from the document (which is what a user expects and this currently
works in chromium because UI code takes care of that - with this change it may
stop). OTOH if spell checker is turned on again one would expect misspellings
will appear right away - in the currently focused editable at least. This is how
Gecko and Presto behave and this is what this patch does. Note it's not only
about restoring old markers because content might have changed or language might
have been switched. This is why new check is requested. This change may also
come in handy if spell checking language is changed. It would require restarting
spell checker on UI side on language change, though.

Since there might be an awful lot of text in the focused editable when spell
checker gets enabled, spell checking is chunked up. If asynchronous spell
checker is enabled whole text is checked. Otherwise only one chunk is checked
(the default chunk's size is set to 16KB but it might also be slightly bigger
since all chunks are aligned to the sentence boundary).

BUG=264737

This is the second attempt as this patch was integrated but
reverted due to performance regression found by
DOM/textarea-edit.html (issue 274569). This patch optimizes
single chunk case to try to avoid the regression.

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

git-svn-id: svn://svn.chromium.org/blink/trunk@156378 bbb929c8-8fbe-4397-9dbb-9b2b20218538
11 files changed
tree: 84be14d2fdfd0a532fc0fa9ec4ad102d9e99c699
  1. third_party/