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

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

Issue 2561543003: Move call path for resetInputMethod (Closed)
Patch Set: rebase Created 4 years 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/InputMethodController.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after
2015 *range = gfx::Range::InvalidRange(); 2015 *range = gfx::Range::InvalidRange();
2016 return; 2016 return;
2017 } 2017 }
2018 range->set_start(web_range.startOffset()); 2018 range->set_start(web_range.startOffset());
2019 range->set_end(web_range.endOffset()); 2019 range->set_end(web_range.endOffset());
2020 } 2020 }
2021 2021
2022 bool RenderWidget::ShouldUpdateCompositionInfo( 2022 bool RenderWidget::ShouldUpdateCompositionInfo(
2023 const gfx::Range& range, 2023 const gfx::Range& range,
2024 const std::vector<gfx::Rect>& bounds) { 2024 const std::vector<gfx::Rect>& bounds) {
2025 if (!range.IsValid())
2026 return false;
2025 if (composition_range_ != range) 2027 if (composition_range_ != range)
2026 return true; 2028 return true;
2027 if (bounds.size() != composition_character_bounds_.size()) 2029 if (bounds.size() != composition_character_bounds_.size())
2028 return true; 2030 return true;
2029 for (size_t i = 0; i < bounds.size(); ++i) { 2031 for (size_t i = 0; i < bounds.size(); ++i) {
2030 if (bounds[i] != composition_character_bounds_[i]) 2032 if (bounds[i] != composition_character_bounds_[i])
2031 return true; 2033 return true;
2032 } 2034 }
2033 return false; 2035 return false;
2034 } 2036 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 web_screen_info.orientationType = 2072 web_screen_info.orientationType =
2071 blink::WebScreenOrientationUndefined; 2073 blink::WebScreenOrientationUndefined;
2072 break; 2074 break;
2073 } 2075 }
2074 web_screen_info.orientationAngle = screen_info_.orientation_angle; 2076 web_screen_info.orientationAngle = screen_info_.orientation_angle;
2075 return web_screen_info; 2077 return web_screen_info;
2076 } 2078 }
2077 2079
2078 void RenderWidget::resetInputMethod() { 2080 void RenderWidget::resetInputMethod() {
2079 ImeEventGuard guard(this); 2081 ImeEventGuard guard(this);
2080 // If the last text input type is not None, then we should finish any 2082 Send(new InputHostMsg_ImeCancelComposition(routing_id()));
2081 // ongoing composition regardless of the new text input type.
2082 if (text_input_type_ != ui::TEXT_INPUT_TYPE_NONE) {
2083 // If a composition text exists, then we need to let the browser process
2084 // to cancel the input method's ongoing composition session.
2085 blink::WebInputMethodController* controller = GetInputMethodController();
2086 if (controller &&
2087 controller->finishComposingText(
2088 WebInputMethodController::DoNotKeepSelection))
2089 Send(new InputHostMsg_ImeCancelComposition(routing_id()));
2090 }
2091 2083
2092 UpdateCompositionInfo(false /* not an immediate request */); 2084 UpdateCompositionInfo(false /* not an immediate request */);
2093 } 2085 }
2094 2086
2095 #if defined(OS_ANDROID) 2087 #if defined(OS_ANDROID)
2096 void RenderWidget::showUnhandledTapUIIfNeeded( 2088 void RenderWidget::showUnhandledTapUIIfNeeded(
2097 const WebPoint& tapped_position, 2089 const WebPoint& tapped_position,
2098 const WebNode& tapped_node, 2090 const WebNode& tapped_node,
2099 bool page_changed) { 2091 bool page_changed) {
2100 DCHECK(input_handler_->handling_input_event()); 2092 DCHECK(input_handler_->handling_input_event());
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2249 // browser side (https://crbug.com/669219). 2241 // browser side (https://crbug.com/669219).
2250 // If there is no WebFrameWidget, then there will be no 2242 // If there is no WebFrameWidget, then there will be no
2251 // InputMethodControllers for a WebLocalFrame. 2243 // InputMethodControllers for a WebLocalFrame.
2252 return nullptr; 2244 return nullptr;
2253 } 2245 }
2254 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) 2246 return static_cast<blink::WebFrameWidget*>(GetWebWidget())
2255 ->getActiveWebInputMethodController(); 2247 ->getActiveWebInputMethodController();
2256 } 2248 }
2257 2249
2258 } // namespace content 2250 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/InputMethodController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698