Remove unused ReplaceSelectionCommand::copyStyleToChildren
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Sep 2011 18:28:13 +0000 (18:28 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Sep 2011 18:28:13 +0000 (18:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=69153

Reviewed by Antonio Gomes.

Removed the function because it's no called anywhere.

* editing/ReplaceSelectionCommand.cpp:
* editing/ReplaceSelectionCommand.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96410 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/editing/ReplaceSelectionCommand.cpp
Source/WebCore/editing/ReplaceSelectionCommand.h

index 9f94805..68afbdb 100644 (file)
@@ -1,3 +1,15 @@
+2011-09-30  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Remove unused ReplaceSelectionCommand::copyStyleToChildren
+        https://bugs.webkit.org/show_bug.cgi?id=69153
+
+        Reviewed by Antonio Gomes.
+
+        Removed the function because it's no called anywhere.
+
+        * editing/ReplaceSelectionCommand.cpp:
+        * editing/ReplaceSelectionCommand.h:
+
 2011-09-30  Aaron Colwell  <acolwell@chromium.org>
 
         Fix EnabledAtRuntime support for constants.
index 9ef6063..efda606 100644 (file)
@@ -703,41 +703,6 @@ void ReplaceSelectionCommand::handleStyleSpans(Node* firstNodeInserted)
         setNodeAttribute(wrappingStyleSpan, styleAttr, style->style()->cssText());
 }
 
-// Take the style attribute of a span and apply it to it's children instead.  This allows us to
-// convert invalid HTML where a span contains block elements into valid HTML while preserving
-// styles.
-void ReplaceSelectionCommand::copyStyleToChildren(Node* parentNode, const CSSMutableStyleDeclaration* parentStyle)
-{
-    ASSERT(parentNode->hasTagName(spanTag));
-    NodeVector childNodes;
-    for (RefPtr<Node> childNode = parentNode->firstChild(); childNode; childNode = childNode->nextSibling())
-        childNodes.append(childNode);
-        
-    for (NodeVector::const_iterator it = childNodes.begin(); it != childNodes.end(); it++) {
-        Node* childNode = it->get();
-        if (childNode->isTextNode() || !isBlock(childNode) || childNode->hasTagName(preTag)) {
-            // In this case, put a span tag around the child node.
-            RefPtr<Node> newNode = parentNode->cloneNode(false);
-            ASSERT(newNode->hasTagName(spanTag));
-            HTMLElement* newSpan = toHTMLElement(newNode.get());
-            setNodeAttribute(newSpan, styleAttr, parentStyle->cssText());
-            insertNodeAfter(newSpan, childNode);
-            ExceptionCode ec = 0;
-            newSpan->appendChild(childNode, ec);
-            ASSERT(!ec);
-            childNode = newSpan;
-        } else if (childNode->isHTMLElement()) {
-            // Copy the style attribute and merge them into the child node.  We don't want to override
-            // existing styles, so don't clobber on merge.
-            RefPtr<CSSMutableStyleDeclaration> newStyle = parentStyle->copy();
-            HTMLElement* childElement = toHTMLElement(childNode);
-            RefPtr<CSSMutableStyleDeclaration> existingStyles = childElement->getInlineStyleDecl()->copy();
-            existingStyles->merge(newStyle.get(), false);
-            setNodeAttribute(childElement, styleAttr, existingStyles->cssText());
-        }
-    }
-}
-
 void ReplaceSelectionCommand::mergeEndIfNeeded()
 {
     if (!m_shouldMergeEnd)
index 9b4007d..34276a5 100644 (file)
@@ -89,7 +89,6 @@ private:
     
     void removeRedundantStylesAndKeepStyleSpanInline(InsertedNodes&);
     void handleStyleSpans(Node* firstNodeInserted);
-    void copyStyleToChildren(Node* parentNode, const CSSMutableStyleDeclaration* parentStyle);
     void handlePasteAsQuotationNode();
     
     virtual void removeNodePreservingChildren(Node*);