| Index: content/renderer/render_view.cc
|
| diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc
|
| index 9101110a4ac581585cceddeb8bce2aea9bac4e1b..f30d8789e3925dc3330a773dee9e7d9541d77b25 100644
|
| --- a/content/renderer/render_view.cc
|
| +++ b/content/renderer/render_view.cc
|
| @@ -4248,13 +4248,20 @@ 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()) {
|
| +
|
| + LOG(ERROR)
|
| + << "selection = (" << selection_start << "--" << selection_end << ")";
|
| + for (size_t i=0; i<underlines.size(); ++i)
|
| + LOG(ERROR) << "[" << i << "] "
|
| + << underlines[i].startOffset << "--" << underlines[i].endOffset
|
| + << ", " << underlines[i].thick;
|
| +
|
| + if (pepper_delegate_.IsPluginFocused()) {
|
| + pepper_delegate_.OnImeSetComposition(text,
|
| + underlines,
|
| + selection_start,
|
| + selection_end);
|
| + } else {
|
| RenderWidget::OnImeSetComposition(text,
|
| underlines,
|
| selection_start,
|
| @@ -4264,48 +4271,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);
|
| }
|
| }
|
|
|
| -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();
|
| +}
|
| +
|
| 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();
|
| return true;
|
| }
|
|
|
|
|