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

Unified Diff: third_party/WebKit/Source/core/editing/commands/IndentOutdentCommand.cpp

Issue 2405223002: Ensure valid input for CompositeEditCommand::moveParagraph[s] (Closed)
Patch Set: Remove the dirty hacks 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/commands/IndentOutdentCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/IndentOutdentCommand.cpp b/third_party/WebKit/Source/core/editing/commands/IndentOutdentCommand.cpp
index 207ede9981a024acec661a57f0a944762b9f96c4..c2fd4ca90b4d36b105dfd6d46ce602051769c8dc 100644
--- a/third_party/WebKit/Source/core/editing/commands/IndentOutdentCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/IndentOutdentCommand.cpp
@@ -295,6 +295,8 @@ void IndentOutdentCommand::outdentParagraph(EditingState* editingState) {
createVisiblePosition(visibleEndOfParagraph.toPositionWithAffinity());
}
+ // TODO(xiaochengh): We should not store a VisiblePosition and later inspect
+ // its properties when it is already invalidated.
VisiblePosition startOfParagraphToMove =
startOfParagraph(visibleStartOfParagraph);
VisiblePosition endOfParagraphToMove = endOfParagraph(visibleEndOfParagraph);
@@ -306,6 +308,10 @@ void IndentOutdentCommand::outdentParagraph(EditingState* editingState) {
return;
document().updateStyleAndLayoutIgnorePendingStylesheets();
+ startOfParagraphToMove =
+ createVisiblePosition(startOfParagraphToMove.toPositionWithAffinity());
+ endOfParagraphToMove =
+ createVisiblePosition(endOfParagraphToMove.toPositionWithAffinity());
moveParagraph(startOfParagraphToMove, endOfParagraphToMove,
VisiblePosition::beforeNode(placeholder), editingState,
PreserveSelection);

Powered by Google App Engine
This is Rietveld 408576698