| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/text_input_manager.h" | 5 #include "content/browser/renderer_host/text_input_manager.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/render_widget_host_impl.h" | 7 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 8 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 8 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
| 10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 const TextInputManager::SelectionRegion* TextInputManager::GetSelectionRegion( | 66 const TextInputManager::SelectionRegion* TextInputManager::GetSelectionRegion( |
| 67 RenderWidgetHostViewBase* view) const { | 67 RenderWidgetHostViewBase* view) const { |
| 68 DCHECK(!view || IsRegistered(view)); | 68 DCHECK(!view || IsRegistered(view)); |
| 69 if (!view) | 69 if (!view) |
| 70 view = active_view_; | 70 view = active_view_; |
| 71 return view ? &selection_region_map_.at(view) : nullptr; | 71 return view ? &selection_region_map_.at(view) : nullptr; |
| 72 } | 72 } |
| 73 | 73 |
| 74 const TextInputManager::CompositionRangeInfo* | 74 const TextInputManager::CompositionRangeInfo* |
| 75 TextInputManager::GetCompositionRangeInfo( | 75 TextInputManager::GetCompositionRangeInfo() const { |
| 76 RenderWidgetHostViewBase* view) const { | |
| 77 DCHECK(!view || IsRegistered(view)); | |
| 78 if (!view) | |
| 79 view = active_view_; | |
| 80 return active_view_ ? &composition_range_info_map_.at(active_view_) : nullptr; | 76 return active_view_ ? &composition_range_info_map_.at(active_view_) : nullptr; |
| 81 } | 77 } |
| 82 | 78 |
| 83 const TextInputManager::TextSelection* TextInputManager::GetTextSelection( | 79 const TextInputManager::TextSelection* TextInputManager::GetTextSelection( |
| 84 RenderWidgetHostViewBase* view) const { | 80 RenderWidgetHostViewBase* view) const { |
| 85 DCHECK(!view || IsRegistered(view)); | 81 DCHECK(!view || IsRegistered(view)); |
| 86 if (!view) | 82 if (!view) |
| 87 view = active_view_; | 83 view = active_view_; |
| 88 return !!view ? &text_selection_map_.at(view) : nullptr; | 84 return !!view ? &text_selection_map_.at(view) : nullptr; |
| 89 } | 85 } |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 if (pos >= text.length()) { | 342 if (pos >= text.length()) { |
| 347 LOG(WARNING) << "The text cannot cover range (selection range's starting " | 343 LOG(WARNING) << "The text cannot cover range (selection range's starting " |
| 348 "point exceeds text length)."; | 344 "point exceeds text length)."; |
| 349 } else { | 345 } else { |
| 350 selected_text_.append(text.substr(pos, n)); | 346 selected_text_.append(text.substr(pos, n)); |
| 351 } | 347 } |
| 352 } | 348 } |
| 353 } | 349 } |
| 354 | 350 |
| 355 } // namespace content | 351 } // namespace content |
| OLD | NEW |