| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006 Apple Computer, 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 18 matching lines...) Expand all Loading... |
| 29 #include "core/editing/commands/ReplaceSelectionCommand.h" | 29 #include "core/editing/commands/ReplaceSelectionCommand.h" |
| 30 | 30 |
| 31 namespace blink { | 31 namespace blink { |
| 32 | 32 |
| 33 MoveSelectionCommand::MoveSelectionCommand(PassRefPtrWillBeRawPtr<DocumentFragme
nt> fragment, const Position& position, bool smartInsert, bool smartDelete) | 33 MoveSelectionCommand::MoveSelectionCommand(PassRefPtrWillBeRawPtr<DocumentFragme
nt> fragment, const Position& position, bool smartInsert, bool smartDelete) |
| 34 : CompositeEditCommand(*position.document()), m_fragment(fragment), m_positi
on(position), m_smartInsert(smartInsert), m_smartDelete(smartDelete) | 34 : CompositeEditCommand(*position.document()), m_fragment(fragment), m_positi
on(position), m_smartInsert(smartInsert), m_smartDelete(smartDelete) |
| 35 { | 35 { |
| 36 ASSERT(m_fragment); | 36 ASSERT(m_fragment); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void MoveSelectionCommand::doApply() | 39 void MoveSelectionCommand::doApply(EditingState*) |
| 40 { | 40 { |
| 41 ASSERT(endingSelection().isNonOrphanedRange()); | 41 ASSERT(endingSelection().isNonOrphanedRange()); |
| 42 | 42 |
| 43 Position pos = m_position; | 43 Position pos = m_position; |
| 44 if (pos.isNull()) | 44 if (pos.isNull()) |
| 45 return; | 45 return; |
| 46 | 46 |
| 47 // Update the position otherwise it may become invalid after the selection i
s deleted. | 47 // Update the position otherwise it may become invalid after the selection i
s deleted. |
| 48 Position selectionEnd = endingSelection().end(); | 48 Position selectionEnd = endingSelection().end(); |
| 49 if (pos.isOffsetInAnchor() && selectionEnd.isOffsetInAnchor() | 49 if (pos.isOffsetInAnchor() && selectionEnd.isOffsetInAnchor() |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 | 84 |
| 85 DEFINE_TRACE(MoveSelectionCommand) | 85 DEFINE_TRACE(MoveSelectionCommand) |
| 86 { | 86 { |
| 87 visitor->trace(m_fragment); | 87 visitor->trace(m_fragment); |
| 88 visitor->trace(m_position); | 88 visitor->trace(m_position); |
| 89 CompositeEditCommand::trace(visitor); | 89 CompositeEditCommand::trace(visitor); |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace blink | 92 } // namespace blink |
| OLD | NEW |