Title: [96410] trunk/Source/WebCore
Revision
96410
Author
[email protected]
Date
2011-09-30 11:28:13 -0700 (Fri, 30 Sep 2011)

Log Message

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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (96409 => 96410)


--- trunk/Source/WebCore/ChangeLog	2011-09-30 18:20:22 UTC (rev 96409)
+++ trunk/Source/WebCore/ChangeLog	2011-09-30 18:28:13 UTC (rev 96410)
@@ -1,3 +1,15 @@
+2011-09-30  Ryosuke Niwa  <[email protected]>
+
+        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  <[email protected]>
 
         Fix EnabledAtRuntime support for constants.

Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (96409 => 96410)


--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2011-09-30 18:20:22 UTC (rev 96409)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2011-09-30 18:28:13 UTC (rev 96410)
@@ -703,41 +703,6 @@
         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)

Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.h (96409 => 96410)


--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.h	2011-09-30 18:20:22 UTC (rev 96409)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.h	2011-09-30 18:28:13 UTC (rev 96410)
@@ -89,7 +89,6 @@
     
     void removeRedundantStylesAndKeepStyleSpanInline(InsertedNodes&);
     void handleStyleSpans(Node* firstNodeInserted);
-    void copyStyleToChildren(Node* parentNode, const CSSMutableStyleDeclaration* parentStyle);
     void handlePasteAsQuotationNode();
     
     virtual void removeNodePreservingChildren(Node*);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to