| Index: content/renderer/render_widget.cc
|
| diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
|
| index a7d25020b4dfc937ce05a13394ce1c5463250de8..c43ce78b535124b1694ebb1a00c71dcbe3f26631 100644
|
| --- a/content/renderer/render_widget.cc
|
| +++ b/content/renderer/render_widget.cc
|
| @@ -246,7 +246,8 @@ RenderWidget::RenderWidget(CompositorDependencies* compositor_deps,
|
| frame_swap_message_queue_(new FrameSwapMessageQueue()),
|
| resizing_mode_selector_(new ResizingModeSelector()),
|
| has_host_context_menu_location_(false),
|
| - has_focus_(false) {
|
| + has_focus_(false),
|
| + focused_pepper_plugin_(nullptr) {
|
| if (!swapped_out)
|
| RenderProcess::current()->AddRefProcess();
|
| DCHECK(RenderThread::Get());
|
| @@ -1484,6 +1485,18 @@ void RenderWidget::OnImeSetComposition(
|
| const std::vector<WebCompositionUnderline>& underlines,
|
| const gfx::Range& replacement_range,
|
| int selection_start, int selection_end) {
|
| +#if defined(ENABLE_PLUGINS)
|
| + if (focused_pepper_plugin_) {
|
| + focused_pepper_plugin_->render_frame()->OnImeSetComposition(
|
| + text, underlines, selection_start, selection_end);
|
| + return;
|
| + }
|
| +#endif
|
| + if (replacement_range.IsValid()) {
|
| + webwidget_->adjustReplacementRangeForAccentedCharacters(
|
| + replacement_range.start(), replacement_range.length());
|
| + }
|
| +
|
| if (!ShouldHandleImeEvent())
|
| return;
|
| ImeEventGuard guard(this);
|
| @@ -1501,6 +1514,18 @@ void RenderWidget::OnImeSetComposition(
|
| void RenderWidget::OnImeConfirmComposition(const base::string16& text,
|
| const gfx::Range& replacement_range,
|
| bool keep_selection) {
|
| +#if defined(ENABLE_PLUGINS)
|
| + if (focused_pepper_plugin_) {
|
| + focused_pepper_plugin_->render_frame()->OnImeConfirmComposition(
|
| + text, replacement_range, keep_selection);
|
| + return;
|
| + }
|
| +#endif
|
| + if (replacement_range.IsValid()) {
|
| + webwidget_->adjustReplacementRangeForAccentedCharacters(
|
| + replacement_range.start(), replacement_range.length());
|
| + }
|
| +
|
| if (!ShouldHandleImeEvent())
|
| return;
|
| ImeEventGuard guard(this);
|
| @@ -1588,6 +1613,10 @@ void RenderWidget::showImeIfNeeded() {
|
| }
|
|
|
| ui::TextInputType RenderWidget::GetTextInputType() {
|
| +#if defined(ENABLE_PLUGINS)
|
| + if (focused_pepper_plugin_)
|
| + return focused_pepper_plugin_->text_input_type();
|
| +#endif
|
| if (webwidget_)
|
| return WebKitToUiTextInputType(webwidget_->textInputType());
|
| return ui::TEXT_INPUT_TYPE_NONE;
|
| @@ -1800,6 +1829,19 @@ void RenderWidget::OnImeEventGuardFinish(ImeEventGuard* guard) {
|
| }
|
|
|
| void RenderWidget::GetSelectionBounds(gfx::Rect* focus, gfx::Rect* anchor) {
|
| +#if defined(ENABLE_PLUGINS)
|
| + if (focused_pepper_plugin_) {
|
| + // TODO(kinaba) http://crbug.com/101101
|
| + // Current Pepper IME API does not handle selection bounds. So we simply
|
| + // use the caret position as an empty range for now. It will be updated
|
| + // after Pepper API equips features related to surrounding text retrieval.
|
| + blink::WebRect caret(focused_pepper_plugin_->GetCaretBounds());
|
| + convertViewportToWindow(&caret);
|
| + *focus = caret;
|
| + *anchor = caret;
|
| + return;
|
| + }
|
| +#endif
|
| WebRect focus_webrect;
|
| WebRect anchor_webrect;
|
| webwidget_->selectionBounds(focus_webrect, anchor_webrect);
|
| @@ -1894,9 +1936,29 @@ void RenderWidget::GetCompositionCharacterBounds(
|
| std::vector<gfx::Rect>* bounds) {
|
| DCHECK(bounds);
|
| bounds->clear();
|
| +
|
| +#if defined(ENABLE_PLUGINS)
|
| + if (focused_pepper_plugin_)
|
| + return;
|
| +#endif
|
| +
|
| + if (!webwidget_)
|
| + return;
|
| + blink::WebVector<blink::WebRect> bounds_from_blink;
|
| + if (!webwidget_->getCompositionCharacterBounds(bounds_from_blink))
|
| + return;
|
| +
|
| + for (size_t i = 0; i < bounds_from_blink.size(); ++i) {
|
| + convertViewportToWindow(&bounds_from_blink[i]);
|
| + bounds->push_back(bounds_from_blink[i]);
|
| + }
|
| }
|
|
|
| void RenderWidget::GetCompositionRange(gfx::Range* range) {
|
| +#if defined(ENABLE_PLUGINS)
|
| + if (focused_pepper_plugin_)
|
| + return;
|
| +#endif
|
| size_t location, length;
|
| if (webwidget_->compositionRange(&location, &length)) {
|
| range->set_start(location);
|
| @@ -1924,6 +1986,10 @@ bool RenderWidget::ShouldUpdateCompositionInfo(
|
| }
|
|
|
| bool RenderWidget::CanComposeInline() {
|
| +#if defined(ENABLE_PLUGINS)
|
| + if (focused_pepper_plugin_)
|
| + return focused_pepper_plugin_->IsPluginAcceptingCompositionEvents();
|
| +#endif
|
| return true;
|
| }
|
|
|
|
|