commit | ca3673952c583172cf76d1937489c795d75dd5b7 | [log] [tgz] |
---|---|---|
author | Tessa Nijssen <tnijssen@google.com> | Fri Aug 03 21:38:43 2018 |
committer | Commit Bot <commit-bot@chromium.org> | Fri Aug 03 21:38:43 2018 |
tree | f0ad56690308d90c5d32d56dbf47d7d39d4d6fb7 | |
parent | fada6a1516817114773e424bc994b20851fd1d16 [diff] |
Reland [Mac] Re-Generate Text Suggestions on WebContents Update Previously, each tab had its own SuggestedTextTouchBarController. Now, because of http://crrev/c/1151613, there is only one SuggestedTextTouchBarController per window. Because the controller does not maintain the state of each tab, as a user switches tabs, the controller needs to update its state to match the tab. When the controller's WebContents change, new suggestions should be generated for the selected text in the current tab. The methods -webContentsTextSelectionChanged:range: and -webContentsFinishedLoading were combined into a singular method, -updateTextSelection:range:, because they had very similar functionality. The parameters for -requestSuggestionsForText:inRange: were removed because they were always |text_| and |selectionRange_|. A new method was created, -webContentsChanged, to get a tab's current text and selected range and then call -updateTextSelection:range: with the proper parameters. When the controller gets a new pointer to a WebContents, the pointer may be null. To avoid calling WebContents::IsFocusedElementEditable() on a null pointer, a method -isTextfieldFocused was created to check that |webContents_| is not a null pointer and that an editable element is focused. A new SuggestedTextTouchBarControllerBrowserTest was written, SetWebContentsTest, to test that the SuggestedTextTouchBarController properly updates its current text selection based on the new WebContents. This CL is the same as http://crrev/c/1153728 with the following changes: - Browser tests for methods that are not restricted to MacOS 10.12.2+ were modified to also run on earlier versions of MacOS. The expected behavior for different MacOS versions is accounted for in the tests. - A call to UnfocusTextfield() was added to SetWebContentsTest to ensure that a later call to FocusTextfield() works as intended and focuses an editable element. Bug: 717553 Change-Id: Id061e392dd279e7a3cc9a34a023eb9bd97e52940 Reviewed-on: https://chromium-review.googlesource.com/1160929 Reviewed-by: Avi Drissman <avi@chromium.org> Commit-Queue: Tessa Nijssen <tnijssen@google.com> Cr-Commit-Position: refs/heads/master@{#580658}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure .