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

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

Issue 2681833006: [Android] Restart input only once on focus change (Closed)
Patch Set: fixed nit Created 3 years, 10 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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 // Nothing to do here. RenderWidget created the |input_handler| and will take 1048 // Nothing to do here. RenderWidget created the |input_handler| and will take
1049 // ownership of it. We just verify here that we don't already have an input 1049 // ownership of it. We just verify here that we don't already have an input
1050 // handler. 1050 // handler.
1051 DCHECK(!input_handler_); 1051 DCHECK(!input_handler_);
1052 } 1052 }
1053 1053
1054 void RenderWidget::ShowVirtualKeyboard() { 1054 void RenderWidget::ShowVirtualKeyboard() {
1055 UpdateTextInputStateInternal(true, false); 1055 UpdateTextInputStateInternal(true, false);
1056 } 1056 }
1057 1057
1058 void RenderWidget::ClearTextInputState() {
1059 text_input_info_ = blink::WebTextInputInfo();
1060 text_input_type_ = ui::TextInputType::TEXT_INPUT_TYPE_NONE;
1061 text_input_mode_ = ui::TextInputMode::TEXT_INPUT_MODE_DEFAULT;
1062 can_compose_inline_ = false;
1063 text_input_flags_ = 0;
1064 }
1065
1058 void RenderWidget::UpdateTextInputState() { 1066 void RenderWidget::UpdateTextInputState() {
1059 UpdateTextInputStateInternal(false, false); 1067 UpdateTextInputStateInternal(false, false);
1060 } 1068 }
1061 1069
1062 void RenderWidget::UpdateTextInputStateInternal(bool show_virtual_keyboard, 1070 void RenderWidget::UpdateTextInputStateInternal(bool show_virtual_keyboard,
1063 bool reply_to_request) { 1071 bool reply_to_request) {
1064 TRACE_EVENT0("renderer", "RenderWidget::UpdateTextInputState"); 1072 TRACE_EVENT0("renderer", "RenderWidget::UpdateTextInputState");
1065 1073
1066 if (ime_event_guard_) { 1074 if (ime_event_guard_) {
1067 DCHECK(!reply_to_request); 1075 DCHECK(!reply_to_request);
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 break; 2131 break;
2124 default: 2132 default:
2125 web_screen_info.orientationType = 2133 web_screen_info.orientationType =
2126 blink::WebScreenOrientationUndefined; 2134 blink::WebScreenOrientationUndefined;
2127 break; 2135 break;
2128 } 2136 }
2129 web_screen_info.orientationAngle = screen_info_.orientation_angle; 2137 web_screen_info.orientationAngle = screen_info_.orientation_angle;
2130 return web_screen_info; 2138 return web_screen_info;
2131 } 2139 }
2132 2140
2133 void RenderWidget::resetInputMethod() {
2134 ImeEventGuard guard(this);
2135 Send(new InputHostMsg_ImeCancelComposition(routing_id()));
2136
2137 UpdateCompositionInfo(false /* not an immediate request */);
2138 }
2139
2140 #if defined(OS_ANDROID) 2141 #if defined(OS_ANDROID)
2141 void RenderWidget::showUnhandledTapUIIfNeeded( 2142 void RenderWidget::showUnhandledTapUIIfNeeded(
2142 const WebPoint& tapped_position, 2143 const WebPoint& tapped_position,
2143 const WebNode& tapped_node, 2144 const WebNode& tapped_node,
2144 bool page_changed) { 2145 bool page_changed) {
2145 DCHECK(input_handler_->handling_input_event()); 2146 DCHECK(input_handler_->handling_input_event());
2146 bool should_trigger = !page_changed && tapped_node.isTextNode() && 2147 bool should_trigger = !page_changed && tapped_node.isTextNode() &&
2147 !tapped_node.isContentEditable() && 2148 !tapped_node.isContentEditable() &&
2148 !tapped_node.isInsideFocusableElementOrARIAWidget(); 2149 !tapped_node.isInsideFocusableElementOrARIAWidget();
2149 if (should_trigger) { 2150 if (should_trigger) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2309 // browser side (https://crbug.com/669219). 2310 // browser side (https://crbug.com/669219).
2310 // If there is no WebFrameWidget, then there will be no 2311 // If there is no WebFrameWidget, then there will be no
2311 // InputMethodControllers for a WebLocalFrame. 2312 // InputMethodControllers for a WebLocalFrame.
2312 return nullptr; 2313 return nullptr;
2313 } 2314 }
2314 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) 2315 return static_cast<blink::WebFrameWidget*>(GetWebWidget())
2315 ->getActiveWebInputMethodController(); 2316 ->getActiveWebInputMethodController();
2316 } 2317 }
2317 2318
2318 } // namespace content 2319 } // 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