summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/editing/MoveSelectionCommand.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-24 11:24:40 +0100
committerBen Murdoch <benm@google.com>2011-06-02 09:53:15 +0100
commit81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch)
tree7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebCore/editing/MoveSelectionCommand.cpp
parent94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff)
downloadexternal_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip
external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz
external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebCore/editing/MoveSelectionCommand.cpp')
-rw-r--r--Source/WebCore/editing/MoveSelectionCommand.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/Source/WebCore/editing/MoveSelectionCommand.cpp b/Source/WebCore/editing/MoveSelectionCommand.cpp
index 0f23b29..cdf05ee 100644
--- a/Source/WebCore/editing/MoveSelectionCommand.cpp
+++ b/Source/WebCore/editing/MoveSelectionCommand.cpp
@@ -32,7 +32,7 @@
namespace WebCore {
MoveSelectionCommand::MoveSelectionCommand(PassRefPtr<DocumentFragment> fragment, const Position& position, bool smartInsert, bool smartDelete)
- : CompositeEditCommand(position.node()->document()), m_fragment(fragment), m_position(position), m_smartInsert(smartInsert), m_smartDelete(smartDelete)
+ : CompositeEditCommand(position.anchorNode()->document()), m_fragment(fragment), m_position(position), m_smartInsert(smartInsert), m_smartDelete(smartDelete)
{
ASSERT(m_fragment);
}
@@ -62,7 +62,7 @@ void MoveSelectionCommand::doApply()
// set the destination to the ending point after the deletion.
// Fixes: <rdar://problem/3910425> REGRESSION (Mail): Crash in ReplaceSelectionCommand;
// selection is empty, leading to null deref
- if (!pos.node()->inDocument())
+ if (!pos.anchorNode()->inDocument())
pos = endingSelection().start();
setEndingSelection(VisibleSelection(pos, endingSelection().affinity()));
@@ -70,7 +70,10 @@ void MoveSelectionCommand::doApply()
// Document was modified out from under us.
return;
}
- applyCommandToComposite(ReplaceSelectionCommand::create(document(), m_fragment, true, m_smartInsert));
+ ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::PreventNesting;
+ if (m_smartInsert)
+ options |= ReplaceSelectionCommand::SmartReplace;
+ applyCommandToComposite(ReplaceSelectionCommand::create(document(), m_fragment, options));
}
EditAction MoveSelectionCommand::editingAction() const