| Index: third_party/WebKit/Source/core/editing/InputMethodController.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/InputMethodController.cpp b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
|
| index 1308f06dccb9901a184e8aa38bf4af836fbf834c..37285616a078153290554b6e9bd380351c101df0 100644
|
| --- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
|
| +++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
|
| @@ -118,19 +118,6 @@ void insertTextDuringCompositionWithEvents(LocalFrame& frame, const String& text
|
|
|
| } // anonymous namespace
|
|
|
| -InputMethodController::SelectionOffsetsScope::SelectionOffsetsScope(InputMethodController* inputMethodController)
|
| - : m_inputMethodController(inputMethodController)
|
| - , m_offsets(inputMethodController->getSelectionOffsets())
|
| -{
|
| -}
|
| -
|
| -InputMethodController::SelectionOffsetsScope::~SelectionOffsetsScope()
|
| -{
|
| - m_inputMethodController->setSelectionOffsets(m_offsets);
|
| -}
|
| -
|
| -// ----------------------------
|
| -
|
| InputMethodController* InputMethodController::create(LocalFrame& frame)
|
| {
|
| return new InputMethodController(frame);
|
| @@ -254,8 +241,15 @@ bool InputMethodController::confirmCompositionOrInsertText(const String& text, C
|
| if (confirmBehavior == DoNotKeepSelection)
|
| return confirmComposition(composingText(), DoNotKeepSelection);
|
|
|
| - SelectionOffsetsScope selectionOffsetsScope(this);
|
| - return confirmComposition();
|
| + PlainTextRange oldOffsets = getSelectionOffsets();
|
| + bool result = confirmComposition();
|
| +
|
| + // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
|
| + // needs to be audited. see http://crbug.com/590369 for more details.
|
| + frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
|
| +
|
| + setSelectionOffsets(oldOffsets);
|
| + return result;
|
| }
|
|
|
| void InputMethodController::cancelComposition()
|
| @@ -354,6 +348,10 @@ void InputMethodController::setComposition(const String& text, const Vector<Comp
|
| TypingCommand::deleteSelection(*frame().document(), TypingCommand::PreventSpellChecking);
|
| }
|
|
|
| + // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
|
| + // needs to be audited. see http://crbug.com/590369 for more details.
|
| + frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
|
| +
|
| setEditableSelectionOffsets(selectedRange);
|
| return;
|
| }
|
| @@ -405,6 +403,10 @@ void InputMethodController::setComposition(const String& text, const Vector<Comp
|
| if (baseNode->layoutObject())
|
| baseNode->layoutObject()->setShouldDoFullPaintInvalidation();
|
|
|
| + // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
|
| + // needs to be audited. see http://crbug.com/590369 for more details.
|
| + frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
|
| +
|
| // We shouldn't close typing in the middle of setComposition.
|
| setEditableSelectionOffsets(selectedRange, NotUserTriggered);
|
|
|
| @@ -496,9 +498,7 @@ bool InputMethodController::setSelectionOffsets(const PlainTextRange& selectionO
|
| if (!rootEditableElement)
|
| return false;
|
|
|
| - // TODO(dglazkov): The use of updateStyleAndLayoutIgnorePendingStylesheets needs to be audited.
|
| - // see http://crbug.com/590369 for more details.
|
| - rootEditableElement->document().updateStyleAndLayoutIgnorePendingStylesheets();
|
| + DCHECK(!rootEditableElement->document().needsLayoutTreeUpdate());
|
|
|
| const EphemeralRange range = selectionOffsets.createRange(*rootEditableElement);
|
| if (range.isNull())
|
|
|