Chromium Code Reviews| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 | 95 |
| 96 if (text_input_state.type == ui::TEXT_INPUT_TYPE_NONE && | 96 if (text_input_state.type == ui::TEXT_INPUT_TYPE_NONE && |
| 97 active_view_ != view) { | 97 active_view_ != view) { |
| 98 // We reached here because an IPC is received to reset the TextInputState | 98 // We reached here because an IPC is received to reset the TextInputState |
| 99 // for |view|. But |view| != |active_view_|, which suggests that at least | 99 // for |view|. But |view| != |active_view_|, which suggests that at least |
| 100 // one other view has become active and we have received the corresponding | 100 // one other view has become active and we have received the corresponding |
| 101 // IPC from their RenderWidget sooner than this one. That also means we have | 101 // IPC from their RenderWidget sooner than this one. That also means we have |
| 102 // already synthesized the loss of TextInputState for the |view| before (see | 102 // already synthesized the loss of TextInputState for the |view| before (see |
| 103 // below). So we can forget about this method ever being called (no observer | 103 // below). So we can forget about this method ever being called (no observer |
| 104 // calls necessary). | 104 // calls necessary). |
| 105 // NOTE: Android requires state to be returned even when the current state | |
| 106 // is/becomes NONE. Otherwise IME may become irresponsive. | |
| 107 #if !defined(OS_ANDROID) | |
| 105 return; | 108 return; |
|
EhsanK
2017/03/10 15:43:16
This should be good since we will not have more th
Changwan Ryu
2017/03/10 16:01:38
As long as it returns something, it should work co
EhsanK
2017/03/10 16:46:18
Right. So here:
https://cs.chromium.org/chromium/s
| |
| 109 #endif | |
| 106 } | 110 } |
| 107 | 111 |
| 108 // Since |view| is registered, we already have a previous value for its | 112 // Since |view| is registered, we already have a previous value for its |
| 109 // TextInputState. | 113 // TextInputState. |
| 110 bool changed = ShouldUpdateTextInputState(text_input_state_map_[view], | 114 bool changed = ShouldUpdateTextInputState(text_input_state_map_[view], |
| 111 text_input_state); | 115 text_input_state); |
| 112 | 116 |
| 113 text_input_state_map_[view] = text_input_state; | 117 text_input_state_map_[view] = text_input_state; |
| 114 | 118 |
| 115 // If |view| is different from |active_view| and its |TextInputState.type| is | 119 // If |view| is different from |active_view| and its |TextInputState.type| is |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 if (pos >= text.length()) { | 346 if (pos >= text.length()) { |
| 343 LOG(WARNING) << "The text cannot cover range (selection range's starting " | 347 LOG(WARNING) << "The text cannot cover range (selection range's starting " |
| 344 "point exceeds text length)."; | 348 "point exceeds text length)."; |
| 345 } else { | 349 } else { |
| 346 selected_text_.append(text.substr(pos, n)); | 350 selected_text_.append(text.substr(pos, n)); |
| 347 } | 351 } |
| 348 } | 352 } |
| 349 } | 353 } |
| 350 | 354 |
| 351 } // namespace content | 355 } // namespace content |
| OLD | NEW |