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.
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
Commit-Queue: Bao-Duy Tran <firstname.lastname@example.org>
Reviewed-by: Sam McNally <email@example.com>
Reviewed-by: John Palmer <firstname.lastname@example.org>
Reviewed-by: Darren Shen <email@example.com>
1 file changed