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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 opener_id_(MSG_ROUTING_NONE), | 214 opener_id_(MSG_ROUTING_NONE), |
215 next_paint_flags_(0), | 215 next_paint_flags_(0), |
216 auto_resize_mode_(false), | 216 auto_resize_mode_(false), |
217 need_update_rect_for_auto_resize_(false), | 217 need_update_rect_for_auto_resize_(false), |
218 did_show_(false), | 218 did_show_(false), |
219 is_hidden_(hidden), | 219 is_hidden_(hidden), |
220 compositor_never_visible_(never_visible), | 220 compositor_never_visible_(never_visible), |
221 is_fullscreen_granted_(false), | 221 is_fullscreen_granted_(false), |
222 display_mode_(blink::WebDisplayModeUndefined), | 222 display_mode_(blink::WebDisplayModeUndefined), |
223 ime_event_guard_(nullptr), | 223 ime_event_guard_(nullptr), |
224 ime_in_batch_edit_(false), | |
225 closing_(false), | 224 closing_(false), |
226 host_closing_(false), | 225 host_closing_(false), |
227 is_swapped_out_(swapped_out), | 226 is_swapped_out_(swapped_out), |
228 for_oopif_(false), | 227 for_oopif_(false), |
229 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | 228 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
230 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), | 229 text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT), |
231 text_input_flags_(0), | 230 text_input_flags_(0), |
232 can_compose_inline_(true), | 231 can_compose_inline_(true), |
233 composition_range_(gfx::Range::InvalidRange()), | 232 composition_range_(gfx::Range::InvalidRange()), |
234 popup_type_(popup_type), | 233 popup_type_(popup_type), |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) | 511 IPC_MESSAGE_HANDLER(ViewMsg_UpdateScreenRects, OnUpdateScreenRects) |
513 IPC_MESSAGE_HANDLER(ViewMsg_SetFrameSinkId, OnSetFrameSinkId) | 512 IPC_MESSAGE_HANDLER(ViewMsg_SetFrameSinkId, OnSetFrameSinkId) |
514 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, | 513 IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests, |
515 OnWaitNextFrameForTests) | 514 OnWaitNextFrameForTests) |
516 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, | 515 IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate, |
517 OnRequestCompositionUpdate) | 516 OnRequestCompositionUpdate) |
518 #if defined(OS_ANDROID) | 517 #if defined(OS_ANDROID) |
519 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) | 518 IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck) |
520 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, | 519 IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate, |
521 OnRequestTextInputStateUpdate) | 520 OnRequestTextInputStateUpdate) |
522 IPC_MESSAGE_HANDLER(InputMsg_ImeBatchEdit, | |
523 OnImeBatchEdit) | |
524 #endif | 521 #endif |
525 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) | 522 IPC_MESSAGE_HANDLER(ViewMsg_HandleCompositorProto, OnHandleCompositorProto) |
526 IPC_MESSAGE_UNHANDLED(handled = false) | 523 IPC_MESSAGE_UNHANDLED(handled = false) |
527 IPC_END_MESSAGE_MAP() | 524 IPC_END_MESSAGE_MAP() |
528 return handled; | 525 return handled; |
529 } | 526 } |
530 | 527 |
531 bool RenderWidget::Send(IPC::Message* message) { | 528 bool RenderWidget::Send(IPC::Message* message) { |
532 // Don't send any messages after the browser has told us to close, and filter | 529 // Don't send any messages after the browser has told us to close, and filter |
533 // most outgoing messages while swapped out. | 530 // most outgoing messages while swapped out. |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 params.composition_start = new_info.compositionStart; | 942 params.composition_start = new_info.compositionStart; |
946 params.composition_end = new_info.compositionEnd; | 943 params.composition_end = new_info.compositionEnd; |
947 params.can_compose_inline = new_can_compose_inline; | 944 params.can_compose_inline = new_can_compose_inline; |
948 params.show_ime_if_needed = (show_ime == ShowIme::IF_NEEDED); | 945 params.show_ime_if_needed = (show_ime == ShowIme::IF_NEEDED); |
949 #if defined(USE_AURA) | 946 #if defined(USE_AURA) |
950 params.is_non_ime_change = true; | 947 params.is_non_ime_change = true; |
951 #endif | 948 #endif |
952 #if defined(OS_ANDROID) | 949 #if defined(OS_ANDROID) |
953 params.is_non_ime_change = | 950 params.is_non_ime_change = |
954 (change_source == ChangeSource::FROM_NON_IME) || text_field_is_dirty_; | 951 (change_source == ChangeSource::FROM_NON_IME) || text_field_is_dirty_; |
955 params.batch_edit = ime_in_batch_edit_; | |
956 if (params.is_non_ime_change) | 952 if (params.is_non_ime_change) |
957 OnImeEventSentForAck(new_info); | 953 OnImeEventSentForAck(new_info); |
958 text_field_is_dirty_ = false; | 954 text_field_is_dirty_ = false; |
959 #endif | 955 #endif |
960 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), params)); | 956 Send(new ViewHostMsg_TextInputStateChanged(routing_id(), params)); |
961 | 957 |
962 text_input_info_ = new_info; | 958 text_input_info_ = new_info; |
963 text_input_type_ = new_type; | 959 text_input_type_ = new_type; |
964 text_input_mode_ = new_mode; | 960 text_input_mode_ = new_mode; |
965 can_compose_inline_ = new_can_compose_inline; | 961 can_compose_inline_ = new_can_compose_inline; |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 void RenderWidget::OnImeEventAck() { | 1598 void RenderWidget::OnImeEventAck() { |
1603 DCHECK_GE(text_input_info_history_.size(), 1u); | 1599 DCHECK_GE(text_input_info_history_.size(), 1u); |
1604 text_input_info_history_.pop_front(); | 1600 text_input_info_history_.pop_front(); |
1605 } | 1601 } |
1606 | 1602 |
1607 void RenderWidget::OnRequestTextInputStateUpdate() { | 1603 void RenderWidget::OnRequestTextInputStateUpdate() { |
1608 DCHECK(!ime_event_guard_); | 1604 DCHECK(!ime_event_guard_); |
1609 UpdateSelectionBounds(); | 1605 UpdateSelectionBounds(); |
1610 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); | 1606 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); |
1611 } | 1607 } |
1612 | |
1613 void RenderWidget::OnImeBatchEdit(bool begin) { | |
1614 if (begin) { | |
1615 ime_in_batch_edit_ = true; | |
1616 return; | |
1617 } | |
1618 if (!ime_in_batch_edit_) | |
1619 return; | |
1620 ime_in_batch_edit_ = false; | |
1621 DCHECK(!ime_event_guard_); | |
1622 UpdateSelectionBounds(); | |
1623 UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME); | |
1624 } | |
1625 #endif | 1608 #endif |
1626 | 1609 |
1627 void RenderWidget::OnRequestCompositionUpdate(bool immediate_request, | 1610 void RenderWidget::OnRequestCompositionUpdate(bool immediate_request, |
1628 bool monitor_request) { | 1611 bool monitor_request) { |
1629 monitor_composition_info_ = monitor_request; | 1612 monitor_composition_info_ = monitor_request; |
1630 if (!immediate_request) | 1613 if (!immediate_request) |
1631 return; | 1614 return; |
1632 UpdateCompositionInfo(true /* immediate request */); | 1615 UpdateCompositionInfo(true /* immediate request */); |
1633 } | 1616 } |
1634 | 1617 |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2084 bool RenderWidget::isPointerLocked() { | 2067 bool RenderWidget::isPointerLocked() { |
2085 return mouse_lock_dispatcher_->IsMouseLockedTo( | 2068 return mouse_lock_dispatcher_->IsMouseLockedTo( |
2086 webwidget_mouse_lock_target_.get()); | 2069 webwidget_mouse_lock_target_.get()); |
2087 } | 2070 } |
2088 | 2071 |
2089 blink::WebWidget* RenderWidget::GetWebWidget() const { | 2072 blink::WebWidget* RenderWidget::GetWebWidget() const { |
2090 return webwidget_internal_; | 2073 return webwidget_internal_; |
2091 } | 2074 } |
2092 | 2075 |
2093 } // namespace content | 2076 } // namespace content |
OLD | NEW |