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

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

Issue 2414263002: Audit the use of updateStyleAndLayoutIgnorePendingStylesheets in toNormalizedEphemeralRange (Closed)
Patch Set: fix nit Created 4 years, 2 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
Index: third_party/WebKit/Source/core/editing/Editor.cpp
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp
index 6e52b6ab1e63e12f773133c998693b9c258238f4..129bf0e98a2dc1a1b7cbe9e7dc77a4b3d01fb6d4 100644
--- a/third_party/WebKit/Source/core/editing/Editor.cpp
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -447,6 +447,13 @@ void Editor::pasteWithPasteboard(Pasteboard* pasteboard) {
String text = pasteboard->plainText();
if (!text.isEmpty()) {
chosePlainText = true;
+
+ // TODO(xiaochengh): Use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ // |selectedRange| requires clean layout for visible selection
+ // normalization.
+ frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
fragment = createFragmentFromText(selectedRange(), text);
}
}
@@ -1002,6 +1009,13 @@ void Editor::cut(EditorCommandSource source) {
return; // DHTML did the whole operation
if (!canCut())
return;
+
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ // |tryDHTMLCut| dispatches cut event, which may make layout dirty, but we
+ // need clean layout to obtain the selected content.
+ frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
// TODO(yosin) We should use early return style here.
if (canDeleteRange(selectedRange())) {
spellChecker().updateMarkersForWordsAffectedByEditing(true);
@@ -1035,6 +1049,13 @@ void Editor::copy() {
return; // DHTML did the whole operation
if (!canCopy())
return;
+
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ // |tryDHTMLCopy| dispatches copy event, which may make layout dirty, but
+ // we need clean layout to obtain the selected content.
+ frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
if (enclosingTextFormControl(frame().selection().start())) {
Pasteboard::generalPasteboard()->writePlainText(
frame().selectedTextForClipboard(),
@@ -1098,6 +1119,12 @@ void Editor::pasteAsPlainText(EditorCommandSource source) {
void Editor::performDelete() {
if (!canDelete())
return;
+
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ // |selectedRange| requires clean layout for visible selection normalization.
+ frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
addToKillRing(selectedRange());
// TODO(chongz): |Editor::performDelete()| has no direction.
// https://github.com/w3c/editing/issues/130
« no previous file with comments | « third_party/WebKit/Source/core/editing/DOMSelection.cpp ('k') | third_party/WebKit/Source/core/editing/VisibleSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698