Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 2062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2073 *range = gfx::Range::InvalidRange(); | 2073 *range = gfx::Range::InvalidRange(); |
| 2074 return; | 2074 return; |
| 2075 } | 2075 } |
| 2076 range->set_start(web_range.startOffset()); | 2076 range->set_start(web_range.startOffset()); |
| 2077 range->set_end(web_range.endOffset()); | 2077 range->set_end(web_range.endOffset()); |
| 2078 } | 2078 } |
| 2079 | 2079 |
| 2080 bool RenderWidget::ShouldUpdateCompositionInfo( | 2080 bool RenderWidget::ShouldUpdateCompositionInfo( |
| 2081 const gfx::Range& range, | 2081 const gfx::Range& range, |
| 2082 const std::vector<gfx::Rect>& bounds) { | 2082 const std::vector<gfx::Rect>& bounds) { |
| 2083 if (!range.IsValid()) | |
| 2084 return false; | |
| 2083 if (composition_range_ != range) | 2085 if (composition_range_ != range) |
| 2084 return true; | 2086 return true; |
| 2085 if (bounds.size() != composition_character_bounds_.size()) | 2087 if (bounds.size() != composition_character_bounds_.size()) |
| 2086 return true; | 2088 return true; |
| 2087 for (size_t i = 0; i < bounds.size(); ++i) { | 2089 for (size_t i = 0; i < bounds.size(); ++i) { |
| 2088 if (bounds[i] != composition_character_bounds_[i]) | 2090 if (bounds[i] != composition_character_bounds_[i]) |
| 2089 return true; | 2091 return true; |
| 2090 } | 2092 } |
| 2091 return false; | 2093 return false; |
| 2092 } | 2094 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2128 web_screen_info.orientationType = | 2130 web_screen_info.orientationType = |
| 2129 blink::WebScreenOrientationUndefined; | 2131 blink::WebScreenOrientationUndefined; |
| 2130 break; | 2132 break; |
| 2131 } | 2133 } |
| 2132 web_screen_info.orientationAngle = screen_info_.orientation_angle; | 2134 web_screen_info.orientationAngle = screen_info_.orientation_angle; |
| 2133 return web_screen_info; | 2135 return web_screen_info; |
| 2134 } | 2136 } |
| 2135 | 2137 |
| 2136 void RenderWidget::resetInputMethod() { | 2138 void RenderWidget::resetInputMethod() { |
| 2137 ImeEventGuard guard(this); | 2139 ImeEventGuard guard(this); |
| 2138 // If the last text input type is not None, then we should finish any | 2140 if (text_input_type_ != ui::TEXT_INPUT_TYPE_NONE) |
|
yosin_UTC9
2016/12/07 09:46:00
Q: What is happened when we call ImeCancelComposit
Changwan Ryu
2016/12/08 01:16:29
The browser process may ignore it. If it does not
Changwan Ryu
2016/12/08 09:56:07
Removed this check.
| |
| 2139 // ongoing composition regardless of the new text input type. | 2141 Send(new InputHostMsg_ImeCancelComposition(routing_id())); |
| 2140 if (text_input_type_ != ui::TEXT_INPUT_TYPE_NONE) { | |
| 2141 // If a composition text exists, then we need to let the browser process | |
| 2142 // to cancel the input method's ongoing composition session. | |
| 2143 blink::WebInputMethodController* controller = GetInputMethodController(); | |
| 2144 if (controller && | |
| 2145 controller->finishComposingText( | |
| 2146 WebInputMethodController::DoNotKeepSelection)) | |
| 2147 Send(new InputHostMsg_ImeCancelComposition(routing_id())); | |
| 2148 } | |
| 2149 | 2142 |
| 2150 UpdateCompositionInfo(false /* not an immediate request */); | 2143 UpdateCompositionInfo(false /* not an immediate request */); |
| 2151 } | 2144 } |
| 2152 | 2145 |
| 2153 #if defined(OS_ANDROID) | 2146 #if defined(OS_ANDROID) |
| 2154 void RenderWidget::showUnhandledTapUIIfNeeded( | 2147 void RenderWidget::showUnhandledTapUIIfNeeded( |
| 2155 const WebPoint& tapped_position, | 2148 const WebPoint& tapped_position, |
| 2156 const WebNode& tapped_node, | 2149 const WebNode& tapped_node, |
| 2157 bool page_changed) { | 2150 bool page_changed) { |
| 2158 DCHECK(input_handler_->handling_input_event()); | 2151 DCHECK(input_handler_->handling_input_event()); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2309 blink::WebInputMethodController* RenderWidget::GetInputMethodController() | 2302 blink::WebInputMethodController* RenderWidget::GetInputMethodController() |
| 2310 const { | 2303 const { |
| 2311 // TODO(ekaramad): Remove this CHECK when GetWebWidget() is | 2304 // TODO(ekaramad): Remove this CHECK when GetWebWidget() is |
| 2312 // always a WebFrameWidget. | 2305 // always a WebFrameWidget. |
| 2313 CHECK(GetWebWidget()->isWebFrameWidget()); | 2306 CHECK(GetWebWidget()->isWebFrameWidget()); |
| 2314 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) | 2307 return static_cast<blink::WebFrameWidget*>(GetWebWidget()) |
| 2315 ->getActiveWebInputMethodController(); | 2308 ->getActiveWebInputMethodController(); |
| 2316 } | 2309 } |
| 2317 | 2310 |
| 2318 } // namespace content | 2311 } // namespace content |
| OLD | NEW |