[Mac] TextSuggestionsTouchBarController Ignore Replacement Selection
When a user selects a suggestion, the editing word range is selected for replacement with the suggestion's text. Currently, that selection causes a call to WebContentsObserver::DidChangeTextSelection() which updates the TextSuggestionsTouchBarController's text selection to the editing word range. This change in text selection modifies the appearance of the touch bar which is undesired. The change in text selection for replacing the editing word should be ignored by the TextSuggestionsTouchBarController. A variable, |shouldIgnoreReplacementSelection_|, is set to YES when the TextSuggestionsTouchBarController modifies the current text selection to replace the editing word. When the that text selection update reaches TextSuggestionsTouchBarController, the selection will be ignored and |shouldIgnoreReplacementSelection_| will be reset to NO. This fixes the behavior where the touch bar appearance changes before showing suggestions post-replacement. A browser test was added, TextSuggestionsTouchBarControllerTest.IgnoreReplacementSelection, to test that a text selection is only ignored when necessary and that other selection updates are not ignored. Bug: 717553 Change-Id: Ib442d98b96e499acd73856399bcd89adf0f9c1d9 Reviewed-on: https://chromium-review.googlesource.com/1164167Reviewed-by:Avi Drissman <avi@chromium.org> Reviewed-by:
Sarah Chan <spqchan@chromium.org> Commit-Queue: Tessa Nijssen <tnijssen@google.com> Cr-Commit-Position: refs/heads/master@{#581660}
Showing
Please register or sign in to comment