summaryrefslogtreecommitdiffstats
path: root/WebCore/editing/SplitTextNodeCommand.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2009-12-17 09:55:06 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2009-12-17 09:55:06 -0800
commitb880d713c04257ca40abfef97c300afdead423b8 (patch)
tree6982576c228bcd1a7efe98afed544d840751094c /WebCore/editing/SplitTextNodeCommand.cpp
parente2e7a5c57b53f01e63a0245b4420d54b454cb373 (diff)
parent643ca7872b450ea4efacab6188849e5aac2ba161 (diff)
downloadexternal_webkit-b880d713c04257ca40abfef97c300afdead423b8.zip
external_webkit-b880d713c04257ca40abfef97c300afdead423b8.tar.gz
external_webkit-b880d713c04257ca40abfef97c300afdead423b8.tar.bz2
am 643ca787: Merge webkit.org at r51976 : Initial merge by git.
Merge commit '643ca7872b450ea4efacab6188849e5aac2ba161' into eclair-mr2-plus-aosp * commit '643ca7872b450ea4efacab6188849e5aac2ba161': Merge webkit.org at r51976 : Initial merge by git.
Diffstat (limited to 'WebCore/editing/SplitTextNodeCommand.cpp')
-rw-r--r--WebCore/editing/SplitTextNodeCommand.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/WebCore/editing/SplitTextNodeCommand.cpp b/WebCore/editing/SplitTextNodeCommand.cpp
index 3b04e01..15daa49 100644
--- a/WebCore/editing/SplitTextNodeCommand.cpp
+++ b/WebCore/editing/SplitTextNodeCommand.cpp
@@ -49,6 +49,10 @@ SplitTextNodeCommand::SplitTextNodeCommand(PassRefPtr<Text> text, int offset)
void SplitTextNodeCommand::doApply()
{
+ Node* parent = m_text2->parentNode();
+ if (!parent || !parent->isContentEditable())
+ return;
+
ExceptionCode ec = 0;
String prefixText = m_text2->substringData(0, m_offset, ec);
@@ -59,9 +63,6 @@ void SplitTextNodeCommand::doApply()
ASSERT(prefixTextNode);
document()->copyMarkers(m_text2.get(), 0, m_offset, prefixTextNode.get(), 0);
- Node* parent = m_text2->parentNode();
- if (!parent)
- return;
parent->insertBefore(prefixTextNode.get(), m_text2.get(), ec);
if (ec)
return;
@@ -72,7 +73,7 @@ void SplitTextNodeCommand::doApply()
void SplitTextNodeCommand::doUnapply()
{
- if (!m_text1)
+ if (!m_text1 || !m_text1->isContentEditable())
return;
ASSERT(m_text1->document() == document());