Revert "Fix bugs and improve perf in Touch Bar text suggestions."
This reverts commit ad7c191591846d2138feeaa27d29db322a4cd0fe.
Reason for revert: Causes crashes (893038, 893222).
Original change's description:
> Fix bugs and improve perf in Touch Bar text suggestions.
>
> - The old implementation recreated the Touch Bar on each keystroke (including
> when hidden, I believe), which burns a significant amount of power while
> typing. This new implementation updates the existing candidate list, if it
> exists and isn't collapsed.
>
> - Removes a bunch of support code for a behavior that was disabled in r590669.
> It moves the remaining code into RWHV itself instead of a dedicated
> controller class, which I have mixed feelings about, but ultimately picked
> because after the support code was removed, most of what was left was
> plumbing between RWHV and TextSuggestionsTouchBarController.
>
> - [Bigish change] Moves text suggestions out of the window and into the RWHV,
> so that hiding and showing as focus and web contents change is left to AppKit
> and the responder chain.
>
> - Fixes small lifecyle-ish bugs around when use this kind of Touch Bar — now
> it's tied to the RWHV's input type instead of using a special
> WebContentsTextObserver.
>
> Bug: 717553, 881545
> Change-Id: I8e1eff6da7918f92cfdb47465196d5841a88a7e4
> Reviewed-on: https://chromium-review.googlesource.com/c/1212004
> Commit-Queue: Sidney San Martín <[email protected]>
> Reviewed-by: Avi Drissman <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#597371}
[email protected],[email protected]
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: 717553, 881545, 893222, 893038
Change-Id: Ia35f365b4cd46b98a7ffe0181fbf656fc4f9e672
Reviewed-on: https://chromium-review.googlesource.com/c/1269077
Reviewed-by: Avi Drissman <[email protected]>
Commit-Queue: Avi Drissman <[email protected]>
Cr-Commit-Position: refs/heads/master@{#597652}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 169aa36..7e93694a 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3246,6 +3246,15 @@
focused_frame->GetFrameInputHandler()->SelectRange(base, extent);
}
+#if defined(OS_MACOSX)
+void WebContentsImpl::DidChangeTextSelection(const base::string16& text,
+ const gfx::Range& range,
+ size_t offset) {
+ for (auto& observer : observers_)
+ observer.DidChangeTextSelection(text, range, offset);
+}
+#endif
+
void WebContentsImpl::MoveCaret(const gfx::Point& extent) {
RenderFrameHostImpl* focused_frame = GetFocusedFrame();
if (!focused_frame)