Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(917)

Unified Diff: third_party/WebKit/Source/core/editing/InputMethodController.cpp

Issue 2316053002: Audit the use of updateStyleAndLayoutIgnorePendingStylesheets in InputMethodController::setSelectio… (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bbd161bf33e0cc0389cf5a6d32762d8a1fefc3da..dee24b414adbe665f5adef145b5293df89a046ec 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
@@ -255,7 +255,13 @@ bool InputMethodController::confirmCompositionOrInsertText(const String& text, C
return confirmComposition(composingText(), DoNotKeepSelection);
SelectionOffsetsScope selectionOffsetsScope(this);
- return confirmComposition();
+ bool result = confirmComposition();
+
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. see http://crbug.com/590369 for more details.
+ frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
yosin_UTC9 2016/09/08 04:04:41 This is the first pattern which updates layout aft
Xiaocheng 2016/09/08 06:39:09 It is in fact the dtor of the SelectionOffsetsScop
+
+ return result;
}
void InputMethodController::cancelComposition()
@@ -354,6 +360,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 +415,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);
@@ -498,9 +512,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())
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698