summaryrefslogtreecommitdiff
path: root/Source/WebCore/editing/ReplaceSelectionCommand.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-03 09:55:33 +0100
commitcd44dc59cdfc39534aef4d417e9f3c412e3be139 (patch)
tree8d89889ba95ed6ec9322e733846cc9cce9d7dff1 /Source/WebCore/editing/ReplaceSelectionCommand.cpp
parentd11f84f5b5cdc0d92a08af01b13472fdd5f9acb9 (diff)
downloadqtwebkit-cd44dc59cdfc39534aef4d417e9f3c412e3be139.tar.gz
Imported WebKit commit fce473cb4d55aa9fe9d0b0322a2fffecb731b961 (http://svn.webkit.org/repository/webkit/trunk@106560)
Diffstat (limited to 'Source/WebCore/editing/ReplaceSelectionCommand.cpp')
-rw-r--r--Source/WebCore/editing/ReplaceSelectionCommand.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/WebCore/editing/ReplaceSelectionCommand.cpp b/Source/WebCore/editing/ReplaceSelectionCommand.cpp
index 3570457c9..18f622e05 100644
--- a/Source/WebCore/editing/ReplaceSelectionCommand.cpp
+++ b/Source/WebCore/editing/ReplaceSelectionCommand.cpp
@@ -502,8 +502,8 @@ void ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline(Insert
continue;
} else
removeNodeAttribute(element, styleAttr);
- } else if (newInlineStyle->style()->length() != inlineStyle->length())
- setNodeAttribute(element, styleAttr, newInlineStyle->style()->cssText());
+ } else if (newInlineStyle->style()->propertyCount() != inlineStyle->propertyCount())
+ setNodeAttribute(element, styleAttr, newInlineStyle->style()->asText());
// FIXME: Tolerate differences in id, class, and style attributes.
if (isNonTableCellHTMLBlockElement(element) && areIdenticalElements(element, element->parentNode())
@@ -660,7 +660,7 @@ static bool handleStyleSpansBeforeInsertion(ReplacementFragment& fragment, const
Node* wrappingStyleSpan = topNode;
RefPtr<EditingStyle> styleAtInsertionPos = EditingStyle::create(insertionPos.parentAnchoredEquivalent());
- String styleText = styleAtInsertionPos->style()->cssText();
+ String styleText = styleAtInsertionPos->style()->asText();
// FIXME: This string comparison is a naive way of comparing two styles.
// We should be taking the diff and check that the diff is empty.
@@ -720,7 +720,7 @@ void ReplaceSelectionCommand::handleStyleSpans(InsertedNodes& insertedNodes)
insertedNodes.willRemoveNodePreservingChildren(wrappingStyleSpan);
removeNodePreservingChildren(wrappingStyleSpan);
} else
- setNodeAttribute(wrappingStyleSpan, styleAttr, style->style()->cssText());
+ setNodeAttribute(wrappingStyleSpan, styleAttr, style->style()->asText());
}
void ReplaceSelectionCommand::mergeEndIfNeeded()
@@ -817,6 +817,9 @@ void ReplaceSelectionCommand::doApply()
if (!selection.isNonOrphanedCaretOrRange() || !selection.start().deprecatedNode())
return;
+ if (!selection.rootEditableElement())
+ return;
+
ReplacementFragment fragment(document(), m_documentFragment.get(), m_matchStyle, selection);
if (performTrivialReplace(fragment))
return;