[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

cblu cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:24:41 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 204f104c07b18193913b748d0c3b92d1d34c46ef
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 29 22:00:43 2004 +0000

    	Fixed: <rdar://problem/3543619>: copied HTML is strangely formatted, random whitespace and return characters
    
            Reviewed by dave.
    
            * khtml/xml/dom_nodeimpl.cpp:
            (NodeImpl::recursive_toHTMLWithRange): remove all code that tries to format the HTML since we can rely on the existing white space to preserve the original formatting
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6006 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index f3f1cf4..fe604a1 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,12 @@
+2004-01-29  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: <rdar://problem/3543619>: copied HTML is strangely formatted, random whitespace and return characters
+
+        Reviewed by dave.
+
+        * khtml/xml/dom_nodeimpl.cpp:
+        (NodeImpl::recursive_toHTMLWithRange): remove all code that tries to format the HTML since we can rely on the existing white space to preserve the original formatting
+
 2004-01-28  John Sullivan  <sullivan at apple.com>
 
         Reviewed by Dave.
diff --git a/WebCore/khtml/xml/dom_nodeimpl.cpp b/WebCore/khtml/xml/dom_nodeimpl.cpp
index 371cca4..a958128 100644
--- a/WebCore/khtml/xml/dom_nodeimpl.cpp
+++ b/WebCore/khtml/xml/dom_nodeimpl.cpp
@@ -288,6 +288,7 @@ QString NodeImpl::recursive_toHTMLWithRange(bool start, const DOM::Range &range)
 	bool isNodeIncluded = false;
 	Id ident = id();
 	
+	// Determine if the HTML string of this node should be part of the end result.
 	if (!start || (start && (ident == ID_TABLE || ident == ID_OL || ident == ID_UL))) {	
 		// Check if this node is in the range or is an ancestor of a node in the range.
 		while (n) {
@@ -316,9 +317,9 @@ QString NodeImpl::recursive_toHTMLWithRange(bool start, const DOM::Range &range)
 			n = next;
 		}
 	}
-	
-	if (isNodeIncluded) {	
-		// Copy who I am into the htmlText string
+		
+	if (isNodeIncluded) {
+		// Copy who I am into the me string
 		if (nodeType() == Node::TEXT_NODE) {
 			DOMString str = nodeValue().copy();
 			if (this == endContainer) {
@@ -327,64 +328,40 @@ QString NodeImpl::recursive_toHTMLWithRange(bool start, const DOM::Range &range)
 			if (this == startContainer) {
 				str.remove(0, range.startOffset());
 			}
-			me = escapeHTML(str.string());
+			me += escapeHTML(str.string());
 		} else {
 			// If I am an element, not a text
-			NodeImpl* temp = previousSibling();
-			if(temp)
-			{
-				if( !start && (temp->nodeType() != Node::TEXT_NODE && nodeType() != Node::TEXT_NODE ) )
-					me = QString("    ") + QChar('<') + nodeName().string();
-				else
-					me = QChar('<') + nodeName().string();
-			}
-			else
-				me = QChar('<') + nodeName().string();
+			me += QChar('<') + nodeName().string();
 			// print attributes
-			if( nodeType() == Node::ELEMENT_NODE )
-			{
+			if (nodeType() == Node::ELEMENT_NODE) {
 				const ElementImpl *el = static_cast<const ElementImpl *>(this);
 				NamedNodeMap attrs = el->attributes();
 				unsigned long lmap = attrs.length();
-				for( unsigned int j=0; j<lmap; j++ )
+				for (unsigned int j=0; j<lmap; j++) {
 					me += " " + attrs.item(j).nodeName().string() + "=\"" + attrs.item(j).nodeValue().string() + "\"";
+				}
 			}
 			// print ending bracket of start tag
-			if( firstChild() == 0 ) {    // if element has no endtag
-				if (isHTMLElement()) {
-					me +=">";
-				} else {
-					me +="/>";
-				}
-			} else                        // if element has endtag
-			{
-				NodeImpl* temp = nextSibling();
-				if(temp)
-				{
-					if( (temp->nodeType() != Node::TEXT_NODE) )
-						me += ">\n";
-					else
-						me += ">";
-				}
-				else
-					me += ">";
+			if (isHTMLElement()) {
+				me += ">";
+			} else {
+				me += "/>";
 			}
 		}
 	}
 	
-    if( (n = firstChild()) )
-    {
+    if ((n = firstChild())) {
         // print firstChild
         me += n->recursive_toHTMLWithRange(false, range);
-		
         // Print my ending tag
         if (isNodeIncluded && nodeType() != Node::TEXT_NODE) {
-            me += "</" + nodeName().string() + ">\n";
+			me += "</" + nodeName().string() + ">";
 		}
     }
     // print next sibling
-    if( (n = nextSibling()) )
+    if ((n = nextSibling())) {
         me += n->recursive_toHTMLWithRange(false, range);
+	}
 	
     return me;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list