LayoutTests:
authorweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jun 2007 00:54:18 +0000 (00:54 +0000)
committerweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Jun 2007 00:54:18 +0000 (00:54 +0000)
        Reviewed by Hyatt.

        Update results for http://bugs.webkit.org/show_bug.cgi?id=13947
        Finish autogenerating the JS DOM traversal code

        * fast/dom/Window/window-properties-expected.txt:

WebCore:

        Reviewed by Hyatt.

        Patch for http://bugs.webkit.org/show_bug.cgi?id=13947
        Finish autogenerating the JS DOM traversal code

        - Completely generate JSNodeFilter.
        - Move JSNodeFilterCondition into its own file

        * DerivedSources.make:
        * WebCore.pro:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSNodeFilterCondition.cpp: Copied from WebCore/bindings/js/kjs_traversal.cpp.
        (WebCore::JSNodeFilterCondition::JSNodeFilterCondition):
        (WebCore::JSNodeFilterCondition::mark):
        (WebCore::JSNodeFilterCondition::acceptNode):
        * bindings/js/JSNodeFilterCondition.h: Copied from WebCore/bindings/js/kjs_traversal.h.
        * bindings/js/JSNodeFilterCustom.cpp: Added.
        (WebCore::JSNodeFilter::mark):
        (WebCore::toNodeFilter):
        * bindings/js/kjs_dom.cpp:
        * bindings/js/kjs_traversal.cpp: Removed.
        * bindings/js/kjs_traversal.h: Removed.
        * bindings/js/kjs_window.cpp:
        * bindings/objc/DOM.mm:
        (-[DOMDocument createNodeIterator:whatToShow:filter:expandEntityReferences:]):
        (-[DOMDocument createTreeWalker:whatToShow:filter:expandEntityReferences:]):
        * bindings/scripts/CodeGeneratorJS.pm:
        * dom/Document.cpp:
        (WebCore::Document::createNodeIterator):
        (WebCore::Document::createTreeWalker):
        * dom/Document.h:
        * dom/NodeFilter.idl:

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

18 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Window/window-properties-expected.txt
WebCore/ChangeLog
WebCore/DerivedSources.make
WebCore/WebCore.pro
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/JSNodeFilterCondition.cpp [new file with mode: 0644]
WebCore/bindings/js/JSNodeFilterCondition.h [new file with mode: 0644]
WebCore/bindings/js/JSNodeFilterCustom.cpp [new file with mode: 0644]
WebCore/bindings/js/kjs_dom.cpp
WebCore/bindings/js/kjs_traversal.cpp [deleted file]
WebCore/bindings/js/kjs_traversal.h [deleted file]
WebCore/bindings/js/kjs_window.cpp
WebCore/bindings/objc/DOM.mm
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/dom/NodeFilter.idl

index c6e4c078637deecdbd3127f58c247be2c25f7621..480cca817dcf495bab10d44bce8c947294cc3cf2 100644 (file)
@@ -1,3 +1,12 @@
+2007-06-06  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Hyatt.
+
+        Update results for http://bugs.webkit.org/show_bug.cgi?id=13947
+        Finish autogenerating the JS DOM traversal code
+
+        * fast/dom/Window/window-properties-expected.txt:
+
 2007-06-05  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Geoff.
index 1d1f58a7eec7ad1147aa1673efda5d44abbf816e..0e841b420d739b369d93629914360d58b89a0e08 100644 (file)
@@ -752,6 +752,7 @@ window.NodeFilter.prototype.SHOW_ENTITY_REFERENCE [number]
 window.NodeFilter.prototype.SHOW_NOTATION [number]
 window.NodeFilter.prototype.SHOW_PROCESSING_INSTRUCTION [number]
 window.NodeFilter.prototype.SHOW_TEXT [number]
+window.NodeFilter.prototype.acceptNode [function]
 window.Notation [object NotationConstructor]
 window.Notation.prototype [printed above as window.Node.prototype]
 window.Option [object Object]
index 0dfa25bccd0dd5d3836fd08578c4d89f79c51486..7a07b5f3dece43861e7a94be940f7cc181d5d9ad 100644 (file)
@@ -1,3 +1,38 @@
+2007-06-06  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Hyatt.
+
+        Patch for http://bugs.webkit.org/show_bug.cgi?id=13947
+        Finish autogenerating the JS DOM traversal code
+
+        - Completely generate JSNodeFilter.
+        - Move JSNodeFilterCondition into its own file
+
+        * DerivedSources.make:
+        * WebCore.pro:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSNodeFilterCondition.cpp: Copied from WebCore/bindings/js/kjs_traversal.cpp.
+        (WebCore::JSNodeFilterCondition::JSNodeFilterCondition):
+        (WebCore::JSNodeFilterCondition::mark):
+        (WebCore::JSNodeFilterCondition::acceptNode):
+        * bindings/js/JSNodeFilterCondition.h: Copied from WebCore/bindings/js/kjs_traversal.h.
+        * bindings/js/JSNodeFilterCustom.cpp: Added.
+        (WebCore::JSNodeFilter::mark):
+        (WebCore::toNodeFilter):
+        * bindings/js/kjs_dom.cpp:
+        * bindings/js/kjs_traversal.cpp: Removed.
+        * bindings/js/kjs_traversal.h: Removed.
+        * bindings/js/kjs_window.cpp:
+        * bindings/objc/DOM.mm:
+        (-[DOMDocument createNodeIterator:whatToShow:filter:expandEntityReferences:]):
+        (-[DOMDocument createTreeWalker:whatToShow:filter:expandEntityReferences:]):
+        * bindings/scripts/CodeGeneratorJS.pm:
+        * dom/Document.cpp:
+        (WebCore::Document::createNodeIterator):
+        (WebCore::Document::createTreeWalker):
+        * dom/Document.h:
+        * dom/NodeFilter.idl:
+
 2007-06-06  Alp Toker  <alp.toker@collabora.co.uk>
 
         Reviewed by Eric Seidel.
index 340b1ebc30c2d6ddf47e4448643b1a4b48c217f0..69a48e38a17d08bf7f476998c9d97271aa4e33b5 100644 (file)
@@ -549,7 +549,6 @@ all : \
     kjs_events.lut.h \
     kjs_html.lut.h \
     kjs_navigator.lut.h \
-    kjs_traversal.lut.h \
     kjs_window.lut.h \
     ksvgcssproperties.h \
     ksvgcssvalues.h \
index 148ea4faae0ec14261292abd77eb56274506b2b6..afe5a259cb2da1a899d8dd0a6d426b3c33f9ecca 100644 (file)
@@ -143,7 +143,6 @@ LUT_FILES += \
     bindings/js/kjs_events.cpp \
     bindings/js/kjs_html.cpp \
     bindings/js/kjs_navigator.cpp \
-    bindings/js/kjs_traversal.cpp \
     bindings/js/kjs_window.cpp
 
 LUT_TABLE_FILES += \
@@ -282,6 +281,8 @@ SOURCES += \
     bindings/js/JSHTMLOptionElementConstructor.cpp \
     bindings/js/JSHTMLOptionsCollectionCustom.cpp \
     bindings/js/JSHTMLSelectElementCustom.cpp \
+    bindings/js/JSNodeFilterCondition.cpp \
+    bindings/js/JSNodeFilterCustom.cpp \
     bindings/js/JSNodeIteratorCustom.cpp \
     bindings/js/JSStyleSheetCustom.cpp \
     bindings/js/JSTreeWalkerCustom.cpp \
@@ -294,7 +295,6 @@ SOURCES += \
     bindings/js/kjs_html.cpp \
     bindings/js/kjs_navigator.cpp \
     bindings/js/kjs_proxy.cpp \
-    bindings/js/kjs_traversal.cpp \
     bindings/js/kjs_window.cpp \
     css/CSSBorderImageValue.cpp \
     css/CSSCharsetRule.cpp \
index 86f9f5b4e2c778d9479943228326ea3bf557bf89..465da4427a2185034affdabae928a44410d6f1f1 100644 (file)
                93B70D6E09EB0C7C009D8468 /* kjs_navigator.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D5209EB0C7C009D8468 /* kjs_navigator.h */; };
                93B70D6F09EB0C7C009D8468 /* kjs_proxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D5309EB0C7C009D8468 /* kjs_proxy.cpp */; };
                93B70D7009EB0C7C009D8468 /* kjs_proxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D5409EB0C7C009D8468 /* kjs_proxy.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               93B70D7109EB0C7C009D8468 /* kjs_traversal.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D5509EB0C7C009D8468 /* kjs_traversal.cpp */; };
-               93B70D7209EB0C7C009D8468 /* kjs_traversal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D5609EB0C7C009D8468 /* kjs_traversal.h */; };
                93B70D7509EB0C7C009D8468 /* kjs_window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D5909EB0C7C009D8468 /* kjs_window.cpp */; };
                93B70D7609EB0C7C009D8468 /* kjs_window.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D5A09EB0C7C009D8468 /* kjs_window.h */; };
                93B77A380ADD792500EA4B81 /* FrameLoaderTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B77A370ADD792500EA4B81 /* FrameLoaderTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCB16C2D0979C3BD00467741 /* loader.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C140979C3BD00467741 /* loader.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCB16C2E0979C3BD00467741 /* Request.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB16C150979C3BD00467741 /* Request.cpp */; };
                BCB16C2F0979C3BD00467741 /* Request.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB16C160979C3BD00467741 /* Request.h */; };
+               BCB773610C17853D00132BA4 /* JSNodeFilterCondition.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB7735E0C17853D00132BA4 /* JSNodeFilterCondition.cpp */; };
+               BCB773620C17853D00132BA4 /* JSNodeFilterCondition.h in Headers */ = {isa = PBXBuildFile; fileRef = BCB7735F0C17853D00132BA4 /* JSNodeFilterCondition.h */; };
+               BCB773630C17853D00132BA4 /* JSNodeFilterCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCB773600C17853D00132BA4 /* JSNodeFilterCustom.cpp */; };
                BCC088860A1BD78D006189A6 /* FontDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BCC088850A1BD78D006189A6 /* FontDataMac.mm */; };
                BCC0891A0A1C4652006189A6 /* FontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC089190A1C4652006189A6 /* FontData.cpp */; };
                BCC0892A0A1C4991006189A6 /* GlyphWidthMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC089290A1C4991006189A6 /* GlyphWidthMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93B70D5209EB0C7C009D8468 /* kjs_navigator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_navigator.h; sourceTree = "<group>"; };
                93B70D5309EB0C7C009D8468 /* kjs_proxy.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = kjs_proxy.cpp; sourceTree = "<group>"; };
                93B70D5409EB0C7C009D8468 /* kjs_proxy.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_proxy.h; sourceTree = "<group>"; };
-               93B70D5509EB0C7C009D8468 /* kjs_traversal.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = kjs_traversal.cpp; sourceTree = "<group>"; };
-               93B70D5609EB0C7C009D8468 /* kjs_traversal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_traversal.h; sourceTree = "<group>"; };
                93B70D5909EB0C7C009D8468 /* kjs_window.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = kjs_window.cpp; sourceTree = "<group>"; };
                93B70D5A09EB0C7C009D8468 /* kjs_window.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_window.h; sourceTree = "<group>"; };
                93B77A370ADD792500EA4B81 /* FrameLoaderTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameLoaderTypes.h; sourceTree = "<group>"; };
                BCB16C140979C3BD00467741 /* loader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = loader.h; sourceTree = "<group>"; };
                BCB16C150979C3BD00467741 /* Request.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Request.cpp; sourceTree = "<group>"; };
                BCB16C160979C3BD00467741 /* Request.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Request.h; sourceTree = "<group>"; };
+               BCB7735E0C17853D00132BA4 /* JSNodeFilterCondition.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeFilterCondition.cpp; sourceTree = "<group>"; };
+               BCB7735F0C17853D00132BA4 /* JSNodeFilterCondition.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSNodeFilterCondition.h; sourceTree = "<group>"; };
+               BCB773600C17853D00132BA4 /* JSNodeFilterCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeFilterCustom.cpp; sourceTree = "<group>"; };
                BCC088850A1BD78D006189A6 /* FontDataMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FontDataMac.mm; sourceTree = "<group>"; };
                BCC089190A1C4652006189A6 /* FontData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontData.cpp; sourceTree = "<group>"; };
                BCC089290A1C4991006189A6 /* GlyphWidthMap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GlyphWidthMap.h; sourceTree = "<group>"; };
                                93B70D5209EB0C7C009D8468 /* kjs_navigator.h */,
                                93B70D5309EB0C7C009D8468 /* kjs_proxy.cpp */,
                                93B70D5409EB0C7C009D8468 /* kjs_proxy.h */,
-                               93B70D5509EB0C7C009D8468 /* kjs_traversal.cpp */,
-                               93B70D5609EB0C7C009D8468 /* kjs_traversal.h */,
                                93B70D5909EB0C7C009D8468 /* kjs_window.cpp */,
                                93B70D5A09EB0C7C009D8468 /* kjs_window.h */,
                        );
                                448AD27A0A4813790023D179 /* JSHTMLOptionsCollectionCustom.cpp */,
                                BC17F9650B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp */,
                                AB4CB4EA0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h */,
+                               BCB7735E0C17853D00132BA4 /* JSNodeFilterCondition.cpp */,
+                               BCB7735F0C17853D00132BA4 /* JSNodeFilterCondition.h */,
+                               BCB773600C17853D00132BA4 /* JSNodeFilterCustom.cpp */,
                                1A750DD30A90E729000FF215 /* JSNodeIteratorCustom.cpp */,
                                BC98A27C0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp */,
                                B25DFAAE0B2E2929000E6510 /* JSSVGMatrixCustom.cpp */,
                                93B70D6C09EB0C7C009D8468 /* kjs_html.h in Headers */,
                                93B70D6E09EB0C7C009D8468 /* kjs_navigator.h in Headers */,
                                93B70D7009EB0C7C009D8468 /* kjs_proxy.h in Headers */,
-                               93B70D7209EB0C7C009D8468 /* kjs_traversal.h in Headers */,
                                93B70D7609EB0C7C009D8468 /* kjs_window.h in Headers */,
                                1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */,
                                1403BA0F09EB18F900797C7F /* JSDOMWindow.h in Headers */,
                                BC46C2030C0DDC8F0020CFC3 /* JSCSSPageRule.h in Headers */,
                                BC46C2070C0DDCA10020CFC3 /* JSCSSStyleRule.h in Headers */,
                                BCC5BE010C0E93110011C2DB /* JSCSSStyleSheet.h in Headers */,
+                               BCB773620C17853D00132BA4 /* JSNodeFilterCondition.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
                        projectRoot = "";
-                       shouldCheckCompatibility = 1;
                        targets = (
                                93F198A508245E59001E9ABC /* WebCore */,
                                DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
                                93B70D6B09EB0C7C009D8468 /* kjs_html.cpp in Sources */,
                                93B70D6D09EB0C7C009D8468 /* kjs_navigator.cpp in Sources */,
                                93B70D6F09EB0C7C009D8468 /* kjs_proxy.cpp in Sources */,
-                               93B70D7109EB0C7C009D8468 /* kjs_traversal.cpp in Sources */,
                                93B70D7509EB0C7C009D8468 /* kjs_window.cpp in Sources */,
                                1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */,
                                1403BA0C09EB18C700797C7F /* JSDOMWindow.cpp in Sources */,
                                BC46C2060C0DDCA10020CFC3 /* JSCSSStyleRule.cpp in Sources */,
                                BC20FB7F0C0E8E6C00D1447F /* JSCSSValueCustom.cpp in Sources */,
                                BCC5BE000C0E93110011C2DB /* JSCSSStyleSheet.cpp in Sources */,
+                               BCB773610C17853D00132BA4 /* JSNodeFilterCondition.cpp in Sources */,
+                               BCB773630C17853D00132BA4 /* JSNodeFilterCustom.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
diff --git a/WebCore/bindings/js/JSNodeFilterCondition.cpp b/WebCore/bindings/js/JSNodeFilterCondition.cpp
new file mode 100644 (file)
index 0000000..2ad3fd0
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ *  Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ *  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 "config.h"
+#include "JSNodeFilterCondition.h"
+
+#include "Document.h"
+#include "Frame.h"
+#include "JSNodeFilter.h"
+#include "NodeFilter.h"
+#include "kjs_proxy.h"
+
+namespace WebCore {
+
+JSNodeFilterCondition::JSNodeFilterCondition(KJS::JSObject* filter)
+    : m_filter(filter)
+{
+}
+
+void JSNodeFilterCondition::mark()
+{
+    m_filter->mark();
+}
+
+short JSNodeFilterCondition::acceptNode(Node* filterNode) const
+{
+    Node* node = filterNode;
+    Frame* frame = node->document()->frame();
+    KJSProxy* proxy = frame->scriptProxy();
+    if (proxy && m_filter->implementsCall()) {
+        KJS::JSLock lock;
+        KJS::ExecState* exec = proxy->interpreter()->globalExec();
+        KJS::List args;
+        args.append(KJS::toJS(exec, node));
+        KJS::JSObject* obj = m_filter;
+        KJS::JSValue* result = obj->call(exec, obj, args);
+        return result->toInt32(exec);
+    }
+
+    return NodeFilter::FILTER_REJECT;
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/js/JSNodeFilterCondition.h b/WebCore/bindings/js/JSNodeFilterCondition.h
new file mode 100644 (file)
index 0000000..80ceb29
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
+ *  Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ *  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
+ */
+
+#ifndef JSNodeFilterCondition_h
+#define JSNodeFilterCondition_h
+
+#include "NodeFilterCondition.h"
+#include "kjs_dom.h"
+
+namespace WebCore {
+
+    class Node;
+
+    class JSNodeFilterCondition : public NodeFilterCondition {
+    public:
+        JSNodeFilterCondition(KJS::JSObject* filter);
+        virtual short acceptNode(Node*) const;
+        virtual void mark();
+
+    protected:
+        KJS::JSObject* m_filter;
+    };
+
+} // namespace WebCore
+
+#endif // JSNodeFilterCondition_h
diff --git a/WebCore/bindings/js/JSNodeFilterCustom.cpp b/WebCore/bindings/js/JSNodeFilterCustom.cpp
new file mode 100644 (file)
index 0000000..258059c
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "JSNodeFilter.h"
+
+#include "JSNodeFilterCondition.h"
+#include "NodeFilter.h"
+#include "kjs_binding.h"
+
+namespace WebCore {
+
+void JSNodeFilter::mark()
+{
+    impl()->mark();
+    DOMObject::mark();
+}
+
+NodeFilter* toNodeFilter(KJS::JSValue* val)
+{
+    if (!val || !val->isObject())
+        return 0;
+
+    if (val->isObject(&JSNodeFilter::info))
+        return static_cast<JSNodeFilter*>(val)->impl();
+
+    KJS::JSObject* o = static_cast<KJS::JSObject*>(val);
+    if (o->implementsCall())
+        return new NodeFilter(new JSNodeFilterCondition(o));
+
+    return 0;
+}
+
+} // namespace WebCore
index efb002a696697edff414c469b86a220aad8cb615..073e16a9cd7cbf783a5532d4170d0e61e07f2aca 100644 (file)
@@ -60,7 +60,6 @@
 #include "RenderView.h"
 #include "kjs_css.h"
 #include "kjs_events.h"
-#include "kjs_traversal.h"
 #include "kjs_window.h"
 #include "xmlhttprequest.h"
 
diff --git a/WebCore/bindings/js/kjs_traversal.cpp b/WebCore/bindings/js/kjs_traversal.cpp
deleted file mode 100644 (file)
index 873bcfa..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- *  This file is part of the KDE libraries
- *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
- *
- *  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 "config.h"
-#include "kjs_traversal.h"
-
-#include "Document.h"
-#include "Frame.h"
-#include "JSNodeFilter.h"
-#include "kjs_proxy.h"
-
-#include "kjs_traversal.lut.h"
-
-using namespace WebCore;
-
-namespace KJS {
-
-// -------------------------------------------------------------------------
-
-const ClassInfo DOMNodeFilter::info = { "NodeFilter", 0, 0, 0 };
-/*
-@begin DOMNodeFilterPrototypeTable 1
-  acceptNode    DOMNodeFilter::AcceptNode       DontDelete|Function 0
-@end
-*/
-KJS_DEFINE_PROTOTYPE(DOMNodeFilterPrototype)
-KJS_IMPLEMENT_PROTOTYPE_FUNCTION(DOMNodeFilterPrototypeFunction)
-KJS_IMPLEMENT_PROTOTYPE("DOMNodeFilter",DOMNodeFilterPrototype,DOMNodeFilterPrototypeFunction)
-
-DOMNodeFilter::DOMNodeFilter(ExecState *exec, NodeFilter *nf)
-  : m_impl(nf) 
-{
-  setPrototype(DOMNodeFilterPrototype::self(exec));
-}
-
-DOMNodeFilter::~DOMNodeFilter()
-{
-  ScriptInterpreter::forgetDOMObject(m_impl.get());
-}
-
-void DOMNodeFilter::mark()
-{
-    m_impl->mark();
-    DOMObject::mark();
-}
-
-JSValue *DOMNodeFilterPrototypeFunction::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)
-{
-  if (!thisObj->inherits(&KJS::DOMNodeFilter::info))
-    return throwError(exec, TypeError);
-  NodeFilter &nodeFilter = *static_cast<DOMNodeFilter *>(thisObj)->impl();
-  switch (id) {
-    case DOMNodeFilter::AcceptNode:
-      return jsNumber(nodeFilter.acceptNode(toNode(args[0])));
-  }
-  return jsUndefined();
-}
-
-JSValue *toJS(ExecState* exec, NodeFilter* nf)
-{
-    return cacheDOMObject<NodeFilter, JSNodeFilter>(exec, nf);
-}
-
-PassRefPtr<NodeFilter> toNodeFilter(JSValue* val)
-{
-    if (!val)
-        return 0;
-    if (!val->isObject())
-        return 0;
-
-    if (val->isObject(&DOMNodeFilter::info))
-        return static_cast<DOMNodeFilter *>(val)->impl();
-
-    JSObject* o = static_cast<JSObject*>(val);
-    if (o->implementsCall())
-        return new NodeFilter(new JSNodeFilterCondition(o));
-
-    return 0;
-}
-
-// -------------------------------------------------------------------------
-
-JSNodeFilterCondition::JSNodeFilterCondition(JSObject * _filter)
-    : filter( _filter )
-{
-}
-
-void JSNodeFilterCondition::mark()
-{
-    filter->mark();
-}
-
-short JSNodeFilterCondition::acceptNode(WebCore::Node* filterNode) const
-{
-    WebCore::Node *node = filterNode;
-    Frame *frame = node->document()->frame();
-    KJSProxy *proxy = frame->scriptProxy();
-    if (proxy && filter->implementsCall()) {
-        JSLock lock;
-        ExecState *exec = proxy->interpreter()->globalExec();
-        List args;
-        args.append(toJS(exec, node));
-        JSObject *obj = filter;
-        JSValue *result = obj->call(exec, obj, args);
-        return result->toInt32(exec);
-    }
-
-    return NodeFilter::FILTER_REJECT;
-}
-
-} // namespace
diff --git a/WebCore/bindings/js/kjs_traversal.h b/WebCore/bindings/js/kjs_traversal.h
deleted file mode 100644 (file)
index f633504..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-// -*- c-basic-offset: 2 -*-
-/*
- *  This file is part of the KDE libraries
- *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
- *
- *  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
- */
-
-#ifndef kjs_traversal_h
-#define kjs_traversal_h
-
-#include "NodeFilter.h"
-#include "NodeFilterCondition.h"
-#include "kjs_dom.h"
-
-namespace WebCore {
-    class NodeFilter;
-}
-
-namespace KJS {
-
-  class DOMNodeFilter : public DOMObject {
-  public:
-    DOMNodeFilter(ExecState*, WebCore::NodeFilter*);
-    ~DOMNodeFilter();
-    virtual void mark();
-    // no put - all read-only
-    virtual const ClassInfo* classInfo() const { return &info; }
-    static const ClassInfo info;
-    WebCore::NodeFilter* impl() const { return m_impl.get(); }
-    enum { AcceptNode };
-  private:
-    RefPtr<WebCore::NodeFilter> m_impl;
-  };
-
-  JSValue* toJS(ExecState*, WebCore::NodeFilter*);
-
-  PassRefPtr<WebCore::NodeFilter> toNodeFilter(JSValue*); // returns 0 if value is not a DOMNodeFilter or JS function 
-
-  class JSNodeFilterCondition : public WebCore::NodeFilterCondition {
-  public:
-    JSNodeFilterCondition(JSObject* filter);
-    virtual short acceptNode(WebCore::Node*) const;
-    virtual void mark();
-  protected:
-    JSObject *filter;
-  };
-
-} // namespace
-
-#endif
index c94d4add1f07155ca68f6d8f54eafee6036df4e1..8ba88b34f89e09622a11c0a5d6d4bb38711a73c3 100644 (file)
@@ -61,7 +61,6 @@
 #include "kjs_events.h"
 #include "kjs_navigator.h"
 #include "kjs_proxy.h"
-#include "kjs_traversal.h"
 #include <wtf/MathExtras.h>
 
 #if ENABLE(XSLT)
index 197e4e8458c068e42f23d17811a9b1636da7b8d4..45ffc636666f6d5dd247a0111a326705cb757841 100644 (file)
@@ -700,7 +700,7 @@ short ObjCNodeFilterCondition::acceptNode(WebCore::Node* node) const
 
 - (DOMNodeIterator *)createNodeIterator:(DOMNode *)root whatToShow:(unsigned)whatToShow filter:(id <DOMNodeFilter>)filter expandEntityReferences:(BOOL)expandEntityReferences
 {
-    RefPtr<WebCore::NodeFilter> cppFilter;
+    WebCore::NodeFilter* cppFilter;
     if (filter)
         cppFilter = new WebCore::NodeFilter(new ObjCNodeFilterCondition(filter));
     WebCore::ExceptionCode ec = 0;
@@ -711,7 +711,7 @@ short ObjCNodeFilterCondition::acceptNode(WebCore::Node* node) const
 
 - (DOMTreeWalker *)createTreeWalker:(DOMNode *)root whatToShow:(unsigned)whatToShow filter:(id <DOMNodeFilter>)filter expandEntityReferences:(BOOL)expandEntityReferences
 {
-    RefPtr<WebCore::NodeFilter> cppFilter;
+    WebCore::NodeFilter* cppFilter;
     if (filter)
         cppFilter = new WebCore::NodeFilter(new ObjCNodeFilterCondition(filter));
     WebCore::ExceptionCode ec = 0;
index 062405ca1154683c8b60b6806f6f474e0fc6e025..e0968ce840be3c5f9734c00e1e7b499cd9177e6d 100644 (file)
@@ -144,7 +144,6 @@ sub GetLegacyHeaderIncludes
     return "#include \"kjs_dom.h\"\n\n" if $module eq "core";
     return "#include \"kjs_css.h\"\n\n" if $module eq "css";
     return "#include \"kjs_html.h\"\n\n" if $module eq "html";
-    return "#include \"kjs_traversal.h\"\n\n" if $module eq "traversal";
 
     die "Don't know what headers to include for module $module";
 }
@@ -1167,7 +1166,7 @@ sub GenerateImplementation
         push(@implContent, "}\n");
     }
 
-    if (!$hasParent || $dataNode->extendedAttributes->{"GenerateNativeConverter"}) {
+    if ((!$hasParent or $dataNode->extendedAttributes->{"GenerateNativeConverter"}) and !$dataNode->extendedAttributes->{"CustomNativeConverter"}) {
         if ($podType) {
             push(@implContent, "$podType to${interfaceName}(KJS::JSValue* val)\n");
         } else {
@@ -1245,7 +1244,6 @@ sub GetNativeType
     return "bool" if $type eq "boolean";
     return "int" if $type eq "long";
     return "String" if $type eq "DOMString";
-    return "PassRefPtr<${type}>" if $type eq "NodeFilter";
     return "Range::CompareHow" if $type eq "CompareHow";
     return "EventTargetNode*" if $type eq "EventTarget";
     return "FloatRect" if $type eq "SVGRect";
@@ -1355,11 +1353,6 @@ sub JSValueToNative
         return "toElement($value)";
     }
 
-    if ($type eq "NodeFilter") {
-        $implIncludes{"kjs_traversal.h"} = 1;
-        return "toNodeFilter($value)";
-    }
-
     if ($type eq "DOMWindow") {
         $implIncludes{"kjs_window.h"} = 1;
         return "toDOMWindow($value)";
index a7b50a99c6b992aca5aa964fdf23d3e27aad1fd7..3ed60e80f105abb0b05f9312ac53c596e82b65bc 100644 (file)
@@ -917,7 +917,7 @@ PassRefPtr<Range> Document::createRange()
 }
 
 PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, 
-    PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionCode& ec)
+    NodeFilter* filter, bool expandEntityReferences, ExceptionCode& ec)
 {
     if (!root) {
         ec = NOT_SUPPORTED_ERR;
@@ -927,7 +927,7 @@ PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT
 }
 
 PassRefPtr<TreeWalker> Document::createTreeWalker(Node *root, unsigned whatToShow, 
-    PassRefPtr<NodeFilter> filter, bool expandEntityReferences, ExceptionCode& ec)
+    NodeFilter* filter, bool expandEntityReferences, ExceptionCode& ec)
 {
     if (!root) {
         ec = NOT_SUPPORTED_ERR;
index e7fbad0cf65820634e99d1feae6439c8331025b3..a39b4e11bf095256da6ff9bac75fd3acbef87edf 100644 (file)
@@ -308,10 +308,10 @@ public:
     PassRefPtr<Range> createRange();
 
     PassRefPtr<NodeIterator> createNodeIterator(Node* root, unsigned whatToShow,
-        PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&);
+        NodeFilter*, bool expandEntityReferences, ExceptionCode&);
 
     PassRefPtr<TreeWalker> createTreeWalker(Node* root, unsigned whatToShow, 
-        PassRefPtr<NodeFilter>, bool expandEntityReferences, ExceptionCode&);
+        NodeFilter*, bool expandEntityReferences, ExceptionCode&);
 
     // Special support for editing
     PassRefPtr<CSSStyleDeclaration> createCSSStyleDeclaration();
index ef9d7232ac9a9259923406ea91eb437e458efbc8..1157f5839823640a33fd7a667c9bc363989937c5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
  *
  * This library is free software; you can redistribute it and/or
@@ -21,7 +21,7 @@
 module traversal {
 
     // Introduced in DOM Level 2:
-    interface [LegacyParent=KJS::DOMNodeFilter, GenerateConstructor, ObjCProtocol] NodeFilter {
+    interface [GenerateConstructor, CustomMarkFunction, CustomNativeConverter, ObjCProtocol] NodeFilter {
 
         // Constants returned by acceptNode
         const short               FILTER_ACCEPT                  = 1;
@@ -43,9 +43,7 @@ module traversal {
         const unsigned long       SHOW_DOCUMENT_FRAGMENT         = 0x00000400;
         const unsigned long       SHOW_NOTATION                  = 0x00000800;
 
-#if !defined(LANGUAGE_JAVASCRIPT)
         short acceptNode(in Node n);
-#endif
 
     };