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

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

Issue 2003793002: Audit the use of updateStyleAndLayoutIgnorePendingStylesheets in PlainTextRange. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated some comments. Created 4 years, 5 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/ApplyStyleCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp b/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp
index a2982225f5a44cdfe7bfe5dddffd14aa687f5f2c..a52e97a07198745f62b5d2d781f7c613e723cdf8 100644
--- a/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp
@@ -302,6 +302,11 @@ void ApplyStyleCommand::applyBlockStyle(EditingStyle *style, EditingState* editi
nextParagraphStart = nextPositionOf(endOfParagraph(paragraphStart));
}
+ // Update style and layout again, since added or removed styles could have
+ // affected the layout. We need clean layout in order to compute
+ // plain-text ranges below.
+ document().updateStyleAndLayoutIgnorePendingStylesheets();
+
EphemeralRange startEphemeralRange = PlainTextRange(startIndex).createRangeForSelection(toContainerNode(scope));
if (startEphemeralRange.isNull())
return;

Powered by Google App Engine
This is Rietveld 408576698