Avoid flicker in the new omnibox inline autocomplete
The user may see flickering of autocomplete text if onDraw() is called inside keyboard app's batch edited IME operations. For example, consider the following sequence of events: 1) beginBatchEdit() 2) commitText() 3) onDraw() 4) endBatchEdit() 5) onDraw() With current implementation, onDraw() at step 3) and onDraw() at step 5) may see different getText() because we remove span at beginBatchEdit() and does not add a new one until endBatchEdit(). In order to ensure that span is added at the end of every IME operation, even including beginBatchEdit(), the current internal calls to beginBatchEdit() and endBatchEdit() have been separated out as onBeginImeCommand() and onEndImeCommand(), respectively. And then beginBatchEdit() and endBatchEdit() will simply increment / decrement batch edit count inside these new IME command guards. And we remove / add span in the IME command guards even when they are not the outermost ones, to ensure that onDraw() can see the span when necessary. Note that notification is not affected thanks to the count guard. BUG=539536 Change-Id: Ia1f044dd3c2669658dd363e4375f841c9c448f37 Reviewed-on: https://chromium-review.googlesource.com/568914Reviewed-by:Ted Choc <tedchoc@chromium.org> Reviewed-by:
Alexandre Elias <aelias@chromium.org> Commit-Queue: Changwan Ryu <changwan@chromium.org> Cr-Commit-Position: refs/heads/master@{#486169}
Showing
Please register or sign in to comment