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

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:17:31 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit d851e378ba4af8a24ea2b48b2c6b738878c0e4fa
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 10 04:05:47 2003 +0000

            Reviewed by Richard.
    
    	<rdar://problem/3504049>: XMLSerializer object and serializeToString method needed for XMLHttpRequest testing
    
    	Also fixed some lasst-minute mistakes in the DOM serialization
    	code that was already there.
    
            * WebCore.pbproj/project.pbxproj:
            * khtml/dom/dom_doc.h:
            * khtml/ecma/Makefile.am:
            * khtml/ecma/kjs_window.cpp:
            (Window::get):
            * khtml/ecma/kjs_window.h:
            (KJS::Window::):
            * khtml/ecma/kjs_window.lut.h:
            (KJS::):
            * khtml/ecma/xmlserializer.cpp: Added.
            (KJS::XMLSerializerConstructorImp::XMLSerializerConstructorImp):
            (KJS::XMLSerializerConstructorImp::implementsConstruct):
            (KJS::XMLSerializerConstructorImp::construct):
            (KJS::):
            (KJS::XMLSerializer::XMLSerializer):
            (KJS::XMLSerializerProtoFunc::tryCall):
            * khtml/ecma/xmlserializer.h: Added.
            (KJS::XMLSerializer::toBoolean):
            (KJS::XMLSerializer::classInfo):
            (KJS::XMLSerializer::):
            * khtml/ecma/xmlserializer.lut.h: Added.
            (KJS::):
            * khtml/xml/dom_docimpl.cpp:
            (DocumentImpl::toString):
            (DocumentFragmentImpl::toString):
            * khtml/xml/dom_elementimpl.cpp:
            (AttrImpl::toString):
            (ElementImpl::toString):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5740 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index d794015..9a16884 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,41 @@
+2003-12-09  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by Richard.
+
+	<rdar://problem/3504049>: XMLSerializer object and serializeToString method needed for XMLHttpRequest testing
+
+	Also fixed some lasst-minute mistakes in the DOM serialization
+	code that was already there.
+	
+        * WebCore.pbproj/project.pbxproj:
+        * khtml/dom/dom_doc.h:
+        * khtml/ecma/Makefile.am:
+        * khtml/ecma/kjs_window.cpp:
+        (Window::get):
+        * khtml/ecma/kjs_window.h:
+        (KJS::Window::):
+        * khtml/ecma/kjs_window.lut.h:
+        (KJS::):
+        * khtml/ecma/xmlserializer.cpp: Added.
+        (KJS::XMLSerializerConstructorImp::XMLSerializerConstructorImp):
+        (KJS::XMLSerializerConstructorImp::implementsConstruct):
+        (KJS::XMLSerializerConstructorImp::construct):
+        (KJS::):
+        (KJS::XMLSerializer::XMLSerializer):
+        (KJS::XMLSerializerProtoFunc::tryCall):
+        * khtml/ecma/xmlserializer.h: Added.
+        (KJS::XMLSerializer::toBoolean):
+        (KJS::XMLSerializer::classInfo):
+        (KJS::XMLSerializer::):
+        * khtml/ecma/xmlserializer.lut.h: Added.
+        (KJS::):
+        * khtml/xml/dom_docimpl.cpp:
+        (DocumentImpl::toString):
+        (DocumentFragmentImpl::toString):
+        * khtml/xml/dom_elementimpl.cpp:
+        (AttrImpl::toString):
+        (ElementImpl::toString):
+
 2003-12-09  David Hyatt  <hyatt at apple.com>
 
 	Implement start() and stop() for marquees.
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index ef45d5a..55d7e6f 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -521,6 +521,8 @@
 				654E7EE40569FD4600358BD2,
 				654E7EE50569FD4600358BD2,
 				84B2B1F9056BEF3A00D2B771,
+				65912B110586921000123A69,
+				65912B120586921000123A69,
 			);
 			isa = PBXHeadersBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -786,6 +788,7 @@
 				654E7EE30569FD4600358BD2,
 				84B2B1FA056BEF3A00D2B771,
 				84B2B250056BF15F00D2B771,
+				65912B100586921000123A69,
 			);
 			isa = PBXSourcesBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -1083,6 +1086,48 @@
 			settings = {
 			};
 		};
+		65912B0D0586921000123A69 = {
+			expectedFileType = sourcecode.cpp.cpp;
+			fileEncoding = 30;
+			isa = PBXFileReference;
+			path = xmlserializer.cpp;
+			refType = 4;
+			sourceTree = "<group>";
+		};
+		65912B0E0586921000123A69 = {
+			expectedFileType = sourcecode.c.h;
+			fileEncoding = 30;
+			isa = PBXFileReference;
+			path = xmlserializer.h;
+			refType = 4;
+			sourceTree = "<group>";
+		};
+		65912B0F0586921000123A69 = {
+			expectedFileType = sourcecode.c.h;
+			fileEncoding = 30;
+			isa = PBXFileReference;
+			path = xmlserializer.lut.h;
+			refType = 4;
+			sourceTree = "<group>";
+		};
+		65912B100586921000123A69 = {
+			fileRef = 65912B0D0586921000123A69;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		65912B110586921000123A69 = {
+			fileRef = 65912B0E0586921000123A69;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
+		65912B120586921000123A69 = {
+			fileRef = 65912B0F0586921000123A69;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 		65A640F00533BB1F0085E777 = {
 			expectedFileType = sourcecode.c.h;
 			fileEncoding = 30;
@@ -4202,6 +4247,9 @@
 				654E7EE00569FD4600358BD2,
 				654E7EE10569FD4600358BD2,
 				654E7EE20569FD4600358BD2,
+				65912B0D0586921000123A69,
+				65912B0E0586921000123A69,
+				65912B0F0586921000123A69,
 			);
 			isa = PBXGroup;
 			path = ecma;
diff --git a/WebCore/khtml/dom/dom_doc.h b/WebCore/khtml/dom/dom_doc.h
index e1dbc22..b8b333e 100644
--- a/WebCore/khtml/dom/dom_doc.h
+++ b/WebCore/khtml/dom/dom_doc.h
@@ -790,9 +790,10 @@ public:
     DOMString completeURL(const DOMString& url);
 
     DOMString toString() const;
-protected:
+
     Document( DocumentImpl *i);
 
+protected:
     friend class Node;
 };
 
diff --git a/WebCore/khtml/ecma/xmlserializer.cpp b/WebCore/khtml/ecma/xmlserializer.cpp
new file mode 100644
index 0000000..e096f91
--- /dev/null
+++ b/WebCore/khtml/ecma/xmlserializer.cpp
@@ -0,0 +1,115 @@
+// -*- c-basic-offset: 2 -*-
+/*
+ *  This file is part of the KDE libraries
+ *  Copyright (C) 2003 Apple Computer, Inc.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "xmlserializer.h"
+#include "xmlserializer.lut.h"
+
+#include "dom/dom_exception.h"
+#include "dom/dom_doc.h"
+#include "xml/dom_docimpl.h"
+
+#include <kdebug.h>
+
+using namespace KJS;
+
+////////////////////// XMLSerializer Object ////////////////////////
+
+/* Source for XMLSerializerProtoTable.
+ at begin XMLSerializerProtoTable 1
+  serializeToString XMLSerializer::SerializeToString DontDelete|Function 1
+ at end
+*/
+DEFINE_PROTOTYPE("XMLSerializer",XMLSerializerProto)
+IMPLEMENT_PROTOFUNC(XMLSerializerProtoFunc)
+IMPLEMENT_PROTOTYPE(XMLSerializerProto,XMLSerializerProtoFunc)
+
+namespace KJS {
+
+XMLSerializerConstructorImp::XMLSerializerConstructorImp(ExecState *)
+    : ObjectImp()
+{
+}
+
+bool XMLSerializerConstructorImp::implementsConstruct() const
+{
+  return true;
+}
+
+Object XMLSerializerConstructorImp::construct(ExecState *exec, const List &)
+{
+  return Object(new XMLSerializer(exec));
+}
+
+const ClassInfo XMLSerializer::info = { "XMLSerializer", 0, &XMLSerializerTable, 0 };
+
+/* Source for XMLSerializerTable.
+ at begin XMLSerializerTable 0
+ at end
+*/
+
+XMLSerializer::XMLSerializer(ExecState *exec)
+  : DOMObject(XMLSerializerProto::self(exec))
+{
+}
+
+Value XMLSerializerProtoFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
+{
+  if (!thisObj.inherits(&XMLSerializer::info)) {
+    Object err = Error::create(exec,TypeError);
+    exec->setException(err);
+    return err;
+  }
+
+  switch (id) {
+  case XMLSerializer::SerializeToString:
+    {
+      if (args.size() != 1) {
+	return Undefined();
+      }
+
+      if (!args[0].toObject(exec).inherits(&DOMDocument::info)) {
+	return Undefined();
+      }
+
+      DOM::Node docNode = static_cast<KJS::DOMDocument *>(args[0].toObject(exec).imp())->toNode();
+      DOM::DocumentImpl *doc = static_cast<DOM::DocumentImpl *>(docNode.handle());
+
+      if (!doc) {
+	return Undefined();
+      }
+	  
+      QString body;
+
+      try {
+	  body = doc->toString().string();
+      } catch(DOM::DOMException& e) {
+	  Object err = Error::create(exec, GeneralError, "Exception serializing document");
+	  exec->setException(err);
+	  return err;
+      }
+    
+      return getStringOrNull(body);
+    }
+  }
+
+  return Undefined();
+}
+
+}; // end namespace
diff --git a/WebCore/khtml/ecma/kjs_navigator.h b/WebCore/khtml/ecma/xmlserializer.h
similarity index 59%
copy from WebCore/khtml/ecma/kjs_navigator.h
copy to WebCore/khtml/ecma/xmlserializer.h
index bbb4940..5217251 100644
--- a/WebCore/khtml/ecma/kjs_navigator.h
+++ b/WebCore/khtml/ecma/xmlserializer.h
@@ -1,7 +1,7 @@
 // -*- c-basic-offset: 2 -*-
 /*
  *  This file is part of the KDE libraries
- *  Copyright (C) 2000 Harri Porten (porten at kde.org)
+ *  Copyright (C) 2003 Apple Computer, Inc.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -18,28 +18,37 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#ifndef _KJS_NAVIGATOR_H_
-#define _KJS_NAVIGATOR_H_
+#ifndef _XMLSERIALIZER_H_
+#define _XMLSERIALIZER_H_
 
-#include <kjs/object.h>
-
-class KHTMLPart;
+#include "ecma/kjs_binding.h"
+#include "ecma/kjs_dom.h"
+#include "misc/decoder.h"
+#include "kio/jobclasses.h"
 
 namespace KJS {
 
-  class Navigator : public ObjectImp {
+  class JSEventListener;
+
+  class XMLSerializerConstructorImp : public ObjectImp {
   public:
-    Navigator(ExecState *exec, KHTMLPart *p);
-    virtual Value get(ExecState *exec, const Identifier &propertyName) const;
-    Value getValueProperty(ExecState *exec, int token) const;
+    XMLSerializerConstructorImp(ExecState *);
+    virtual bool implementsConstruct() const;
+    virtual Object construct(ExecState *exec, const List &args);
+  };
+
+  class XMLSerializer : public DOMObject {
+  public:
+    XMLSerializer(ExecState *);
+    virtual bool toBoolean(ExecState *) const { return true; }
     virtual const ClassInfo* classInfo() const { return &info; }
     static const ClassInfo info;
-    enum { AppCodeName, AppName, AppVersion, Language, UserAgent, Platform,
-           _Plugins, _MimeTypes, Product, ProductSub, Vendor, CookieEnabled, JavaEnabled };
-    KHTMLPart *part() const { return m_part; }
+    enum { SerializeToString };
+
   private:
-    KHTMLPart *m_part;
+    friend class XMLSerializerProtoFunc;
   };
+
 }; // namespace
 
 #endif
diff --git a/WebCore/khtml/ecma/xmlserializer.lut.h b/WebCore/khtml/ecma/xmlserializer.lut.h
new file mode 100644
index 0000000..c80b36e
--- /dev/null
+++ b/WebCore/khtml/ecma/xmlserializer.lut.h
@@ -0,0 +1,20 @@
+/* Automatically generated from xmlserializer.cpp using ../../../JavaScriptCore/kjs/create_hash_table. DO NOT EDIT ! */
+
+namespace KJS {
+
+const struct HashEntry XMLSerializerProtoTableEntries[] = {
+   { "serializeToString", XMLSerializer::SerializeToString, DontDelete|Function, 1, 0 }
+};
+
+const struct HashTable XMLSerializerProtoTable = { 2, 1, XMLSerializerProtoTableEntries, 1 };
+
+} // namespace
+
+namespace KJS {
+
+const struct HashEntry XMLSerializerTableEntries[] = {
+};
+
+const struct HashTable XMLSerializerTable = { 2, 0, XMLSerializerTableEntries, 0 };
+
+} // namespace
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index 9c6a65e..757d680 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -2594,7 +2594,7 @@ DOMString DocumentImpl::toString() const
     DOMString result;
 
     for (NodeImpl *child = firstChild(); child != NULL; child = child->nextSibling()) {
-	child = child->nextSibling();
+	result += child->toString();
     }
 
     return result;
@@ -2645,7 +2645,7 @@ DOMString DocumentFragmentImpl::toString() const
     DOMString result;
 
     for (NodeImpl *child = firstChild(); child != NULL; child = child->nextSibling()) {
-	child = child->nextSibling();
+	result += child->toString();
     }
 
     return result;
diff --git a/WebCore/khtml/xml/dom_elementimpl.cpp b/WebCore/khtml/xml/dom_elementimpl.cpp
index 2118834..33c8cd5 100644
--- a/WebCore/khtml/xml/dom_elementimpl.cpp
+++ b/WebCore/khtml/xml/dom_elementimpl.cpp
@@ -168,7 +168,7 @@ DOMString AttrImpl::toString() const
 	result += "=\"";
 
 	for (NodeImpl *child = firstChild(); child != NULL; child = child->nextSibling()) {
-	    child = child->nextSibling();
+	    result += child->toString();
 	}
 	
 	result += "\"";
@@ -557,7 +557,7 @@ DOMString ElementImpl::toString() const
 	result += ">";
 
 	for (NodeImpl *child = firstChild(); child != NULL; child = child->nextSibling()) {
-	    child = child->nextSibling();
+	    result += child->toString();
 	}
 
 	result += "</";

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list