Chromium Code Reviews| Index: content/renderer/render_widget.cc |
| diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc |
| index 851c34a8cc99e43864b5b7c571373502e2d14976..efa3db6e460f2293ea32243057c233fe3628aa46 100644 |
| --- a/content/renderer/render_widget.cc |
| +++ b/content/renderer/render_widget.cc |
| @@ -146,6 +146,7 @@ RenderWidget::RenderWidget(WebKit::WebPopupType popup_type, |
| needs_repainting_on_restore_(false), |
| has_focus_(false), |
| handling_input_event_(false), |
| + handling_ime_event_(false), |
| closing_(false), |
| is_swapped_out_(swapped_out), |
| input_method_is_active_(false), |
| @@ -1341,9 +1342,7 @@ void RenderWidget::willBeginCompositorFrame() { |
| // The following two can result in further layout and possibly |
| // enable GPU acceleration so they need to be called before any painting |
| // is done. |
| -#if !defined(OS_ANDROID) |
| UpdateTextInputState(DO_NOT_SHOW_IME); |
| -#endif // OS_ANDROID |
| UpdateSelectionBounds(); |
| WillInitiatePaint(); |
| @@ -1561,6 +1560,7 @@ void RenderWidget::OnImeSetComposition( |
| int selection_start, int selection_end) { |
| if (!webwidget_) |
| return; |
| + handling_ime_event_ = true; |
|
jamesr
2013/02/12 22:54:34
can you put an RAII object on the stack to be resp
aurimas (slooooooooow)
2013/02/13 00:35:51
Done.
|
| if (webwidget_->setComposition( |
| text, WebVector<WebCompositionUnderline>(underlines), |
| selection_start, selection_end)) { |
| @@ -1595,13 +1595,15 @@ void RenderWidget::OnImeSetComposition( |
| } |
| UpdateCompositionInfo(range, std::vector<gfx::Rect>()); |
| } |
| + handling_ime_event_ = false; |
| + UpdateTextInputState(DO_NOT_SHOW_IME); |
| } |
| void RenderWidget::OnImeConfirmComposition( |
| const string16& text, const ui::Range& replacement_range) { |
| if (!webwidget_) |
| return; |
| - |
| + handling_ime_event_ = true; |
| handling_input_event_ = true; |
| webwidget_->confirmComposition(text); |
| handling_input_event_ = false; |
| @@ -1613,7 +1615,9 @@ void RenderWidget::OnImeConfirmComposition( |
| range.set_start(location); |
| range.set_end(location + length); |
| } |
| + handling_ime_event_ = false; |
| UpdateCompositionInfo(range, std::vector<gfx::Rect>()); |
| + UpdateTextInputState(DO_NOT_SHOW_IME); |
| } |
| // This message causes the renderer to render an image of the |
| @@ -1839,6 +1843,8 @@ static bool IsDateTimeInput(ui::TextInputType type) { |
| void RenderWidget::UpdateTextInputState(ShowIme show_ime) { |
| + if (handling_ime_event_) |
| + return; |
| bool show_ime_if_needed = (show_ime == SHOW_IME_IF_NEEDED); |
| if (!show_ime_if_needed && !input_method_is_active_) |
| return; |