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

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

Issue 2131113002: Make CompositeEditCommand::moveParagraph() to abort when destination becomes invisible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-07-20T17:11:32 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
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/execCommand/apply_style/justify_full_without_body_crash.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 // FIXME: Trim text between beforeParagraph and afterParagraph if they a ren't equal. 1334 // FIXME: Trim text between beforeParagraph and afterParagraph if they a ren't equal.
1335 insertNodeAt(HTMLBRElement::create(document()), beforeParagraph.deepEqui valent(), editingState); 1335 insertNodeAt(HTMLBRElement::create(document()), beforeParagraph.deepEqui valent(), editingState);
1336 if (editingState->isAborted()) 1336 if (editingState->isAborted())
1337 return; 1337 return;
1338 // Need an updateLayout here in case inserting the br has split a text n ode. 1338 // Need an updateLayout here in case inserting the br has split a text n ode.
1339 document().updateStyleAndLayoutIgnorePendingStylesheets(); 1339 document().updateStyleAndLayoutIgnorePendingStylesheets();
1340 } 1340 }
1341 1341
1342 destinationIndex = TextIterator::rangeLength(Position::firstPositionInNode(d ocument().documentElement()), destination.toParentAnchoredPosition(), true); 1342 destinationIndex = TextIterator::rangeLength(Position::firstPositionInNode(d ocument().documentElement()), destination.toParentAnchoredPosition(), true);
1343 1343
1344 setEndingSelection(VisibleSelection(destination, originalIsDirectional)); 1344 VisibleSelection destinationSelection(destination, originalIsDirectional);
1345 DCHECK(!endingSelection().isNone()); 1345 if (endingSelection().isNone()) {
1346 // We abort executing command since |destination| becomes invisible.
1347 editingState->abort();
1348 return;
1349 }
1350 setEndingSelection(destinationSelection);
1346 ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::S electReplacement | ReplaceSelectionCommand::MovingParagraph; 1351 ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::S electReplacement | ReplaceSelectionCommand::MovingParagraph;
1347 if (shouldPreserveStyle == DoNotPreserveStyle) 1352 if (shouldPreserveStyle == DoNotPreserveStyle)
1348 options |= ReplaceSelectionCommand::MatchStyle; 1353 options |= ReplaceSelectionCommand::MatchStyle;
1349 applyCommandToComposite(ReplaceSelectionCommand::create(document(), fragment , options), editingState); 1354 applyCommandToComposite(ReplaceSelectionCommand::create(document(), fragment , options), editingState);
1350 if (editingState->isAborted()) 1355 if (editingState->isAborted())
1351 return; 1356 return;
1352 1357
1353 document().frame()->spellChecker().markMisspellingsAndBadGrammar(endingSelec tion()); 1358 document().frame()->spellChecker().markMisspellingsAndBadGrammar(endingSelec tion());
1354 1359
1355 // If the selection is in an empty paragraph, restore styles from the old em pty paragraph to the new empty paragraph. 1360 // If the selection is in an empty paragraph, restore styles from the old em pty paragraph to the new empty paragraph.
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 } 1628 }
1624 1629
1625 DEFINE_TRACE(CompositeEditCommand) 1630 DEFINE_TRACE(CompositeEditCommand)
1626 { 1631 {
1627 visitor->trace(m_commands); 1632 visitor->trace(m_commands);
1628 visitor->trace(m_composition); 1633 visitor->trace(m_composition);
1629 EditCommand::trace(visitor); 1634 EditCommand::trace(visitor);
1630 } 1635 }
1631 1636
1632 } // namespace blink 1637 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/execCommand/apply_style/justify_full_without_body_crash.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698