| Index: chrome/renderer/render_widget.cc
|
| diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc
|
| index 4637167195c2cdcf78ce025f5ea43002ec01fb8d..c6eef89c57ababfad65120ef8255be8037a98b8b 100644
|
| --- a/chrome/renderer/render_widget.cc
|
| +++ b/chrome/renderer/render_widget.cc
|
| @@ -14,6 +14,7 @@
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/common/render_messages.h"
|
| #include "chrome/common/render_messages_params.h"
|
| +#include "chrome/common/text_input_client_messages.h"
|
| #include "chrome/renderer/render_process.h"
|
| #include "chrome/renderer/render_thread.h"
|
| #include "chrome/renderer/renderer_webkitclient_impl.h"
|
| @@ -23,6 +24,7 @@
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenuInfo.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebRange.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h"
|
| @@ -48,6 +50,7 @@ using WebKit::WebNavigationPolicy;
|
| using WebKit::WebPopupMenu;
|
| using WebKit::WebPopupMenuInfo;
|
| using WebKit::WebPopupType;
|
| +using WebKit::WebRange;
|
| using WebKit::WebRect;
|
| using WebKit::WebScreenInfo;
|
| using WebKit::WebSize;
|
| @@ -875,19 +878,37 @@ void RenderWidget::OnImeSetComposition(
|
| int selection_start, int selection_end) {
|
| if (!webwidget_)
|
| return;
|
| - if (!webwidget_->setComposition(
|
| + if (webwidget_->setComposition(
|
| text, WebVector<WebCompositionUnderline>(underlines),
|
| selection_start, selection_end)) {
|
| + // Setting the IME composition was successful. Send the new composition
|
| + // range to the browser.
|
| + WebRange range = webwidget_->compositionRange();
|
| + if (range.isNull()) {
|
| + // The IME was cancelled via the Esc key, so just send back the caret.
|
| + range = webwidget_->caretOrSelectionRange();
|
| + }
|
| + Send(new TextInputClientViewHostMsg_ImeCompositionRangeChanged(routing_id(),
|
| + range.startOffset(), range.endOffset()));
|
| + } else {
|
| // If we failed to set the composition text, then we need to let the browser
|
| // process to cancel the input method's ongoing composition session, to make
|
| // sure we are in a consistent state.
|
| Send(new ViewHostMsg_ImeCancelComposition(routing_id()));
|
| + // Send an updated IME range with just the caret range.
|
| + WebRange range = webwidget_->caretOrSelectionRange();
|
| + Send(new TextInputClientViewHostMsg_ImeCompositionRangeChanged(routing_id(),
|
| + range.startOffset(), range.endOffset()));
|
| }
|
| }
|
|
|
| void RenderWidget::OnImeConfirmComposition(const string16& text) {
|
| if (webwidget_)
|
| webwidget_->confirmComposition(text);
|
| + // Send an updated IME range with just the caret range.
|
| + WebRange range = webwidget_->caretOrSelectionRange();
|
| + Send(new TextInputClientViewHostMsg_ImeCompositionRangeChanged(routing_id(),
|
| + range.startOffset(), range.endOffset()));
|
| }
|
|
|
| // This message causes the renderer to render an image of the
|
| @@ -1079,6 +1100,13 @@ void RenderWidget::resetInputMethod() {
|
| if (webwidget_->confirmComposition())
|
| Send(new ViewHostMsg_ImeCancelComposition(routing_id()));
|
| }
|
| +
|
| + // Send an updated IME range with the current caret rect.
|
| + WebRange range = webwidget_->caretOrSelectionRange();
|
| + if (!range.isNull()) {
|
| + Send(new TextInputClientViewHostMsg_ImeCompositionRangeChanged(routing_id(),
|
| + range.startOffset(), range.endOffset()));
|
| + }
|
| }
|
|
|
| void RenderWidget::SchedulePluginMove(
|
|
|