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

Side by Side 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, 3 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 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 VisiblePosition visibleStart = endingSelection().visibleStart(); 1292 VisiblePosition visibleStart = endingSelection().visibleStart();
1293 VisiblePosition visibleEnd = endingSelection().visibleEnd(); 1293 VisiblePosition visibleEnd = endingSelection().visibleEnd();
1294 1294
1295 bool startAfterParagraph = comparePositions(visibleStart, endOfParagraph ToMove) > 0; 1295 bool startAfterParagraph = comparePositions(visibleStart, endOfParagraph ToMove) > 0;
1296 bool endBeforeParagraph = comparePositions(visibleEnd, startOfParagraphT oMove) < 0; 1296 bool endBeforeParagraph = comparePositions(visibleEnd, startOfParagraphT oMove) < 0;
1297 1297
1298 if (!startAfterParagraph && !endBeforeParagraph) { 1298 if (!startAfterParagraph && !endBeforeParagraph) {
1299 bool startInParagraph = comparePositions(visibleStart, startOfParagr aphToMove) >= 0; 1299 bool startInParagraph = comparePositions(visibleStart, startOfParagr aphToMove) >= 0;
1300 bool endInParagraph = comparePositions(visibleEnd, endOfParagraphToM ove) <= 0; 1300 bool endInParagraph = comparePositions(visibleEnd, endOfParagraphToM ove) <= 0;
1301 1301
1302 // TextIterator::rangeLength requires clean layout.
1303 document().updateStyleAndLayoutIgnorePendingStylesheets();
1304
1302 startIndex = 0; 1305 startIndex = 0;
1303 if (startInParagraph) 1306 if (startInParagraph)
1304 startIndex = TextIterator::rangeLength(startOfParagraphToMove.to ParentAnchoredPosition(), visibleStart.toParentAnchoredPosition(), true); 1307 startIndex = TextIterator::rangeLength(startOfParagraphToMove.to ParentAnchoredPosition(), visibleStart.toParentAnchoredPosition(), true);
1305 1308
1306 endIndex = 0; 1309 endIndex = 0;
1307 if (endInParagraph) 1310 if (endInParagraph)
1308 endIndex = TextIterator::rangeLength(startOfParagraphToMove.toPa rentAnchoredPosition(), visibleEnd.toParentAnchoredPosition(), true); 1311 endIndex = TextIterator::rangeLength(startOfParagraphToMove.toPa rentAnchoredPosition(), visibleEnd.toParentAnchoredPosition(), true);
1309 } 1312 }
1310 } 1313 }
1311 1314
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1654 } 1657 }
1655 1658
1656 DEFINE_TRACE(CompositeEditCommand) 1659 DEFINE_TRACE(CompositeEditCommand)
1657 { 1660 {
1658 visitor->trace(m_commands); 1661 visitor->trace(m_commands);
1659 visitor->trace(m_composition); 1662 visitor->trace(m_composition);
1660 EditCommand::trace(visitor); 1663 EditCommand::trace(visitor);
1661 } 1664 }
1662 1665
1663 } // namespace blink 1666 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698