Chromium Code Reviews| Index: content/renderer/render_view.cc |
| diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc |
| index c2b17be8f3443e23c1cf07e375cc9831cc00dd11..5faf2298c161191ce1848a2676244782126e01a9 100644 |
| --- a/content/renderer/render_view.cc |
| +++ b/content/renderer/render_view.cc |
| @@ -4269,13 +4269,12 @@ void RenderView::OnImeSetComposition( |
| const std::vector<WebKit::WebCompositionUnderline>& underlines, |
| int selection_start, |
| int selection_end) { |
| - // Until PPAPI has an interface for handling IME events, we skip sending |
| - // OnImeSetComposition. Otherwise the composition is canceled when a |
| - // non-editable DOM element is focused. |
| - // |
| - // TODO(kinaba) This temporal remedy can be removed after PPAPI is extended |
| - // with an IME handling interface. |
| - if (!pepper_delegate_.IsPluginFocused()) { |
| + if (pepper_delegate_.IsPluginFocused()) { |
| + pepper_delegate_.OnImeSetComposition(text, |
| + underlines, |
| + selection_start, |
| + selection_end); |
| + } else { |
| RenderWidget::OnImeSetComposition(text, |
| underlines, |
| selection_start, |
| @@ -4285,48 +4284,35 @@ void RenderView::OnImeSetComposition( |
| void RenderView::OnImeConfirmComposition(const string16& text) { |
| if (pepper_delegate_.IsPluginFocused()) { |
| - // TODO(kinaba) Until PPAPI has an interface for handling IME events, we |
| - // send character events. |
| - for (size_t i = 0; i < text.size(); ++i) { |
| - WebKit::WebKeyboardEvent char_event; |
| - char_event.type = WebKit::WebInputEvent::Char; |
| - char_event.timeStampSeconds = base::Time::Now().ToDoubleT(); |
| - char_event.modifiers = 0; |
| - char_event.windowsKeyCode = text[i]; |
| - char_event.nativeKeyCode = text[i]; |
| - char_event.text[0] = text[i]; |
| - char_event.unmodifiedText[0] = text[i]; |
| - if (webwidget_) |
| - webwidget_->handleInputEvent(char_event); |
| - } |
| + pepper_delegate_.OnImeConfirmComposition(text); |
| } else { |
| RenderWidget::OnImeConfirmComposition(text); |
| } |
|
James Su
2011/09/23 01:46:48
nit: no {}
|
| } |
| -ui::TextInputType RenderView::GetTextInputType() { |
| +WebKit::WebTextInputType RenderView::GetTextInputType() { |
| if (pepper_delegate_.IsPluginFocused()) { |
| #if !defined(TOUCH_UI) |
| - // TODO(kinaba) Until PPAPI has an interface for handling IME events, we |
| - // consider all the parts of PPAPI plugins are accepting text inputs. |
| - return ui::TEXT_INPUT_TYPE_TEXT; |
| + return pepper_delegate_.GetTextInputType(); |
| #else |
| // Disable keyboard input in flash for touch ui until PPAPI can support IME |
| // events. |
| - return ui::TEXT_INPUT_TYPE_NONE; |
| + // TODO(kinaba): remove after IME-aware PPAPI flash is ready. |
| + return WebKit::WebTextInputTypeNone; |
| #endif |
| } |
| return RenderWidget::GetTextInputType(); |
| } |
| +WebKit::WebRect RenderView::GetCaretBounds() { |
| + if (pepper_delegate_.IsPluginFocused()) |
| + return pepper_delegate_.GetCaretBounds(); |
| + return RenderWidget::GetCaretBounds(); |
|
James Su
2011/09/23 01:46:48
nit: return ... ? ... : ... ;
|
| +} |
| + |
| bool RenderView::CanComposeInline() { |
| - if (pepper_delegate_.IsPluginFocused()) { |
| - // TODO(kinaba) Until PPAPI has an interface for handling IME events, there |
| - // is no way for the browser to know whether the plugin is capable of |
| - // drawing composition text. We assume plugins are incapable and let the |
| - // browser handle composition display for now. |
| - return false; |
| - } |
| + if (pepper_delegate_.IsPluginFocused()) |
| + return pepper_delegate_.CanComposeInline(); |
|
James Su
2011/09/23 01:46:48
ditto.
|
| return true; |
| } |