2006-08-14 Anders Carlsson <acarlsson@apple.com>
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Aug 2006 00:59:42 +0000 (00:59 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Aug 2006 00:59:42 +0000 (00:59 +0000)
        Reviewed by Maciej.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=10393
        Autogenerate NodeIterator and TreeWalker.

        * DerivedSources.make:
        * WebCore.xcodeproj/project.pbxproj:
        Add new files.

        * bindings/js/JSNodeIteratorCustom.cpp: Added.
        (WebCore::JSNodeIterator::mark):
        * bindings/js/JSTreeWalkerCustom.cpp: Added.
        (WebCore::JSTreeWalker::mark):

        * bindings/js/kjs_traversal.cpp:
        * bindings/js/kjs_traversal.h:
        Remove implementations of DOMNodeIterator and DOMTreeWalker.

        * bindings/scripts/CodeGeneratorJS.pm:
        Add "CustomMarkFunction" attribute for classes where mark() needs to be overridden.

        * bindings/objc/DOM.mm:
        (-[DOMNodeIterator detach]):
        * dom/NodeIterator.cpp:
        (WebCore::NodeIterator::detach):
        * dom/NodeIterator.h:
        Get rid of exception in detach, it isn't used at all and this function can't throw an exception according to the spec.
        * dom/NodeIterator.idl: Added.
        * dom/TreeWalker.idl: Added.

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

13 files changed:
WebCore/ChangeLog
WebCore/DerivedSources.make
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/JSNodeIteratorCustom.cpp [new file with mode: 0644]
WebCore/bindings/js/JSTreeWalkerCustom.cpp [new file with mode: 0644]
WebCore/bindings/js/kjs_traversal.cpp
WebCore/bindings/js/kjs_traversal.h
WebCore/bindings/objc/DOM.mm
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/dom/NodeIterator.cpp
WebCore/dom/NodeIterator.h
WebCore/dom/NodeIterator.idl [new file with mode: 0644]
WebCore/dom/TreeWalker.idl [new file with mode: 0644]

index dee1c0c9d4ab0d1c18e91ddd18698692055dcb36..dbf3f0070daab5e9525962b4cc0d4612a05e02ae 100644 (file)
@@ -1,3 +1,35 @@
+2006-08-14  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Maciej.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=10393
+        Autogenerate NodeIterator and TreeWalker.
+        
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        Add new files.
+        
+        * bindings/js/JSNodeIteratorCustom.cpp: Added.
+        (WebCore::JSNodeIterator::mark):
+        * bindings/js/JSTreeWalkerCustom.cpp: Added.
+        (WebCore::JSTreeWalker::mark):
+        
+        * bindings/js/kjs_traversal.cpp:
+        * bindings/js/kjs_traversal.h:
+        Remove implementations of DOMNodeIterator and DOMTreeWalker.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        Add "CustomMarkFunction" attribute for classes where mark() needs to be overridden.
+        
+        * bindings/objc/DOM.mm:
+        (-[DOMNodeIterator detach]):
+        * dom/NodeIterator.cpp:
+        (WebCore::NodeIterator::detach):
+        * dom/NodeIterator.h:
+        Get rid of exception in detach, it isn't used at all and this function can't throw an exception according to the spec.
+        * dom/NodeIterator.idl: Added.
+        * dom/TreeWalker.idl: Added.
+
 2006-08-14  Brady Eidson  <beidson@apple.com>
 
         Reviewed by John
         (-[WebCoreAXObject rendererForView:]):
         Clean up some old naming.
 
+>>>>>>> .r15865
 2006-08-11  Anders Carlsson  <acarlsson@apple.com>
 
         Reviewed by Darin.
index 06a94f36ac445458ea89980075c8e98ff73f0af2..31a738da1c393f6cb3591ca4806662f81e2c226a 100644 (file)
@@ -118,6 +118,7 @@ all : \
     JSMutationEvent.h \
     JSNode.h \
     JSNodeFilter.h \
+       JSNodeIterator.h \
     JSNotation.h \
        JSOverflowEvent.h \
     JSProcessingInstruction.h \
@@ -134,6 +135,7 @@ all : \
     JSSVGSVGElement.h \
     JSSVGTransform.h \
     JSText.h \
+       JSTreeWalker.h \
     JSUIEvent.h \
     JSXPathEvaluator.h \
     JSXPathExpression.h \
index 1a15b04939616a41a88a5657a75b1e98481e9fb7..695d09533693153cb0557861f6f0c39a8b05eb11 100644 (file)
                1A4A2DF20A1B852A00C807F8 /* JSHTMLAppletElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A4A2DEE0A1B852A00C807F8 /* JSHTMLAppletElement.h */; };
                1A6938010A11100A00C127FE /* TextDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A6937FF0A11100A00C127FE /* TextDocument.cpp */; };
                1A6938020A11100A00C127FE /* TextDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6938000A11100A00C127FE /* TextDocument.h */; };
+               1A750D5C0A90DEE1000FF215 /* JSTreeWalker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A750D5A0A90DEE1000FF215 /* JSTreeWalker.cpp */; };
+               1A750D5D0A90DEE1000FF215 /* JSTreeWalker.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A750D5B0A90DEE1000FF215 /* JSTreeWalker.h */; };
+               1A750D880A90E394000FF215 /* NodeIterator.idl in Resources */ = {isa = PBXBuildFile; fileRef = 1A750D870A90E394000FF215 /* NodeIterator.idl */; };
+               1A750D8D0A90E521000FF215 /* JSNodeIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A750D8B0A90E521000FF215 /* JSNodeIterator.cpp */; };
+               1A750D8E0A90E521000FF215 /* JSNodeIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A750D8C0A90E521000FF215 /* JSNodeIterator.h */; };
+               1A750DD40A90E729000FF215 /* JSNodeIteratorCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A750DD30A90E729000FF215 /* JSNodeIteratorCustom.cpp */; };
+               1A750E340A90F89F000FF215 /* JSTreeWalkerCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A750E330A90F89F000FF215 /* JSTreeWalkerCustom.cpp */; };
                1A7629D50A07425100989F5B /* XPathGrammar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7629D30A07425100989F5B /* XPathGrammar.cpp */; };
                1A7629D60A07425100989F5B /* XPathGrammar.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A7629D40A07425100989F5B /* XPathGrammar.h */; };
                1A762C730A074F2600989F5B /* JSXPathEvaluator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A762C6B0A074F2600989F5B /* JSXPathEvaluator.cpp */; };
                1A4A2DEE0A1B852A00C807F8 /* JSHTMLAppletElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLAppletElement.h; sourceTree = "<group>"; };
                1A6937FF0A11100A00C127FE /* TextDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TextDocument.cpp; sourceTree = "<group>"; };
                1A6938000A11100A00C127FE /* TextDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextDocument.h; sourceTree = "<group>"; };
+               1A750D3C0A90DE35000FF215 /* TreeWalker.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TreeWalker.idl; sourceTree = "<group>"; };
+               1A750D5A0A90DEE1000FF215 /* JSTreeWalker.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSTreeWalker.cpp; sourceTree = "<group>"; };
+               1A750D5B0A90DEE1000FF215 /* JSTreeWalker.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSTreeWalker.h; sourceTree = "<group>"; };
+               1A750D870A90E394000FF215 /* NodeIterator.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NodeIterator.idl; sourceTree = "<group>"; };
+               1A750D8B0A90E521000FF215 /* JSNodeIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeIterator.cpp; sourceTree = "<group>"; };
+               1A750D8C0A90E521000FF215 /* JSNodeIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSNodeIterator.h; sourceTree = "<group>"; };
+               1A750DD30A90E729000FF215 /* JSNodeIteratorCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeIteratorCustom.cpp; sourceTree = "<group>"; };
+               1A750E330A90F89F000FF215 /* JSTreeWalkerCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSTreeWalkerCustom.cpp; sourceTree = "<group>"; };
                1A7629D30A07425100989F5B /* XPathGrammar.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = XPathGrammar.cpp; sourceTree = "<group>"; };
                1A7629D40A07425100989F5B /* XPathGrammar.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = XPathGrammar.h; sourceTree = "<group>"; };
                1A762C6B0A074F2600989F5B /* JSXPathEvaluator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSXPathEvaluator.cpp; sourceTree = "<group>"; };
                                14DC0D3609FED073007B0235 /* JSNode.h */,
                                14115B7009F84CD600CA4FC1 /* JSNodeFilter.cpp */,
                                14115B7109F84CD600CA4FC1 /* JSNodeFilter.h */,
+                               1A750D8B0A90E521000FF215 /* JSNodeIterator.cpp */,
+                               1A750D8C0A90E521000FF215 /* JSNodeIterator.h */,
                                65DF31E909D1CC60000BE325 /* JSNotation.cpp */,
                                65DF31EA09D1CC60000BE325 /* JSNotation.h */,
                                1A0D573E0A5C7867007EDD4C /* JSOverflowEvent.cpp */,
                                A833C0F60A2C513300D57664 /* JSSVGTransform.h */,
                                65DF31EF09D1CC60000BE325 /* JSText.cpp */,
                                65DF31F009D1CC60000BE325 /* JSText.h */,
+                               1A750D5A0A90DEE1000FF215 /* JSTreeWalker.cpp */,
+                               1A750D5B0A90DEE1000FF215 /* JSTreeWalker.h */,
                                A86629CA09DA2B47009633A5 /* JSUIEvent.cpp */,
                                A86629C909DA2B47009633A5 /* JSUIEvent.h */,
                                65DF31F109D1CC60000BE325 /* JSWheelEvent.cpp */,
                                A826E8AD0A1A8F2300CD1BB6 /* JSHTMLOptionElementConstructor.cpp */,
                                A826E8AC0A1A8F2300CD1BB6 /* JSHTMLOptionElementConstructor.h */,
                                448AD27A0A4813790023D179 /* JSHTMLOptionsCollectionCustom.cpp */,
+                               1A750DD30A90E729000FF215 /* JSNodeIteratorCustom.cpp */,
+                               1A750E330A90F89F000FF215 /* JSTreeWalkerCustom.cpp */,
                                93B70D4109EB0C7C009D8468 /* JSXMLHttpRequest.cpp */,
                                93B70D4209EB0C7C009D8468 /* JSXMLHttpRequest.h */,
                                93B70D4509EB0C7C009D8468 /* JSXSLTProcessor.cpp */,
                                854FE7290A2297BE0058D7AD /* NodeFilterCondition.h */,
                                854FE72A0A2297BE0058D7AD /* NodeIterator.cpp */,
                                854FE72B0A2297BE0058D7AD /* NodeIterator.h */,
+                               1A750D870A90E394000FF215 /* NodeIterator.idl */,
                                A81872160977D3C0005826D9 /* NodeList.cpp */,
                                A81872100977D3C0005826D9 /* NodeList.h */,
                                A8EA7EB70A1945D000A8EF5F /* Notation.cpp */,
                                854FE72D0A2297BE0058D7AD /* Traversal.h */,
                                854FE72E0A2297BE0058D7AD /* TreeWalker.cpp */,
                                854FE72F0A2297BE0058D7AD /* TreeWalker.h */,
+                               1A750D3C0A90DE35000FF215 /* TreeWalker.idl */,
                                85031B370A44EFC700F992E0 /* UIEvent.cpp */,
                                85031B380A44EFC700F992E0 /* UIEvent.h */,
                                85031B390A44EFC700F992E0 /* UIEventWithKeyState.h */,
                                1ACE53E80A8D18E70022947D /* DOMParser.h in Headers */,
                                1ACE53EB0A8D18E70022947D /* XMLSerializer.h in Headers */,
                                1ACE53F70A8D19470022947D /* JSXMLSerializer.h in Headers */,
+                               1A750D5D0A90DEE1000FF215 /* JSTreeWalker.h in Headers */,
+                               1A750D8E0A90E521000FF215 /* JSNodeIterator.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                1CD4418E0A4CE76F00A007AB /* northEastSouthWestResizeCursor.tiff in Resources */,
                                1CD4418F0A4CE76F00A007AB /* northSouthResizeCursor.tiff in Resources */,
                                1CD441900A4CE76F00A007AB /* northWestSouthEastResizeCursor.tiff in Resources */,
+                               1A750D880A90E394000FF215 /* NodeIterator.idl in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                1ACE53E70A8D18E70022947D /* DOMParser.cpp in Sources */,
                                1ACE53EA0A8D18E70022947D /* XMLSerializer.cpp in Sources */,
                                1ACE53F60A8D19470022947D /* JSXMLSerializer.cpp in Sources */,
+                               1A750D5C0A90DEE1000FF215 /* JSTreeWalker.cpp in Sources */,
+                               1A750D8D0A90E521000FF215 /* JSNodeIterator.cpp in Sources */,
+                               1A750DD40A90E729000FF215 /* JSNodeIteratorCustom.cpp in Sources */,
+                               1A750E340A90F89F000FF215 /* JSTreeWalkerCustom.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
diff --git a/WebCore/bindings/js/JSNodeIteratorCustom.cpp b/WebCore/bindings/js/JSNodeIteratorCustom.cpp
new file mode 100644 (file)
index 0000000..89e2f6c
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "config.h"
+#include "JSNodeIterator.h"
+
+#include "NodeFilter.h"
+#include "NodeIterator.h"
+
+namespace WebCore {
+
+void JSNodeIterator::mark()
+{
+    m_impl->filter()->mark();
+    
+    DOMObject::mark();
+}
+
+}
diff --git a/WebCore/bindings/js/JSTreeWalkerCustom.cpp b/WebCore/bindings/js/JSTreeWalkerCustom.cpp
new file mode 100644 (file)
index 0000000..429cf13
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#include "config.h"
+#include "JSTreeWalker.h"
+
+#include "NodeFilter.h"
+#include "TreeWalker.h"
+
+namespace WebCore {
+    
+void JSTreeWalker::mark()
+{
+    m_impl->filter()->mark();
+    
+    DOMObject::mark();
+}
+    
+}
index cd57df3b999d812893154c0a746c70d0c3e68d9c..2443022980af278bf7d94a432bf8d186768c07fc 100644 (file)
@@ -31,95 +31,6 @@ using namespace WebCore;
 
 namespace KJS {
 
-// -------------------------------------------------------------------------
-
-const ClassInfo DOMNodeIterator::info = { "NodeIterator", 0, &DOMNodeIteratorTable, 0 };
-/*
-@begin DOMNodeIteratorTable 5
-  root                          DOMNodeIterator::Root                   DontDelete|ReadOnly
-  whatToShow                    DOMNodeIterator::WhatToShow             DontDelete|ReadOnly
-  filter                        DOMNodeIterator::Filter                 DontDelete|ReadOnly
-  expandEntityReferences        DOMNodeIterator::ExpandEntityReferences DontDelete|ReadOnly
-  referenceNode DOMNodeIterator::ReferenceNode  DontDelete|ReadOnly
-  pointerBeforeReferenceNode DOMNodeIterator::PointerBeforeReferenceNode        DontDelete|ReadOnly
-@end
-@begin DOMNodeIteratorProtoTable 3
-  nextNode      DOMNodeIterator::NextNode       DontDelete|Function 0
-  previousNode  DOMNodeIterator::PreviousNode   DontDelete|Function 0
-  detach        DOMNodeIterator::Detach         DontDelete|Function 0
-@end
-*/
-KJS_DEFINE_PROTOTYPE(DOMNodeIteratorProto)
-KJS_IMPLEMENT_PROTOFUNC(DOMNodeIteratorProtoFunc)
-KJS_IMPLEMENT_PROTOTYPE("DOMNodeIterator",DOMNodeIteratorProto,DOMNodeIteratorProtoFunc)
-
-DOMNodeIterator::DOMNodeIterator(ExecState *exec, NodeIterator *ni)
-  : m_impl(ni)
-{
-  setPrototype(DOMNodeIteratorProto::self(exec));
-}
-
-DOMNodeIterator::~DOMNodeIterator()
-{
-  ScriptInterpreter::forgetDOMObject(m_impl.get());
-}
-
-void DOMNodeIterator::mark()
-{
-    m_impl->filter()->mark();
-    DOMObject::mark();
-}
-
-bool DOMNodeIterator::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
-{
-  return getStaticValueSlot<DOMNodeIterator, DOMObject>(exec, &DOMNodeIteratorTable, this, propertyName, slot);
-}
-
-JSValue *DOMNodeIterator::getValueProperty(ExecState *exec, int token) const
-{
-  NodeIterator &ni = *m_impl;
-  switch (token) {
-  case Root:
-    return toJS(exec,ni.root());
-  case WhatToShow:
-    return jsNumber(ni.whatToShow());
-  case Filter:
-    return toJS(exec,ni.filter());
-  case ExpandEntityReferences:
-    return jsBoolean(ni.expandEntityReferences());
-  case ReferenceNode:
-    return toJS(exec,ni.referenceNode());
-  case PointerBeforeReferenceNode:
-    return jsBoolean(ni.pointerBeforeReferenceNode());
- default:
-   return 0;
-  }
-}
-
-JSValue *DOMNodeIteratorProtoFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const List &)
-{
-  if (!thisObj->inherits(&KJS::DOMNodeIterator::info))
-    return throwError(exec, TypeError);
-  DOMExceptionTranslator exception(exec);
-  NodeIterator &nodeIterator = *static_cast<DOMNodeIterator *>(thisObj)->impl();
-  switch (id) {
-  case DOMNodeIterator::PreviousNode:
-    return toJS(exec,nodeIterator.previousNode(exception));
-  case DOMNodeIterator::NextNode:
-    return toJS(exec,nodeIterator.nextNode(exception));
-  case DOMNodeIterator::Detach:
-    nodeIterator.detach(exception);
-    return jsUndefined();
-  }
-  return jsUndefined();
-}
-
-JSValue *toJS(ExecState *exec, NodeIterator *ni)
-{
-  return cacheDOMObject<NodeIterator, DOMNodeIterator>(exec, ni);
-}
-
-
 // -------------------------------------------------------------------------
 
 const ClassInfo DOMNodeFilter::info = { "NodeFilter", 0, 0, 0 };
@@ -185,112 +96,6 @@ PassRefPtr<NodeFilter> toNodeFilter(JSValue* val)
 
 // -------------------------------------------------------------------------
 
-const ClassInfo DOMTreeWalker::info = { "TreeWalker", 0, &DOMTreeWalkerTable, 0 };
-/*
-@begin DOMTreeWalkerTable 5
-  root                  DOMTreeWalker::Root             DontDelete|ReadOnly
-  whatToShow            DOMTreeWalker::WhatToShow       DontDelete|ReadOnly
-  filter                DOMTreeWalker::Filter           DontDelete|ReadOnly
-  expandEntityReferences DOMTreeWalker::ExpandEntityReferences  DontDelete|ReadOnly
-  currentNode           DOMTreeWalker::CurrentNode      DontDelete
-@end
-@begin DOMTreeWalkerProtoTable 7
-  parentNode    DOMTreeWalker::ParentNode       DontDelete|Function 0
-  firstChild    DOMTreeWalker::FirstChild       DontDelete|Function 0
-  lastChild     DOMTreeWalker::LastChild        DontDelete|Function 0
-  previousSibling DOMTreeWalker::PreviousSibling        DontDelete|Function 0
-  nextSibling   DOMTreeWalker::NextSibling      DontDelete|Function 0
-  previousNode  DOMTreeWalker::PreviousNode     DontDelete|Function 0
-  nextNode      DOMTreeWalker::NextNode         DontDelete|Function 0
-@end
-*/
-KJS_DEFINE_PROTOTYPE(DOMTreeWalkerProto)
-KJS_IMPLEMENT_PROTOFUNC(DOMTreeWalkerProtoFunc)
-KJS_IMPLEMENT_PROTOTYPE("DOMTreeWalker",DOMTreeWalkerProto,DOMTreeWalkerProtoFunc)
-
-DOMTreeWalker::DOMTreeWalker(ExecState *exec, TreeWalker *tw)
-  : m_impl(tw)
-{
-  setPrototype(DOMTreeWalkerProto::self(exec));
-}
-
-DOMTreeWalker::~DOMTreeWalker()
-{
-  ScriptInterpreter::forgetDOMObject(m_impl.get());
-}
-
-void DOMTreeWalker::mark()
-{
-    m_impl->filter()->mark();
-    DOMObject::mark();
-}
-
-bool DOMTreeWalker::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
-{
-  return getStaticValueSlot<DOMTreeWalker, DOMObject>(exec, &DOMTreeWalkerTable, this, propertyName, slot);
-}
-
-JSValue *DOMTreeWalker::getValueProperty(ExecState *exec, int token) const
-{
-  TreeWalker &tw = *m_impl;
-  switch (token) {
-  case Root:
-    return toJS(exec,tw.root());
-  case WhatToShow:
-    return jsNumber(tw.whatToShow());
-  case Filter:
-    return toJS(exec,tw.filter());
-  case ExpandEntityReferences:
-    return jsBoolean(tw.expandEntityReferences());
-  case CurrentNode:
-    return toJS(exec,tw.currentNode());
-  default:
-    return 0;
-  }
-}
-
-void DOMTreeWalker::put(ExecState *exec, const Identifier &propertyName,
-                           JSValue *value, int attr)
-{
-  if (propertyName == "currentNode") {
-    DOMExceptionTranslator exception(exec);
-    m_impl->setCurrentNode(toNode(value), exception);
-  }
-  else
-    JSObject::put(exec, propertyName, value, attr);
-}
-
-JSValue *DOMTreeWalkerProtoFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const List &)
-{
-  if (!thisObj->inherits(&KJS::DOMTreeWalker::info))
-    return throwError(exec, TypeError);
-  TreeWalker &treeWalker = *static_cast<DOMTreeWalker *>(thisObj)->impl();
-  switch (id) {
-    case DOMTreeWalker::ParentNode:
-      return toJS(exec,treeWalker.parentNode());
-    case DOMTreeWalker::FirstChild:
-      return toJS(exec,treeWalker.firstChild());
-    case DOMTreeWalker::LastChild:
-      return toJS(exec,treeWalker.lastChild());
-    case DOMTreeWalker::PreviousSibling:
-      return toJS(exec,treeWalker.previousSibling());
-    case DOMTreeWalker::NextSibling:
-      return toJS(exec,treeWalker.nextSibling());
-    case DOMTreeWalker::PreviousNode:
-      return toJS(exec,treeWalker.previousNode());
-    case DOMTreeWalker::NextNode:
-      return toJS(exec,treeWalker.nextNode());
-  }
-  return jsUndefined();
-}
-
-JSValue *toJS(ExecState *exec, TreeWalker *tw)
-{
-  return cacheDOMObject<TreeWalker, DOMTreeWalker>(exec, tw);
-}
-
-// -------------------------------------------------------------------------
-
 JSNodeFilterCondition::JSNodeFilterCondition(JSObject * _filter)
     : filter( _filter )
 {
index ce76d0d941dce721bb2ed70a88e3a79563e5408e..723f1e1b3d0f7de527596f23a971135e01a0258c 100644 (file)
 
 #include "NodeFilter.h"
 #include "NodeFilterCondition.h"
-#include "NodeIterator.h"
-#include "TreeWalker.h"
 #include "kjs_dom.h"
 
 namespace WebCore {
     class NodeFilter;
-    class NodeIterator;
-    class TreeWalker;
 }
 
 namespace KJS {
 
-  class DOMNodeIterator : public DOMObject {
-  public:
-    DOMNodeIterator(ExecState*, WebCore::NodeIterator*);
-    ~DOMNodeIterator();
-    virtual void mark();
-    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
-    JSValue *getValueProperty(ExecState*, int token) const;
-    // no put - all read-only
-    virtual const ClassInfo* classInfo() const { return &info; }
-    static const ClassInfo info;
-    enum { Filter, Root, WhatToShow, ExpandEntityReferences, ReferenceNode, PointerBeforeReferenceNode,
-           NextNode, PreviousNode, Detach };
-    WebCore::NodeIterator* impl() const { return m_impl.get(); }
-  private:
-    RefPtr<WebCore::NodeIterator> m_impl;
-  };
-
   class DOMNodeFilter : public DOMObject {
   public:
     DOMNodeFilter(ExecState*, WebCore::NodeFilter*);
@@ -66,27 +45,7 @@ namespace KJS {
     RefPtr<WebCore::NodeFilter> m_impl;
   };
 
-  class DOMTreeWalker : public DOMObject {
-  public:
-    DOMTreeWalker(ExecState*, WebCore::TreeWalker*);
-    ~DOMTreeWalker();
-    virtual void mark();
-    virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
-    JSValue* getValueProperty(ExecState*, int token) const;
-    virtual void put(ExecState*, const Identifier& propertyName, JSValue*, int attr = None);
-    virtual const ClassInfo* classInfo() const { return &info; }
-    static const ClassInfo info;
-    enum { Root, WhatToShow, Filter, ExpandEntityReferences, CurrentNode,
-           ParentNode, FirstChild, LastChild, PreviousSibling, NextSibling,
-           PreviousNode, NextNode };
-    WebCore::TreeWalker* impl() const { return m_impl.get(); }
-  private:
-    RefPtr<WebCore::TreeWalker> m_impl;
-  };
-
-  JSValue* toJS(ExecState*, WebCore::NodeIterator*);
   JSValue* toJS(ExecState*, WebCore::NodeFilter*);
-  JSValue* toJS(ExecState*, WebCore::TreeWalker*);
 
   PassRefPtr<WebCore::NodeFilter> toNodeFilter(JSValue*); // returns 0 if value is not a DOMNodeFilter or JS function 
 
index 52c88e452ffee17fd4c832a46b7a4c0446d7c830..0286cbf2088bb1e9989af21ea12f36505968e312 100644 (file)
@@ -2124,9 +2124,7 @@ static Class elementClass(const AtomicString& tagName)
 
 - (void)detach
 {
-    ExceptionCode ec = 0;
-    [self _nodeIterator]->detach(ec);
-    raiseOnDOMError(ec);
+    [self _nodeIterator]->detach();
 }
 
 @end
index 07b40df2d9fb43aca9f912c4bc16e9d2751a05bc..8b57847bf2d0aee3f312242c75bd33e542483223 100644 (file)
@@ -259,7 +259,12 @@ sub GenerateHeader
     # Class info
     push(@headerContent, "    virtual const KJS::ClassInfo* classInfo() const { return &info; }\n");
     push(@headerContent, "    static const KJS::ClassInfo info;\n");
-    
+
+    # Custom mark function
+    if ($dataNode->extendedAttributes->{"CustomMarkFunction"}) {
+        push(@headerContent, "\n    virtual void mark();\n\n");
+    }
+
     # Constructor object getter
     if ($dataNode->extendedAttributes->{"GenerateConstructor"}) {
         push(@headerContent, "    static KJS::JSValue* getConstructor(KJS::ExecState*);\n")
@@ -1172,10 +1177,6 @@ sub NativeToJSValue
         $implIncludes{"kjs_dom.h"} = 1;
         $implIncludes{"HTMLCanvasElement.h"} = 1;
         return "toJS(exec, $value)";
-    } elsif ($type eq "NodeIterator" or
-             $type eq "TreeWalker") {
-        $implIncludes{"kjs_traversal.h"} = 1;
-        return "toJS(exec, $value)";
     } elsif ($type eq "DOMWindow") {
         $implIncludes{"kjs_window.h"} = 1;
         return "toJS(exec, $value)";
index 960f012698a8ee35637fafacb04d097d35d51234..331b45083704548f81402ccc9c5c63bb3cb21aa8 100644 (file)
@@ -100,7 +100,7 @@ Node* NodeIterator::previousNode(ExceptionCode&)
     return node;
 }
 
-void NodeIterator::detach(ExceptionCode&)
+void NodeIterator::detach()
 {
     if (!detached() && document())
         document()->detachNodeIterator(this);
index 09618da6d186bc7990447e97bf1975000130fc90..e663d7bc74e92f1d5319ef4299f131659d3fd9e5 100644 (file)
@@ -42,7 +42,7 @@ namespace WebCore {
 
         Node* nextNode(ExceptionCode&);
         Node* previousNode(ExceptionCode&);
-        void detach(ExceptionCode&);
+        void detach();
 
         Node* referenceNode() const { return m_referenceNode.get(); }
         bool pointerBeforeReferenceNode() const { return m_beforeReferenceNode; }
diff --git a/WebCore/dom/NodeIterator.idl b/WebCore/dom/NodeIterator.idl
new file mode 100644 (file)
index 0000000..a33270d
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+module traversal {
+
+    interface [CustomMarkFunction] NodeIterator {
+        readonly attribute Node root;
+        readonly attribute unsigned long whatToShow;
+        readonly attribute NodeFilter filter;
+        readonly attribute boolean expandEntityReferences;
+        readonly attribute Node referenceNode;
+        readonly attribute boolean pointerBeforeReferenceNode;
+        
+        Node nextNode() 
+            raises (DOMException);
+        Node previousNode()
+            raises (DOMException);
+        void detach();
+    };
+}
+
\ No newline at end of file
diff --git a/WebCore/dom/TreeWalker.idl b/WebCore/dom/TreeWalker.idl
new file mode 100644 (file)
index 0000000..d17ed1f
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2006 Apple Computer, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+module traversal {
+
+    interface [CustomMarkFunction] TreeWalker {
+        readonly attribute Node root;
+        readonly attribute unsigned long whatToShow;
+        readonly attribute NodeFilter filter;
+        readonly attribute boolean expandEntityReferences;        
+        attribute Node currentNode
+            setter raises (DOMException);
+
+        Node parentNode();
+        Node firstChild();
+        Node lastChild();
+        Node previousSibling();
+        Node nextSibling();
+        Node previousNode();
+        Node nextNode();
+    };
+}
+
\ No newline at end of file