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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 opener_id_(MSG_ROUTING_NONE), | 227 opener_id_(MSG_ROUTING_NONE), |
228 next_paint_flags_(0), | 228 next_paint_flags_(0), |
229 auto_resize_mode_(false), | 229 auto_resize_mode_(false), |
230 need_update_rect_for_auto_resize_(false), | 230 need_update_rect_for_auto_resize_(false), |
231 did_show_(false), | 231 did_show_(false), |
232 is_hidden_(hidden), | 232 is_hidden_(hidden), |
233 compositor_never_visible_(never_visible), | 233 compositor_never_visible_(never_visible), |
234 is_fullscreen_granted_(false), | 234 is_fullscreen_granted_(false), |
235 display_mode_(blink::WebDisplayModeUndefined), | 235 display_mode_(blink::WebDisplayModeUndefined), |
236 ime_event_guard_(nullptr), | 236 ime_event_guard_(nullptr), |
| 237 ime_in_batch_edit_(false), |
237 closing_(false), | 238 closing_(false), |
238 host_closing_(false), | 239 host_closing_(false), |
239 is_swapped_out_(swapped_out), | 240 is_swapped_out_(swapped_out), |
240 for_oopif_(false), | 241 for_oopif_(false), |
241 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), | 242 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), |
242 text_input_flags_(0), | 243 text_input_flags_(0), |
243 can_compose_inline_(true), | 244 can_compose_inline_(true), |
244 composition_range_(gfx::Range::InvalidRange()), | 245 composition_range_(gfx::Range::InvalidRange()), |
245 popup_type_(popup_type), | 246 popup_type_(popup_type), |
246 pending_window_rect_count_(0), | 247 pending_window_rect_count_(0), |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) | 510 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) |
510 IPC_MESSAGE_HANDLER(ViewMsg_SetSurfaceClientId, OnSetSurfaceClientId) | 511 IPC_MESSAGE_HANDLER(ViewMsg_SetSurfaceClientId, OnSetSurfaceClientId) |
511 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, | 512 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, |
512 OnWaitNextFrameForTests) | 513 OnWaitNextFrameForTests) |
513 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, | 514 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, |
514 OnRequestCompositionUpdate) | 515 OnRequestCompositionUpdate) |
515 #if defined(OS_ANDROID) | 516 #if defined(OS_ANDROID) |
516 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) | 517 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) |
517 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, | 518 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, |
518 OnRequestTextInputStateUpdate) | 519 OnRequestTextInputStateUpdate) |
| 520 IPC_MESSAGE_HANDLER(InputMsg_ImeBatchEdit, |
| 521 OnImeBatchEdit) |
519 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) | 522 IPC_MESSAGE_HANDLER(ViewMsg_ShowImeIfNeeded, OnShowImeIfNeeded) |
520 #endif | 523 #endif |
521 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) | 524 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) |
522 IPC_MESSAGE_UNHANDLED(handled = false) | 525 IPC_MESSAGE_UNHANDLED(handled = false) |
523 IPC_END_MESSAGE_MAP() | 526 IPC_END_MESSAGE_MAP() |
524 return handled; | 527 return handled; |
525 } | 528 } |
526 | 529 |
527 bool RenderWidget::Send(IPC::Message* message) { | 530 bool RenderWidget::Send(IPC::Message* message) { |
528 // Don't send any messages after the browser has told us to close, and filter | 531 // Don't send any messages after the browser has told us to close, and filter |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 params.composition_start = new_info.compositionStart; | 977 params.composition_start = new_info.compositionStart; |
975 params.composition_end = new_info.compositionEnd; | 978 params.composition_end = new_info.compositionEnd; |
976 params.can_compose_inline = new_can_compose_inline; | 979 params.can_compose_inline = new_can_compose_inline; |
977 params.show_ime_if_needed = (show_ime == ShowIme::IF_NEEDED); | 980 params.show_ime_if_needed = (show_ime == ShowIme::IF_NEEDED); |
978 #if defined(USE_AURA) | 981 #if defined(USE_AURA) |
979 params.is_non_ime_change = true; | 982 params.is_non_ime_change = true; |
980 #endif | 983 #endif |
981 #if defined(OS_ANDROID) | 984 #if defined(OS_ANDROID) |
982 params.is_non_ime_change = | 985 params.is_non_ime_change = |
983 (change_source == ChangeSource::FROM_NON_IME) || text_field_is_dirty_; | 986 (change_source == ChangeSource::FROM_NON_IME) || text_field_is_dirty_; |
| 987 params.batch_edit = ime_in_batch_edit_; |
984 if (params.is_non_ime_change) | 988 if (params.is_non_ime_change) |
985 OnImeEventSentForAck(new_info); | 989 OnImeEventSentForAck(new_info); |
986 text_field_is_dirty_ = false; | 990 text_field_is_dirty_ = false; |
987 #endif | 991 #endif |
988 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), params)); | 992 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), params)); |
989 | 993 |
990 text_input_info_ = new_info; | 994 text_input_info_ = new_info; |
991 text_input_mode_ = new_mode; | 995 text_input_mode_ = new_mode; |
992 can_compose_inline_ = new_can_compose_inline; | 996 can_compose_inline_ = new_can_compose_inline; |
993 text_input_flags_ = new_info.flags; | 997 text_input_flags_ = new_info.flags; |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 void RenderWidget::OnImeEventAck() { | 1612 void RenderWidget::OnImeEventAck() { |
1609 DCHECK_GE(text_input_info_history_.size(), 1u); | 1613 DCHECK_GE(text_input_info_history_.size(), 1u); |
1610 text_input_info_history_.pop_front(); | 1614 text_input_info_history_.pop_front(); |
1611 } | 1615 } |
1612 | 1616 |
1613 void RenderWidget::OnRequestTextInputStateUpdate() { | 1617 void RenderWidget::OnRequestTextInputStateUpdate() { |
1614 DCHECK(!ime_event_guard_); | 1618 DCHECK(!ime_event_guard_); |
1615 UpdateSelectionBounds(); | 1619 UpdateSelectionBounds(); |
1616 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); | 1620 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); |
1617 } | 1621 } |
| 1622 |
| 1623 void RenderWidget::OnImeBatchEdit(bool begin) { |
| 1624 if (begin) { |
| 1625 ime_in_batch_edit_ = true; |
| 1626 return; |
| 1627 } |
| 1628 if (!ime_in_batch_edit_) |
| 1629 return; |
| 1630 ime_in_batch_edit_ = false; |
| 1631 DCHECK(!ime_event_guard_); |
| 1632 UpdateSelectionBounds(); |
| 1633 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); |
| 1634 } |
1618 #endif | 1635 #endif |
1619 | 1636 |
1620 void RenderWidget::OnRequestCompositionUpdate(bool immediate_request, | 1637 void RenderWidget::OnRequestCompositionUpdate(bool immediate_request, |
1621 bool monitor_request) { | 1638 bool monitor_request) { |
1622 monitor_composition_info_ = monitor_request; | 1639 monitor_composition_info_ = monitor_request; |
1623 if (!immediate_request) | 1640 if (!immediate_request) |
1624 return; | 1641 return; |
1625 UpdateCompositionInfo(true /* immediate request */); | 1642 UpdateCompositionInfo(true /* immediate request */); |
1626 } | 1643 } |
1627 | 1644 |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2151 bool RenderWidget::isPointerLocked() { | 2168 bool RenderWidget::isPointerLocked() { |
2152 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2169 return mouse_lock_dispatcher_->IsMouseLockedTo( |
2153 webwidget_mouse_lock_target_.get()); | 2170 webwidget_mouse_lock_target_.get()); |
2154 } | 2171 } |
2155 | 2172 |
2156 blink::WebWidget* RenderWidget::GetWebWidget() const { | 2173 blink::WebWidget* RenderWidget::GetWebWidget() const { |
2157 return webwidget_internal_; | 2174 return webwidget_internal_; |
2158 } | 2175 } |
2159 | 2176 |
2160 } // namespace content | 2177 } // namespace content |
OLD | NEW |