| Index: content/renderer/render_widget.cc
|
| diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
|
| index 033b4d2676f1923f244f530d4a44ddb35bf2d166..8a771c9ee7bfb6aad650489888624ebfcc58670b 100644
|
| --- a/content/renderer/render_widget.cc
|
| +++ b/content/renderer/render_widget.cc
|
| @@ -246,7 +246,6 @@
|
| text_input_mode_(ui::TEXT_INPUT_MODE_DEFAULT),
|
| text_input_flags_(0),
|
| can_compose_inline_(true),
|
| - composition_range_(gfx::Range::InvalidRange()),
|
| popup_type_(popup_type),
|
| pending_window_rect_count_(0),
|
| screen_info_(screen_info),
|
| @@ -254,7 +253,6 @@
|
| #if defined(OS_ANDROID)
|
| text_field_is_dirty_(false),
|
| #endif
|
| - monitor_composition_info_(false),
|
| popup_origin_scale_for_emulation_(0.f),
|
| frame_swap_message_queue_(new FrameSwapMessageQueue()),
|
| resizing_mode_selector_(new ResizingModeSelector()),
|
| @@ -496,8 +494,6 @@
|
| IPC_MESSAGE_HANDLER(ViewMsg_SetSurfaceClientId, OnSetSurfaceClientId)
|
| IPC_MESSAGE_HANDLER(ViewMsg_WaitForNextFrameForTests,
|
| OnWaitNextFrameForTests)
|
| - IPC_MESSAGE_HANDLER(InputMsg_RequestCompositionUpdate,
|
| - OnRequestCompositionUpdate)
|
| #if defined(OS_ANDROID)
|
| IPC_MESSAGE_HANDLER(InputMsg_ImeEventAck, OnImeEventAck)
|
| IPC_MESSAGE_HANDLER(InputMsg_RequestTextInputStateUpdate,
|
| @@ -1362,7 +1358,7 @@
|
| // sure we are in a consistent state.
|
| Send(new InputHostMsg_ImeCancelComposition(routing_id()));
|
| }
|
| - UpdateCompositionInfo(false /* not an immediate request */);
|
| + UpdateCompositionInfo(true);
|
| }
|
|
|
| void RenderWidget::OnImeConfirmComposition(const base::string16& text,
|
| @@ -1391,7 +1387,7 @@
|
| else
|
| webwidget_->confirmComposition(WebWidget::DoNotKeepSelection);
|
| input_handler_->set_handling_input_event(false);
|
| - UpdateCompositionInfo(false /* not an immediate request */);
|
| + UpdateCompositionInfo(true);
|
| }
|
|
|
| void RenderWidget::OnDeviceScaleFactorChanged() {
|
| @@ -1476,26 +1472,19 @@
|
| return ui::TEXT_INPUT_TYPE_NONE;
|
| }
|
|
|
| -void RenderWidget::UpdateCompositionInfo(bool immediate_request) {
|
| - if (!monitor_composition_info_ && !immediate_request)
|
| - return; // Do not calculate composition info if not requested.
|
| -
|
| +void RenderWidget::UpdateCompositionInfo(bool should_update_range) {
|
| TRACE_EVENT0("renderer", "RenderWidget::UpdateCompositionInfo");
|
| - gfx::Range range;
|
| + gfx::Range range = gfx::Range();
|
| + if (should_update_range) {
|
| + GetCompositionRange(&range);
|
| + } else {
|
| + range = composition_range_;
|
| + }
|
| std::vector<gfx::Rect> character_bounds;
|
| -
|
| - if (GetTextInputType() == ui::TEXT_INPUT_TYPE_NONE) {
|
| - // Composition information is only available on editable node.
|
| - range = gfx::Range::InvalidRange();
|
| - } else {
|
| - GetCompositionRange(&range);
|
| - GetCompositionCharacterBounds(&character_bounds);
|
| - }
|
| -
|
| - if (!immediate_request &&
|
| - !ShouldUpdateCompositionInfo(range, character_bounds)) {
|
| - return;
|
| - }
|
| + GetCompositionCharacterBounds(&character_bounds);
|
| +
|
| + if (!ShouldUpdateCompositionInfo(range, character_bounds))
|
| + return;
|
| composition_character_bounds_ = character_bounds;
|
| composition_range_ = range;
|
| Send(new InputHostMsg_ImeCompositionRangeChanged(
|
| @@ -1553,14 +1542,6 @@
|
| UpdateTextInputState(ShowIme::HIDE_IME, ChangeSource::FROM_IME);
|
| }
|
| #endif
|
| -
|
| -void RenderWidget::OnRequestCompositionUpdate(bool immediate_request,
|
| - bool monitor_request) {
|
| - monitor_composition_info_ = monitor_request;
|
| - if (!immediate_request)
|
| - return;
|
| - UpdateCompositionInfo(true /* immediate request */);
|
| -}
|
|
|
| bool RenderWidget::ShouldHandleImeEvent() {
|
| #if defined(OS_ANDROID)
|
| @@ -1753,7 +1734,7 @@
|
| }
|
| }
|
|
|
| - UpdateCompositionInfo(false /* not an immediate request */);
|
| + UpdateCompositionInfo(false);
|
| }
|
|
|
| void RenderWidget::SetDeviceColorProfileForTesting(
|
| @@ -1898,7 +1879,7 @@
|
| Send(new InputHostMsg_ImeCancelComposition(routing_id()));
|
| }
|
|
|
| - UpdateCompositionInfo(false /* not an immediate request */);
|
| + UpdateCompositionInfo(true);
|
| }
|
|
|
| #if defined(OS_ANDROID)
|
|
|