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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 2255363002: TextInputManager::GetTextSelection() should be called on focused widget. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check for focused widget before using its view 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index 5991147c90829ff2176083ab224bce3e3859276d..8dd32e196267945a65260f17f775f9e19753f24a 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -1516,11 +1516,11 @@ bool RenderWidgetHostViewAura::HasCompositionText() const {
}
bool RenderWidgetHostViewAura::GetTextRange(gfx::Range* range) const {
- if (!text_input_manager_)
+ if (!text_input_manager_ || !GetFocusedWidget())
return false;
const TextInputManager::TextSelection* selection =
- text_input_manager_->GetTextSelection();
+ text_input_manager_->GetTextSelection(GetFocusedWidget()->GetView());
if (!selection)
return false;
@@ -1537,11 +1537,11 @@ bool RenderWidgetHostViewAura::GetCompositionTextRange(
}
bool RenderWidgetHostViewAura::GetSelectionRange(gfx::Range* range) const {
- if (!text_input_manager_)
+ if (!text_input_manager_ || !GetFocusedWidget())
return false;
const TextInputManager::TextSelection* selection =
- text_input_manager_->GetTextSelection();
+ text_input_manager_->GetTextSelection(GetFocusedWidget()->GetView());
if (!selection)
return false;
@@ -1565,11 +1565,11 @@ bool RenderWidgetHostViewAura::DeleteRange(const gfx::Range& range) {
bool RenderWidgetHostViewAura::GetTextFromRange(
const gfx::Range& range,
base::string16* text) const {
- if (!text_input_manager_)
+ if (!text_input_manager_ || !GetFocusedWidget())
return false;
const TextInputManager::TextSelection* selection =
- text_input_manager_->GetTextSelection();
+ text_input_manager_->GetTextSelection(GetFocusedWidget()->GetView());
if (!selection)
return false;

Powered by Google App Engine
This is Rietveld 408576698