| Index: third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
|
| diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
|
| index 22bb7a466e4518b68132743e996f6800d8329899..185f2888c58a3ce78d13ccf5fbb8c90284c11984 100644
|
| --- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
|
| +++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
|
| @@ -65,6 +65,7 @@
|
| #include "web/PageOverlay.h"
|
| #include "web/WebDevToolsAgentImpl.h"
|
| #include "web/WebInputEventConversion.h"
|
| +#include "web/WebInputMethodControllerImpl.h"
|
| #include "web/WebLocalFrameImpl.h"
|
| #include "web/WebPluginContainerImpl.h"
|
| #include "web/WebRemoteFrameImpl.h"
|
| @@ -410,6 +411,12 @@ void WebFrameWidgetImpl::setBaseBackgroundColor(WebColor color) {
|
| m_localRoot->frameView()->setBaseBackgroundColor(color);
|
| }
|
|
|
| +WebInputMethodControllerImpl*
|
| +WebFrameWidgetImpl::getActiveWebInputMethodController() const {
|
| + return WebInputMethodControllerImpl::fromFrame(
|
| + focusedLocalFrameAvailableForIme());
|
| +}
|
| +
|
| void WebFrameWidgetImpl::scheduleAnimation() {
|
| if (m_layerTreeView) {
|
| m_layerTreeView->setNeedsBeginFrame();
|
| @@ -498,101 +505,6 @@ void WebFrameWidgetImpl::setFocus(bool enable) {
|
|
|
| // TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This
|
| // code needs to be refactored (http://crbug.com/629721).
|
| -bool WebFrameWidgetImpl::setComposition(
|
| - const WebString& text,
|
| - const WebVector<WebCompositionUnderline>& underlines,
|
| - int selectionStart,
|
| - int selectionEnd) {
|
| - LocalFrame* focused = focusedLocalFrameAvailableForIme();
|
| - if (!focused)
|
| - return false;
|
| -
|
| - if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused))
|
| - return plugin->setComposition(text, underlines, selectionStart,
|
| - selectionEnd);
|
| -
|
| - // The input focus has been moved to another WebWidget object.
|
| - // We should use this |editor| object only to complete the ongoing
|
| - // composition.
|
| - InputMethodController& inputMethodController =
|
| - focused->inputMethodController();
|
| - if (!focused->editor().canEdit() && !inputMethodController.hasComposition())
|
| - return false;
|
| -
|
| - // We should verify the parent node of this IME composition node are
|
| - // editable because JavaScript may delete a parent node of the composition
|
| - // node. In this case, WebKit crashes while deleting texts from the parent
|
| - // node, which doesn't exist any longer.
|
| - const EphemeralRange range =
|
| - inputMethodController.compositionEphemeralRange();
|
| - if (range.isNotNull()) {
|
| - Node* node = range.startPosition().computeContainerNode();
|
| - focused->document()->updateStyleAndLayoutTree();
|
| - if (!node || !hasEditableStyle(*node))
|
| - return false;
|
| - }
|
| -
|
| - // A keypress event is canceled. If an ongoing composition exists, then the
|
| - // keydown event should have arisen from a handled key (e.g., backspace).
|
| - // In this case we ignore the cancellation and continue; otherwise (no
|
| - // ongoing composition) we exit and signal success only for attempts to
|
| - // clear the composition.
|
| - if (m_suppressNextKeypressEvent && !inputMethodController.hasComposition())
|
| - return text.isEmpty();
|
| -
|
| - UserGestureIndicator gestureIndicator(DocumentUserGestureToken::create(
|
| - focused->document(), UserGestureToken::NewGesture));
|
| -
|
| - // When the range of composition underlines overlap with the range between
|
| - // selectionStart and selectionEnd, WebKit somehow won't paint the selection
|
| - // at all (see InlineTextBox::paint() function in InlineTextBox.cpp).
|
| - // But the selection range actually takes effect.
|
| - inputMethodController.setComposition(
|
| - String(text), CompositionUnderlineVectorBuilder(underlines),
|
| - selectionStart, selectionEnd);
|
| -
|
| - return text.isEmpty() || inputMethodController.hasComposition();
|
| -}
|
| -
|
| -// TODO(ekaramad):These methods are almost duplicated in WebViewImpl as well.
|
| -// This code needs to be refactored (http://crbug.com/629721).
|
| -bool WebFrameWidgetImpl::commitText(const WebString& text,
|
| - int relativeCaretPosition) {
|
| - LocalFrame* focused = focusedLocalFrameAvailableForIme();
|
| - if (!focused)
|
| - return false;
|
| -
|
| - UserGestureIndicator gestureIndicator(DocumentUserGestureToken::create(
|
| - focused->document(), UserGestureToken::NewGesture));
|
| -
|
| - if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused))
|
| - return plugin->commitText(text, relativeCaretPosition);
|
| -
|
| - return focused->inputMethodController().commitText(text,
|
| - relativeCaretPosition);
|
| -}
|
| -
|
| -bool WebFrameWidgetImpl::finishComposingText(
|
| - ConfirmCompositionBehavior selectionBehavior) {
|
| - LocalFrame* focused = focusedLocalFrameAvailableForIme();
|
| - if (!focused)
|
| - return false;
|
| -
|
| - if (WebPlugin* plugin = focusedPluginIfInputMethodSupported(focused))
|
| - return plugin->finishComposingText(selectionBehavior);
|
| -
|
| - // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
|
| - // needs to be audited. See http://crbug.com/590369 for more details.
|
| - focused->document()->updateStyleAndLayoutIgnorePendingStylesheets();
|
| -
|
| - return focused->inputMethodController().finishComposingText(
|
| - selectionBehavior == KeepSelection
|
| - ? InputMethodController::KeepSelection
|
| - : InputMethodController::DoNotKeepSelection);
|
| -}
|
| -
|
| -// TODO(ekaramad):This method is almost duplicated in WebViewImpl as well. This
|
| -// code needs to be refactored (http://crbug.com/629721).
|
| WebRange WebFrameWidgetImpl::compositionRange() {
|
| LocalFrame* focused = focusedLocalFrameAvailableForIme();
|
| if (!focused)
|
|
|