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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.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, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008 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 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1358 applyStyle(styleInEmptyParagraph, editingState); 1358 applyStyle(styleInEmptyParagraph, editingState);
1359 if (editingState->isAborted()) 1359 if (editingState->isAborted())
1360 return; 1360 return;
1361 } 1361 }
1362 1362
1363 if (shouldPreserveSelection == DoNotPreserveSelection || startIndex == -1) 1363 if (shouldPreserveSelection == DoNotPreserveSelection || startIndex == -1)
1364 return; 1364 return;
1365 Element* documentElement = document().documentElement(); 1365 Element* documentElement = document().documentElement();
1366 if (!documentElement) 1366 if (!documentElement)
1367 return; 1367 return;
1368
1369 // We need clean layout in order to compute plain-text ranges below.
1370 document().updateStyleAndLayoutIgnorePendingStylesheets();
1371
1368 // Fragment creation (using createMarkup) incorrectly uses regular spaces 1372 // Fragment creation (using createMarkup) incorrectly uses regular spaces
1369 // instead of nbsps for some spaces that were rendered (11475), which causes 1373 // instead of nbsps for some spaces that were rendered (11475), which causes
1370 // spaces to be collapsed during the move operation. This results in a call 1374 // spaces to be collapsed during the move operation. This results in a call
1371 // to rangeFromLocationAndLength with a location past the end of the 1375 // to rangeFromLocationAndLength with a location past the end of the
1372 // document (which will return null). 1376 // document (which will return null).
1373 EphemeralRange startRange = PlainTextRange(destinationIndex + startIndex).cr eateRangeForSelection(*documentElement); 1377 EphemeralRange startRange = PlainTextRange(destinationIndex + startIndex).cr eateRangeForSelection(*documentElement);
1374 if (startRange.isNull()) 1378 if (startRange.isNull())
1375 return; 1379 return;
1376 EphemeralRange endRange = PlainTextRange(destinationIndex + endIndex).create RangeForSelection(*documentElement); 1380 EphemeralRange endRange = PlainTextRange(destinationIndex + endIndex).create RangeForSelection(*documentElement);
1377 if (endRange.isNull()) 1381 if (endRange.isNull())
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 } 1623 }
1620 1624
1621 DEFINE_TRACE(CompositeEditCommand) 1625 DEFINE_TRACE(CompositeEditCommand)
1622 { 1626 {
1623 visitor->trace(m_commands); 1627 visitor->trace(m_commands);
1624 visitor->trace(m_composition); 1628 visitor->trace(m_composition);
1625 EditCommand::trace(visitor); 1629 EditCommand::trace(visitor);
1626 } 1630 }
1627 1631
1628 } // namespace blink 1632 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698