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

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

Issue 2291883003: Ensure clean layout before calling TextIterator::rangeLength in editing code (Closed)
Patch Set: Created 4 years, 4 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/CompositeEditCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
index 8dfe33c483607d7cf01dacea07d2d2dfea5de9a0..4d28398ca07176da9992bb687dcbd5dddebebcb4 100644
--- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
@@ -1299,6 +1299,9 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
bool startInParagraph = comparePositions(visibleStart, startOfParagraphToMove) >= 0;
bool endInParagraph = comparePositions(visibleEnd, endOfParagraphToMove) <= 0;
+ // TextIterator::rangeLength requires clean layout.
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
+
startIndex = 0;
if (startInParagraph)
startIndex = TextIterator::rangeLength(startOfParagraphToMove.toParentAnchoredPosition(), visibleStart.toParentAnchoredPosition(), true);

Powered by Google App Engine
This is Rietveld 408576698