Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(659)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_base.cc

Issue 2240553003: Track text selection on the browser side (Mac) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the failing tests on 'mac_chromium_rel_ng' Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_base.h" 5 #include "content/browser/renderer_host/render_widget_host_view_base.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/browser/accessibility/browser_accessibility_manager.h" 9 #include "content/browser/accessibility/browser_accessibility_manager.h"
10 #include "content/browser/gpu/gpu_data_manager_impl.h" 10 #include "content/browser/gpu/gpu_data_manager_impl.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 if (GetTextInputManager()) 110 if (GetTextInputManager())
111 GetTextInputManager()->SelectionBoundsChanged(this, params); 111 GetTextInputManager()->SelectionBoundsChanged(this, params);
112 } 112 }
113 113
114 void RenderWidgetHostViewBase::SelectionChanged(const base::string16& text, 114 void RenderWidgetHostViewBase::SelectionChanged(const base::string16& text,
115 size_t offset, 115 size_t offset,
116 const gfx::Range& range) { 116 const gfx::Range& range) {
117 // TODO(ekaramad): Use TextInputManager code paths for IME on other platforms. 117 // TODO(ekaramad): Use TextInputManager code paths for IME on other platforms.
118 // Also, remove the following local variables when that happens 118 // Also, remove the following local variables when that happens
119 // (https://crbug.com/578168 and https://crbug.com/602427). 119 // (https://crbug.com/578168 and https://crbug.com/602427).
120 #if defined(USE_AURA) 120 #if !defined(OS_ANDROID)
121 if (GetTextInputManager()) 121 if (GetTextInputManager())
122 GetTextInputManager()->SelectionChanged(this, text, offset, range); 122 GetTextInputManager()->SelectionChanged(this, text, offset, range);
123 #else 123 #else
124 selection_text_ = text; 124 selection_text_ = text;
125 selection_text_offset_ = offset; 125 selection_text_offset_ = offset;
126 selection_range_.set_start(range.start()); 126 selection_range_.set_start(range.start());
127 selection_range_.set_end(range.end()); 127 selection_range_.set_end(range.end());
128 #endif 128 #endif
129 } 129 }
130 130
(...skipping 12 matching lines...) Expand all
143 143
144 void RenderWidgetHostViewBase::SetShowingContextMenu(bool showing) { 144 void RenderWidgetHostViewBase::SetShowingContextMenu(bool showing) {
145 DCHECK_NE(showing_context_menu_, showing); 145 DCHECK_NE(showing_context_menu_, showing);
146 showing_context_menu_ = showing; 146 showing_context_menu_ = showing;
147 } 147 }
148 148
149 base::string16 RenderWidgetHostViewBase::GetSelectedText() { 149 base::string16 RenderWidgetHostViewBase::GetSelectedText() {
150 // TODO(ekaramad): Use TextInputManager code paths for IME on other platforms. 150 // TODO(ekaramad): Use TextInputManager code paths for IME on other platforms.
151 // Also, remove the following local variables when that happens 151 // Also, remove the following local variables when that happens
152 // (https://crbug.com/578168 and https://crbug.com/602427). 152 // (https://crbug.com/578168 and https://crbug.com/602427).
153 #if defined(USE_AURA) 153 #if !defined(OS_ANDROID)
154 if (!GetTextInputManager()) 154 if (!GetTextInputManager())
155 return base::string16(); 155 return base::string16();
156 156
157 const TextInputManager::TextSelection* selection = 157 const TextInputManager::TextSelection* selection =
158 GetTextInputManager()->GetTextSelection(this); 158 GetTextInputManager()->GetTextSelection(this);
159 159
160 if (!selection || !selection->range.IsValid()) 160 if (!selection || !selection->range.IsValid())
161 return base::string16(); 161 return base::string16();
162 162
163 return selection->text.substr(selection->range.GetMin() - selection->offset, 163 return selection->text.substr(selection->range.GetMin() - selection->offset,
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 493
494 bool RenderWidgetHostViewBase::IsChildFrameForTesting() const { 494 bool RenderWidgetHostViewBase::IsChildFrameForTesting() const {
495 return false; 495 return false;
496 } 496 }
497 497
498 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const { 498 cc::SurfaceId RenderWidgetHostViewBase::SurfaceIdForTesting() const {
499 return cc::SurfaceId(); 499 return cc::SurfaceId();
500 } 500 }
501 501
502 } // namespace content 502 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698