Factor out wordbreak detection code and run it for simple insertions too

Wordbreak detection was only done for "complex changes", not
for "simple insertions". This worked because we made sure to
always pawn at the edge of an splitOnWordbreak annotation
(through the forceContinuation property), so typing there is
a replacement (replacing a pawn), and that's considered complex
rather than simple.

However, to facilitate future changes as well as for general
non-WTF-y-ness, we should be consistent and also apply the
wordbreak logic for simple insertions. I still don't like
the wordbreak code that much, but at least this change makes
it look a bit less like it works completely by accident.

ve.ce.Surface#onContentChange:
* Factor out wordbreak logic to internal function
* Also call this function in the simple insertion code path
* Cache word break checks out of the loop
* Bail early if no word breaks detected
* Simplify complex change code by adding replacementRange variable
  (needed for call to filterForWordbreak() anyway)
* Replace instanceof check that's always true with length check
* Reuse values of previousStart and nextStart where possible
* Move computation of previousData, nextData and lengthDiff
  to initialization
* Rename dataString to nextDataString, now computed at
  initialization time rather than being recomputed in every
  single loop iteration
* Add TODO about sameLeadingAndTrailing being ignored

Change-Id: I9290782002dfc47f01c383278580ed0b754ab2e2
Merge "Factor out wordbreak detection code and run it for simple insertions too"