Index: content/renderer/render_view.cc |
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc |
index 7218dfed368a24c5e747208f5a433087e0cd5b6d..7f4d0611eaa7144fae595efdb2517f8bf0d4b0d2 100644 |
--- a/content/renderer/render_view.cc |
+++ b/content/renderer/render_view.cc |
@@ -4262,6 +4262,16 @@ void RenderView::PpapiPluginFocusChanged() { |
UpdateInputMethod(); |
} |
+void RenderView::PpapiPluginTextInputTypeChanged() { |
+ UpdateInputMethod(); |
+} |
+ |
+void RenderView::PpapiPluginCancelComposition() { |
+ Send(new ViewHostMsg_ImeCancelComposition(routing_id())); |
+ ui::Range range(ui::Range::InvalidRange()); |
+ Send(new ViewHostMsg_ImeCompositionRangeChanged(routing_id(), range)); |
+} |
+ |
void RenderView::RequestRemoteAccessClientFirewallTraversal() { |
Send(new ViewHostMsg_RequestRemoteAccessClientFirewallTraversal(routing_id_)); |
} |
@@ -4271,13 +4281,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, |
@@ -4286,50 +4295,25 @@ 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); |
- } |
- } else { |
+ if (pepper_delegate_.IsPluginFocused()) |
+ pepper_delegate_.OnImeConfirmComposition(text); |
+ else |
RenderWidget::OnImeConfirmComposition(text); |
- } |
} |
ui::TextInputType 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; |
-#else |
- // Disable keyboard input in flash for touch ui until PPAPI can support IME |
- // events. |
- return ui::TEXT_INPUT_TYPE_NONE; |
-#endif |
- } |
- return RenderWidget::GetTextInputType(); |
+ return pepper_delegate_.IsPluginFocused() ? |
+ pepper_delegate_.GetTextInputType() : RenderWidget::GetTextInputType(); |
+} |
+ |
+gfx::Rect RenderView::GetCaretBounds() { |
+ return pepper_delegate_.IsPluginFocused() ? |
+ pepper_delegate_.GetCaretBounds() : RenderWidget::GetCaretBounds(); |
} |
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; |
- } |
- return true; |
+ return pepper_delegate_.IsPluginFocused() ? |
+ pepper_delegate_.CanComposeInline() : true; |
} |
#if defined(OS_MACOSX) |
@@ -4644,4 +4628,3 @@ void RenderView::OnLockMouseACK(bool succeeded) { |
void RenderView::OnMouseLockLost() { |
pepper_delegate_.OnMouseLockLost(); |
} |
- |