| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |