Supply client-tracked current_text to AutocorrectManager.

Technically speaking, clients of AutocorrectManager (via various API
surfaces) need not supply current_text. The source of truth isn't held
on the client side, but in CrOS IMF and ultimately in text field impls.
Requiring the client to pass current_text worsens the API.

IMEBridge::Get()->GetInputContextHandler()->GetSurroundingTextInfo() can
be queried by AutocorrectManager to obtain the info from IMF instead.

However, just like many other getters in CrOS IMF API, the above
GetSurroundingTextInfo() is unreliable; it can sometimes return a stale
value that no longer reflects reality, as the impl doesn't account for
async-ness between browser-process IMF and render-process text fields.

We work around this by having clients track and supply current_text
to AutocorrectManager, even though this worsens the API and assumes such
client-tracked value is correct and consistent.

Bug: 1159297, 1194424
Change-Id: I482ed8f7e1081b8ed1b4246a4a26557afa23d99f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2797138
Commit-Queue: Bao-Duy Tran <tranbaoduy@chromium.org>
Reviewed-by: Sam McNally <sammc@chromium.org>
Reviewed-by: John Palmer <jopalmer@chromium.org>
Reviewed-by: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#869947}
GitOrigin-RevId: 9da61f8670a601b00d493c23584086e52baaa4db
1 file changed