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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 295 }
296 296
297 if (nextParagraphStart.isOrphan()) 297 if (nextParagraphStart.isOrphan())
298 nextParagraphStart = nextPositionOf(endOfParagraph(paragraphStar t)); 298 nextParagraphStart = nextPositionOf(endOfParagraph(paragraphStar t));
299 } 299 }
300 300
301 paragraphStart = nextParagraphStart; 301 paragraphStart = nextParagraphStart;
302 nextParagraphStart = nextPositionOf(endOfParagraph(paragraphStart)); 302 nextParagraphStart = nextPositionOf(endOfParagraph(paragraphStart));
303 } 303 }
304 304
305 // Update style and layout again, since added or removed styles could have
306 // affected the layout. We need clean layout in order to compute
307 // plain-text ranges below.
308 document().updateStyleAndLayoutIgnorePendingStylesheets();
309
305 EphemeralRange startEphemeralRange = PlainTextRange(startIndex).createRangeF orSelection(toContainerNode(scope)); 310 EphemeralRange startEphemeralRange = PlainTextRange(startIndex).createRangeF orSelection(toContainerNode(scope));
306 if (startEphemeralRange.isNull()) 311 if (startEphemeralRange.isNull())
307 return; 312 return;
308 EphemeralRange endEphemeralRange = PlainTextRange(endIndex).createRangeForSe lection(toContainerNode(scope)); 313 EphemeralRange endEphemeralRange = PlainTextRange(endIndex).createRangeForSe lection(toContainerNode(scope));
309 if (endEphemeralRange.isNull()) 314 if (endEphemeralRange.isNull())
310 return; 315 return;
311 updateStartEnd(startEphemeralRange.startPosition(), endEphemeralRange.startP osition()); 316 updateStartEnd(startEphemeralRange.startPosition(), endEphemeralRange.startP osition());
312 } 317 }
313 318
314 static MutableStylePropertySet* copyStyleOrCreateEmpty(const StylePropertySet* s tyle) 319 static MutableStylePropertySet* copyStyleOrCreateEmpty(const StylePropertySet* s tyle)
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 DEFINE_TRACE(ApplyStyleCommand) 1731 DEFINE_TRACE(ApplyStyleCommand)
1727 { 1732 {
1728 visitor->trace(m_style); 1733 visitor->trace(m_style);
1729 visitor->trace(m_start); 1734 visitor->trace(m_start);
1730 visitor->trace(m_end); 1735 visitor->trace(m_end);
1731 visitor->trace(m_styledInlineElement); 1736 visitor->trace(m_styledInlineElement);
1732 CompositeEditCommand::trace(visitor); 1737 CompositeEditCommand::trace(visitor);
1733 } 1738 }
1734 1739
1735 } // namespace blink 1740 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698