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

Side by Side Diff: content/renderer/render_widget.cc

Issue 2736413002: [Android] Restart input only once on focus change (Closed)
Patch Set: Rebase Created 3 years, 9 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/renderer/render_widget.h" 5 #include "content/renderer/render_widget.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 // Nothing to do here. RenderWidget created the |input_handler| and will take 1023 // Nothing to do here. RenderWidget created the |input_handler| and will take
1024 // ownership of it. We just verify here that we don't already have an input 1024 // ownership of it. We just verify here that we don't already have an input
1025 // handler. 1025 // handler.
1026 DCHECK(!input_handler_); 1026 DCHECK(!input_handler_);
1027 } 1027 }
1028 1028
1029 void RenderWidget::ShowVirtualKeyboard() { 1029 void RenderWidget::ShowVirtualKeyboard() {
1030 UpdateTextInputStateInternal(true, false); 1030 UpdateTextInputStateInternal(true, false);
1031 } 1031 }
1032 1032
1033 void RenderWidget::ClearTextInputState() {
1034 text_input_info_ = blink::WebTextInputInfo();
1035 text_input_type_ = ui::TextInputType::TEXT_INPUT_TYPE_NONE;
1036 text_input_mode_ = ui::TextInputMode::TEXT_INPUT_MODE_DEFAULT;
1037 can_compose_inline_ = false;
1038 text_input_flags_ = 0;
1039 }
1040
1033 void RenderWidget::UpdateTextInputState() { 1041 void RenderWidget::UpdateTextInputState() {
1034 UpdateTextInputStateInternal(false, false); 1042 UpdateTextInputStateInternal(false, false);
1035 } 1043 }
1036 1044
1037 void RenderWidget::UpdateTextInputStateInternal(bool show_virtual_keyboard, 1045 void RenderWidget::UpdateTextInputStateInternal(bool show_virtual_keyboard,
1038 bool reply_to_request) { 1046 bool reply_to_request) {
1039 TRACE_EVENT0("renderer", "RenderWidget::UpdateTextInputState"); 1047 TRACE_EVENT0("renderer", "RenderWidget::UpdateTextInputState");
1040 1048
1041 if (ime_event_guard_) { 1049 if (ime_event_guard_) {
1042 DCHECK(!reply_to_request); 1050 DCHECK(!reply_to_request);
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 break; 2092 break;
2085 default: 2093 default:
2086 web_screen_info.orientationType = 2094 web_screen_info.orientationType =
2087 blink::WebScreenOrientationUndefined; 2095 blink::WebScreenOrientationUndefined;
2088 break; 2096 break;
2089 } 2097 }
2090 web_screen_info.orientationAngle = screen_info_.orientation_angle; 2098 web_screen_info.orientationAngle = screen_info_.orientation_angle;
2091 return web_screen_info; 2099 return web_screen_info;
2092 } 2100 }
2093 2101
2094 void RenderWidget::resetInputMethod() {
2095 ImeEventGuard guard(this);
2096 Send(new InputHostMsg_ImeCancelComposition(routing_id()));
2097
2098 UpdateCompositionInfo(false /* not an immediate request */);
2099 }
2100
2101 #if defined(OS_ANDROID) 2102 #if defined(OS_ANDROID)
2102 void RenderWidget::showUnhandledTapUIIfNeeded( 2103 void RenderWidget::showUnhandledTapUIIfNeeded(
2103 const WebPoint& tapped_position, 2104 const WebPoint& tapped_position,
2104 const WebNode& tapped_node, 2105 const WebNode& tapped_node,
2105 bool page_changed) { 2106 bool page_changed) {
2106 DCHECK(input_handler_->handling_input_event()); 2107 DCHECK(input_handler_->handling_input_event());
2107 bool should_trigger = !page_changed && tapped_node.isTextNode() && 2108 bool should_trigger = !page_changed && tapped_node.isTextNode() &&
2108 !tapped_node.isContentEditable() && 2109 !tapped_node.isContentEditable() &&
2109 !tapped_node.isInsideFocusableElementOrARIAWidget(); 2110 !tapped_node.isInsideFocusableElementOrARIAWidget();
2110 if (should_trigger) { 2111 if (should_trigger) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 // browser side (https://crbug.com/669219). 2272 // browser side (https://crbug.com/669219).
2272 // If there is no WebFrameWidget, then there will be no 2273 // If there is no WebFrameWidget, then there will be no
2273 // InputMethodControllers for a WebLocalFrame. 2274 // InputMethodControllers for a WebLocalFrame.
2274 return nullptr; 2275 return nullptr;
2275 } 2276 }
2276 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) 2277 return static_cast<blink::WebFrameWidget*>(GetWebWidget())
2277 ->getActiveWebInputMethodController(); 2278 ->getActiveWebInputMethodController();
2278 } 2279 }
2279 2280
2280 } // namespace content 2281 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_widget.h ('k') | third_party/WebKit/Source/core/editing/InputMethodController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698