LayoutTests:
authorweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 May 2007 23:00:20 +0000 (23:00 +0000)
committerweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 May 2007 23:00:20 +0000 (23:00 +0000)
        Reviewed by Darin.

        Update tests for http://bugs.webkit.org/show_bug.cgi?id=13830
        Auto-generate JS DOM bindings for HTMLDocument and most of
        the rest of HTMLElement

        - Corrects prototype chain for JSHTMLDocument and adds test
          for HTMLFormElement.

        * fast/dom/prototype-chain-expected.txt:
        * fast/dom/prototype-chain.html:

WebCore:

        Reviewed by Darin.

        Part two of patch for http://bugs.webkit.org/show_bug.cgi?id=13830
        Auto-generate JS DOM bindings for HTMLDocument and most of the rest
        of HTMLElement

        - Just the HTMLDocument part.

        * WebCore.pro:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSHTMLDocumentCustom.cpp: Added.
        (WebCore::JSHTMLDocument::canGetItemsForName):
        (WebCore::JSHTMLDocument::nameGetter):
        (WebCore::JSHTMLDocument::all):
        (WebCore::JSHTMLDocument::setAll):
        (WebCore::JSHTMLDocument::location):
        (WebCore::JSHTMLDocument::setLocation):
        (WebCore::JSHTMLDocument::open):
        (WebCore::writeHelper):
        (WebCore::JSHTMLDocument::write):
        (WebCore::JSHTMLDocument::writeln):
        (WebCore::JSHTMLDocument::clear):
        * bindings/js/kjs_dom.cpp:
        (KJS::toJS):
        * bindings/js/kjs_dom.h:
        * bindings/js/kjs_html.cpp:
        * bindings/js/kjs_html.h:
        * bindings/objc/DOMPrivate.h:
        * bindings/scripts/CodeGeneratorJS.pm: Add [Deletable] property
        for Document.all and fix HasOverridingNameGetter to allow correct
        prototype chain
        * dom/Document.cpp:
        (WebCore::Document::plugins): adds alias to embeds() for bindings
        * dom/Document.h:
        * html/HTMLDocument.cpp:
        (WebCore::HTMLDocument::width):
        (WebCore::HTMLDocument::height):
        (WebCore::HTMLDocument::dir):
        (WebCore::HTMLDocument::setDir):
        (WebCore::HTMLDocument::designMode):
        (WebCore::HTMLDocument::setDesignMode):
        (WebCore::HTMLDocument::bgColor):
        (WebCore::HTMLDocument::setBgColor):
        (WebCore::HTMLDocument::fgColor):
        (WebCore::HTMLDocument::setFgColor):
        (WebCore::HTMLDocument::alinkColor):
        (WebCore::HTMLDocument::setAlinkColor):
        (WebCore::HTMLDocument::linkColor):
        (WebCore::HTMLDocument::setLinkColor):
        (WebCore::HTMLDocument::vlinkColor):
        (WebCore::HTMLDocument::setVlinkColor):
        (WebCore::HTMLDocument::captureEvents):
        (WebCore::HTMLDocument::releaseEvents):
        * html/HTMLDocument.h:
        * html/HTMLDocument.idl:

WebKit:

        Reviewed by Darin.

        Patch for http://bugs.webkit.org/show_bug.cgi?id=13830
        Auto-generate JS DOM bindings for HTMLDocument and most of the rest
        of HTMLElement

        * MigrateHeaders.make: add DOMHTMLDocumentPrivate.h
        * WebKit.xcodeproj/project.pbxproj:

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

21 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/prototype-chain-expected.txt
LayoutTests/fast/dom/prototype-chain.html
WebCore/ChangeLog
WebCore/WebCore.pro
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/JSHTMLDocumentCustom.cpp [new file with mode: 0644]
WebCore/bindings/js/kjs_dom.cpp
WebCore/bindings/js/kjs_dom.h
WebCore/bindings/js/kjs_html.cpp
WebCore/bindings/js/kjs_html.h
WebCore/bindings/objc/DOMPrivate.h
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/dom/Document.cpp
WebCore/dom/Document.h
WebCore/html/HTMLDocument.cpp
WebCore/html/HTMLDocument.h
WebCore/html/HTMLDocument.idl
WebKit/ChangeLog
WebKit/MigrateHeaders.make
WebKit/WebKit.xcodeproj/project.pbxproj

index 6ecca4f97fa4fd6fe1249aaf178989a1c09f4fd5..633306434a13f3f8f06655d381b81ddbb5069035 100644 (file)
@@ -1,3 +1,17 @@
+2007-05-23  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Darin.
+
+        Update tests for http://bugs.webkit.org/show_bug.cgi?id=13830
+        Auto-generate JS DOM bindings for HTMLDocument and most of 
+        the rest of HTMLElement
+
+        - Corrects prototype chain for JSHTMLDocument and adds test
+          for HTMLFormElement.
+
+        * fast/dom/prototype-chain-expected.txt:
+        * fast/dom/prototype-chain.html:
+
 2007-05-23  Kevin McCullough  <kmccullough@apple.com>
 
         Reviewed by.
index 94301305d80ed7e37f0c3c4cd904f8a5f19f8ceb..a56a94c72144cae5feb7b887c95ffc1ecd0919d0 100644 (file)
@@ -2,7 +2,7 @@ This page prints out the prototype chains of select DOM objects. Older versions
 
 NOTE: This test will start failing if you change the layout of a related prototype chain in WebCore. That does not necessarily mean that you have done something wrong; you may just need to check in new results.
 
------ [object HTMLDocument] (7 prototypes) -----
+----- [object HTMLDocument] (6 prototypes) -----
 
 [object Object]
 
@@ -14,8 +14,6 @@ NOTE: This test will start failing if you change the layout of a related prototy
 
 [object DocumentPrototype]
 
-[object DOMHTMLDocumentPrototype]
-
 [object HTMLDocumentPrototype]
 
 ----- [object HTMLDivElement] (8 prototypes) -----
@@ -36,6 +34,24 @@ NOTE: This test will start failing if you change the layout of a related prototy
 
 [object HTMLDivElementPrototype]
 
+----- [object HTMLFormElement] (8 prototypes) -----
+
+[object Object]
+
+[object DOMNodePrototype]
+
+[object NodePrototype]
+
+[object DOMEventTargetNodePrototype]
+
+[object ElementPrototype]
+
+[object HTMLElementPrototype]
+
+[object HTMLElementPrototype]
+
+[object HTMLFormElementPrototype]
+
 ----- [object UIEvent] (4 prototypes) -----
 
 [object Object]
index fe7f791eedac3276a2d0518c6264cc4965c4ebb5..c210c3e8ee9e9123fa65be0821bed309d01deb72 100644 (file)
@@ -36,6 +36,9 @@ function test()
     
     e = document.getElementById("div");
     printPrototypes(e);
+
+    e = document.createElement("form");
+    printPrototypes(e);
     
     e = document.createEvent("UIEvents");
     printPrototypes(e);
index fc3384e494208cdd14959fc2537f2b838ae41247..8ad0e84e3d8a44b1e7a39a48e8ec5878d4d2abb2 100644 (file)
@@ -1,3 +1,61 @@
+2007-05-23  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Darin.
+
+        Part two of patch for http://bugs.webkit.org/show_bug.cgi?id=13830
+        Auto-generate JS DOM bindings for HTMLDocument and most of the rest
+        of HTMLElement
+
+        - Just the HTMLDocument part.
+
+        * WebCore.pro:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSHTMLDocumentCustom.cpp: Added.
+        (WebCore::JSHTMLDocument::canGetItemsForName):
+        (WebCore::JSHTMLDocument::nameGetter):
+        (WebCore::JSHTMLDocument::all):
+        (WebCore::JSHTMLDocument::setAll):
+        (WebCore::JSHTMLDocument::location):
+        (WebCore::JSHTMLDocument::setLocation):
+        (WebCore::JSHTMLDocument::open):
+        (WebCore::writeHelper):
+        (WebCore::JSHTMLDocument::write):
+        (WebCore::JSHTMLDocument::writeln):
+        (WebCore::JSHTMLDocument::clear):
+        * bindings/js/kjs_dom.cpp:
+        (KJS::toJS):
+        * bindings/js/kjs_dom.h:
+        * bindings/js/kjs_html.cpp:
+        * bindings/js/kjs_html.h:
+        * bindings/objc/DOMPrivate.h:
+        * bindings/scripts/CodeGeneratorJS.pm: Add [Deletable] property
+        for Document.all and fix HasOverridingNameGetter to allow correct
+        prototype chain
+        * dom/Document.cpp:
+        (WebCore::Document::plugins): adds alias to embeds() for bindings
+        * dom/Document.h:
+        * html/HTMLDocument.cpp:
+        (WebCore::HTMLDocument::width):
+        (WebCore::HTMLDocument::height):
+        (WebCore::HTMLDocument::dir):
+        (WebCore::HTMLDocument::setDir):
+        (WebCore::HTMLDocument::designMode):
+        (WebCore::HTMLDocument::setDesignMode):
+        (WebCore::HTMLDocument::bgColor):
+        (WebCore::HTMLDocument::setBgColor):
+        (WebCore::HTMLDocument::fgColor):
+        (WebCore::HTMLDocument::setFgColor):
+        (WebCore::HTMLDocument::alinkColor):
+        (WebCore::HTMLDocument::setAlinkColor):
+        (WebCore::HTMLDocument::linkColor):
+        (WebCore::HTMLDocument::setLinkColor):
+        (WebCore::HTMLDocument::vlinkColor):
+        (WebCore::HTMLDocument::setVlinkColor):
+        (WebCore::HTMLDocument::captureEvents):
+        (WebCore::HTMLDocument::releaseEvents):
+        * html/HTMLDocument.h:
+        * html/HTMLDocument.idl:
+
 2007-05-23  David Hyatt  <hyatt@apple.com>
 
         Fix for <rdar://problem/5221838> REGRESSION (r21581): no content in idisk
index 570554b1e64a5a42966f997222227553418b7f2b..edc71c5b7ef980910aa5defe6b719d0c8ff9efd6 100644 (file)
@@ -267,6 +267,7 @@ SOURCES += \
     bindings/js/JSCustomXPathNSResolver.cpp \
     bindings/js/JSDocumentCustom.cpp \
     bindings/js/JSHTMLAnchorElementCustom.cpp \
+    bindings/js/JSHTMLDocumentCustom.cpp \
     bindings/js/JSHTMLElementWrapperFactory.cpp \
     bindings/js/JSHTMLFormElementCustom.cpp \
     bindings/js/JSHTMLInputElementBase.cpp \
index 8a89a9f5b245e08a134fe26e43d8e972990c4070..5dc1b9720dd1ce65f35211cf7db0932f41177a0b 100644 (file)
                BC5156F40C03B7DC008BB0EE /* DOMHTMLFrameElementPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = BC5156F30C03B7DC008BB0EE /* DOMHTMLFrameElementPrivate.h */; };
                BC51579F0C03BBD3008BB0EE /* DOMHTMLMarqueeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5156E50C03B741008BB0EE /* DOMHTMLMarqueeElement.h */; };
                BC5157DD0C03BC22008BB0EE /* DOMHTMLFrameElementPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5156F30C03B7DC008BB0EE /* DOMHTMLFrameElementPrivate.h */; };
+               BC51580B0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */; };
                BC588AF00BFA6CF900EE679E /* HTMLParserErrorCodes.h in Headers */ = {isa = PBXBuildFile; fileRef = BC588AEF0BFA6CF900EE679E /* HTMLParserErrorCodes.h */; };
                BC588B4B0BFA723C00EE679E /* HTMLParserErrorCodes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC588B4A0BFA723C00EE679E /* HTMLParserErrorCodes.cpp */; };
                BC6D6DD209AF906600F59759 /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6D6DD009AF906600F59759 /* Font.cpp */; };
                BC6DB3690A1A7CB700E5CD14 /* GlyphPageTreeNode.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6DB3680A1A7CB700E5CD14 /* GlyphPageTreeNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC6DB4740A1A90FB00E5CD14 /* GlyphPageTreeNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6DB4730A1A90FB00E5CD14 /* GlyphPageTreeNode.cpp */; };
                BC6DB4D40A1AFEEF00E5CD14 /* GlyphPageTreeNodeMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6DB4D30A1AFEEF00E5CD14 /* GlyphPageTreeNodeMac.cpp */; };
+               BC6E2B1A0C04B93600444EF8 /* DOMHTMLDocumentPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6E2B190C04B93600444EF8 /* DOMHTMLDocumentPrivate.h */; };
+               BC6E2B290C04B95400444EF8 /* DOMHTMLDocumentPrivate.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = BC6E2B190C04B93600444EF8 /* DOMHTMLDocumentPrivate.h */; };
                BC7F44A80B9E324E00A9D081 /* ImageObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7F44A70B9E324E00A9D081 /* ImageObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BCA169A20BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCA169A00BFD55B40019CA76 /* JSHTMLTableCaptionElement.cpp */; };
                BCA169A30BFD55B40019CA76 /* JSHTMLTableCaptionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BCA169A10BFD55B40019CA76 /* JSHTMLTableCaptionElement.h */; };
                        dstPath = Versions/A/PrivateHeaders;
                        dstSubfolderSpec = 1;
                        files = (
+                               BC6E2B290C04B95400444EF8 /* DOMHTMLDocumentPrivate.h in Copy Generated Headers */,
                                BC5156E80C03B741008BB0EE /* DOMHTMLMarqueeElement.h in Copy Generated Headers */,
                                BC5156F40C03B7DC008BB0EE /* DOMHTMLFrameElementPrivate.h in Copy Generated Headers */,
                                93F9B6560BA0F35E00854064 /* DOMHTMLCanvasElement.h in Copy Generated Headers */,
                BC5156E60C03B741008BB0EE /* DOMHTMLMarqueeElement.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMHTMLMarqueeElement.mm; sourceTree = "<group>"; };
                BC5156E70C03B741008BB0EE /* DOMHTMLMarqueeElementInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMHTMLMarqueeElementInternal.h; sourceTree = "<group>"; };
                BC5156F30C03B7DC008BB0EE /* DOMHTMLFrameElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMHTMLFrameElementPrivate.h; sourceTree = "<group>"; };
+               BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLDocumentCustom.cpp; sourceTree = "<group>"; };
                BC588AEF0BFA6CF900EE679E /* HTMLParserErrorCodes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLParserErrorCodes.h; sourceTree = "<group>"; };
                BC588B4A0BFA723C00EE679E /* HTMLParserErrorCodes.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLParserErrorCodes.cpp; sourceTree = "<group>"; };
                BC5EC1760A507E3E006007F5 /* view-source.css */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = "view-source.css"; sourceTree = "<group>"; };
                BC6DB3680A1A7CB700E5CD14 /* GlyphPageTreeNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = GlyphPageTreeNode.h; sourceTree = "<group>"; };
                BC6DB4730A1A90FB00E5CD14 /* GlyphPageTreeNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GlyphPageTreeNode.cpp; sourceTree = "<group>"; };
                BC6DB4D30A1AFEEF00E5CD14 /* GlyphPageTreeNodeMac.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GlyphPageTreeNodeMac.cpp; sourceTree = "<group>"; };
+               BC6E2B190C04B93600444EF8 /* DOMHTMLDocumentPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMHTMLDocumentPrivate.h; sourceTree = "<group>"; };
                BC7B2AF80450824100A8000F /* ScrollBar.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = ScrollBar.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BC7B2AF90450824100A8000F /* PlatformScrollBarMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformScrollBarMac.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BC7F44A70B9E324E00A9D081 /* ImageObserver.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ImageObserver.h; sourceTree = "<group>"; };
                                85BA4D020AA688680088052D /* DOMHTMLDListElement.mm */,
                                85BCBC110ABBA87D00381160 /* DOMHTMLDocument.h */,
                                85BCBC120ABBA87D00381160 /* DOMHTMLDocument.mm */,
+                               BC6E2B190C04B93600444EF8 /* DOMHTMLDocumentPrivate.h */,
                                85DF2EEB0AA387CB00AD64C5 /* DOMHTMLElement.h */,
                                85DF2EEC0AA387CB00AD64C5 /* DOMHTMLElement.mm */,
                                854075650AD6CBF900620C57 /* DOMHTMLEmbedElement.h */,
                                E10B937B0B73C00A003ED890 /* JSCustomXPathNSResolver.h */,
                                929264760B61FC7200B41D34 /* JSDocumentCustom.cpp */,
                                BCF411770BFCC76A00125622 /* JSHTMLAnchorElementCustom.cpp */,
+                               BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */,
                                938E65F609F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp */,
                                938E65F009F09840008A48EC /* JSHTMLElementWrapperFactory.h */,
                                A8D065AD0A2446CD005E7203 /* JSHTMLFormElementCustom.cpp */,
                                BC5156EA0C03B741008BB0EE /* DOMHTMLMarqueeElementInternal.h in Headers */,
                                BC51579F0C03BBD3008BB0EE /* DOMHTMLMarqueeElement.h in Headers */,
                                BC5157DD0C03BC22008BB0EE /* DOMHTMLFrameElementPrivate.h in Headers */,
+                               BC6E2B1A0C04B93600444EF8 /* DOMHTMLDocumentPrivate.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                BC491B780C023EFD009D6316 /* JSHTMLMarqueeElement.cpp in Sources */,
                                BC5156E90C03B741008BB0EE /* DOMHTMLMarqueeElement.mm in Sources */,
                                ABAF22080C03B1C700B0BCF0 /* ChromeMac.mm in Sources */,
+                               BC51580B0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
diff --git a/WebCore/bindings/js/JSHTMLDocumentCustom.cpp b/WebCore/bindings/js/JSHTMLDocumentCustom.cpp
new file mode 100644 (file)
index 0000000..aa818ac
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * 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 "JSHTMLDocument.h"
+
+#include "Frame.h"
+#include "FrameLoader.h"
+#include "HTMLBodyElement.h"
+#include "HTMLCollection.h"
+#include "HTMLDocument.h"
+#include "HTMLElement.h"
+#include "HTMLIFrameElement.h"
+#include "HTMLNames.h"
+#include "kjs_html.h"
+#include "kjs_window.h"
+
+namespace WebCore {
+
+using namespace KJS;
+using namespace HTMLNames;
+
+bool JSHTMLDocument::canGetItemsForName(ExecState*, HTMLDocument* doc, const AtomicString& propertyName)
+{
+    return doc->hasNamedItem(propertyName) || doc->hasDocExtraNamedItem(propertyName);
+}
+
+JSValue* JSHTMLDocument::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
+{
+    JSHTMLDocument* thisObj = static_cast<JSHTMLDocument*>(slot.slotBase());
+    HTMLDocument* doc = static_cast<HTMLDocument*>(thisObj->impl());
+
+    String name = propertyName;
+    RefPtr<HTMLCollection> collection = doc->documentNamedItems(name);
+
+    unsigned length = collection->length();
+    if (!length)
+        return jsUndefined();
+
+    if (length == 1) {
+        Node* node = collection->firstItem();
+
+        Frame* frame;
+        if (node->hasTagName(iframeTag) && (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
+            return Window::retrieve(frame);
+
+        return toJS(exec, node);
+    } 
+
+    return getHTMLCollection(exec, collection.get());
+}
+
+// Custom attributes
+
+JSValue* JSHTMLDocument::all(ExecState* exec) const
+{
+    // If "all" has been overwritten, return the overwritten value
+    if (JSValue* v = getDirect("all"))
+        return v;
+
+    return getAllHTMLCollection(exec, static_cast<HTMLDocument*>(impl())->all().get());
+}
+
+void JSHTMLDocument::setAll(ExecState*, JSValue* value)
+{
+    // Add "all" to the property map.
+    putDirect("all", value);
+}
+
+JSValue* JSHTMLDocument::location(ExecState* exec) const
+{
+    Frame* frame = static_cast<HTMLDocument*>(impl())->frame();
+    if (!frame)
+        return jsNull();
+
+    Window* win = Window::retrieveWindow(frame);
+    ASSERT(win);
+    return win->location();
+}
+
+void JSHTMLDocument::setLocation(ExecState* exec, JSValue* value)
+{
+    Frame* frame = static_cast<HTMLDocument*>(impl())->frame();
+    if (!frame)
+        return;
+
+    String str = value->toString(exec);
+
+    // When assigning location, IE and Mozilla both resolve the URL
+    // relative not the target frame.
+    Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
+    if (activeFrame)
+        str = activeFrame->document()->completeURL(str);
+
+    // We want a new history item if this JS was called via a user gesture
+    bool userGesture = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->wasRunByUserGesture();
+    frame->loader()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), !userGesture);
+}
+
+// Custom functions
+
+JSValue* JSHTMLDocument::open(ExecState* exec, const List& args)
+{
+    // For compatibility with other browsers, pass open calls with more than 2 parameters to the window.
+    if (args.size() > 2) {
+        Frame* frame = static_cast<HTMLDocument*>(impl())->frame();
+        if (frame) {
+            Window* window = Window::retrieveWindow(frame);
+            if (window) {
+                JSObject* functionObject = window->get(exec, "open")->getObject();
+                if (!functionObject || !functionObject->implementsCall())
+                    return throwError(exec, TypeError);
+                return functionObject->call(exec, window, args);
+            }
+        }
+        return jsUndefined();
+    }
+
+    // In the case of two parameters or fewer, do a normal document open.
+    static_cast<HTMLDocument*>(impl())->open();
+    return jsUndefined();
+}
+
+static String writeHelper(ExecState* exec, const List& args)
+{
+    // DOM only specifies single string argument, but NS & IE allow multiple
+    // or no arguments.
+    String str = "";
+    for (int i = 0; i < args.size(); ++i)
+        str += args[i]->toString(exec);
+    return str;
+}
+
+JSValue* JSHTMLDocument::write(ExecState* exec, const List& args)
+{
+    static_cast<HTMLDocument*>(impl())->write(writeHelper(exec, args));
+    return jsUndefined();
+}
+
+JSValue* JSHTMLDocument::writeln(ExecState* exec, const List& args)
+{
+    static_cast<HTMLDocument*>(impl())->write(writeHelper(exec, args) + "\n");
+    return jsUndefined();
+}
+
+JSValue* JSHTMLDocument::clear(ExecState*, const List&)
+{
+    // even IE doesn't support this one...
+    // static_cast<HTMLDocument*>(impl())->clear();
+    return jsUndefined();
+}
+
+} // namespace WebCore
index 9c2147dd6804b72d06e288fb95811290e96eec13..ceb10e6af09433d1f3fa41fdf16514a10985854a 100644 (file)
@@ -1071,9 +1071,9 @@ JSValue* getRuntimeObject(ExecState* exec, Node* n)
     return 0;
 }
 
-JSValue* toJS(ExecState* exec, PassRefPtr<NodeList> l)
+JSValue* toJS(ExecState* exec, NodeList* l)
 {
-    return cacheDOMObject<NodeList, DOMNodeList>(exec, l.get());
+    return cacheDOMObject<NodeList, DOMNodeList>(exec, l);
 }
 
 // -------------------------------------------------------------------------
index c57c96ec14c53686e80ca35b044ff15ecf4a397a..8f7c5fcabda947b95f88f867951dd5b343d978d1 100644 (file)
@@ -137,7 +137,7 @@ namespace KJS {
   JSValue* getRuntimeObject(ExecState*, WebCore::Node*);
   JSValue* toJS(ExecState*, PassRefPtr<WebCore::Node>);
   JSValue* toJS(ExecState*, WebCore::NamedNodeMap*);
-  JSValue* toJS(ExecState*, PassRefPtr<WebCore::NodeList>);
+  JSValue* toJS(ExecState*, WebCore::NodeList*);
   JSValue* toJS(ExecState*, WebCore::EventTarget*);
   JSObject* getNodeConstructor(ExecState*);
   JSObject* getDOMExceptionConstructor(ExecState*);
index 74fed73b4b8e2126d6d7ef2c91d871971fd36952..656bd2b0ed16e2d425bb48ab2618b7c23785ae92 100644 (file)
@@ -71,345 +71,6 @@ private:
   int id;
 };
 
-/* 
-@begin JSHTMLDocumentPrototypeTable 8
-clear                 JSHTMLDocument::Clear             DontDelete|Function 0
-open                  JSHTMLDocument::Open              DontDelete|Function 0
-close                 JSHTMLDocument::Close             DontDelete|Function 0
-write                 JSHTMLDocument::Write             DontDelete|Function 1
-writeln               JSHTMLDocument::WriteLn           DontDelete|Function 1
-getElementsByName     JSHTMLDocument::GetElementsByName DontDelete|Function 1
-captureEvents         JSHTMLDocument::CaptureEvents     DontDelete|Function 0
-releaseEvents         JSHTMLDocument::ReleaseEvents     DontDelete|Function 0
-@end
-*/
-KJS_IMPLEMENT_PROTOTYPE_FUNCTION(JSHTMLDocumentPrototypeFunction)
-KJS_IMPLEMENT_PROTOTYPE("DOMHTMLDocument", JSHTMLDocumentPrototype, JSHTMLDocumentPrototypeFunction)
-
-JSValue *JSHTMLDocumentPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List &args)
-{
-    if (!thisObj->inherits(&JSHTMLDocument::info))
-        return throwError(exec, TypeError);
-    HTMLDocument &doc = *static_cast<HTMLDocument*>(static_cast<JSHTMLDocument*>(thisObj)->impl());
-    
-    switch (id) {
-        case JSHTMLDocument::Clear: // even IE doesn't support that one...
-                                    //doc.clear(); // TODO
-            return jsUndefined();
-        case JSHTMLDocument::Open:
-            // For compatibility with other browsers, pass open calls with more than 2 parameters to the window.
-            if (args.size() > 2) {
-                Frame *frame = doc.frame();
-                if (frame) {
-                    Window *window = Window::retrieveWindow(frame);
-                    if (window) {
-                        JSObject* functionObject = window->get(exec, "open")->getObject();
-                        if (!functionObject || !functionObject->implementsCall())
-                            return throwError(exec, TypeError);
-                        return functionObject->call(exec, window, args);
-                    }
-                }
-                return jsUndefined();
-            }
-            // In the case of two parameters or fewer, do a normal document open.
-            doc.open();
-            return jsUndefined();
-        case JSHTMLDocument::Close:
-            doc.close();
-            return jsUndefined();
-        case JSHTMLDocument::Write:
-        case JSHTMLDocument::WriteLn: {
-            // DOM only specifies single string argument, but NS & IE allow multiple
-            // or no arguments
-            String str = "";
-            for (int i = 0; i < args.size(); i++)
-                str += args[i]->toString(exec);
-            if (id == JSHTMLDocument::WriteLn)
-                str += "\n";
-            doc.write(str);
-            return jsUndefined();
-        }
-        case JSHTMLDocument::GetElementsByName:
-            return toJS(exec, doc.getElementsByName(args[0]->toString(exec)).get());
-        case JSHTMLDocument::CaptureEvents:
-        case JSHTMLDocument::ReleaseEvents:
-            // Do nothing for now. These are NS-specific legacy calls.
-            break;
-    }
-    
-    return jsUndefined();
-}
-
-
-// FIXME: functions should be in the prototype
-const ClassInfo JSHTMLDocument::info =
-  { "DOMHTMLDocument", &JSDocument::info, &HTMLDocumentTable, 0 };
-/* Source for HTMLDocumentTable. Use "make hashtables" to regenerate.
-@begin HTMLDocumentTable 30
-  title                 JSHTMLDocument::Title             DontDelete
-  referrer              JSHTMLDocument::Referrer          DontDelete|ReadOnly
-  domain                JSHTMLDocument::Domain            DontDelete
-  body                  JSHTMLDocument::Body              DontDelete
-  location              JSHTMLDocument::Location          DontDelete
-  cookie                JSHTMLDocument::Cookie            DontDelete
-  images                JSHTMLDocument::Images            DontDelete|ReadOnly
-  embeds                JSHTMLDocument::Embeds            DontDelete|ReadOnly
-  plugins               JSHTMLDocument::Embeds            DontDelete|ReadOnly
-  applets               JSHTMLDocument::Applets           DontDelete|ReadOnly
-  links                 JSHTMLDocument::Links             DontDelete|ReadOnly
-  forms                 JSHTMLDocument::Forms             DontDelete|ReadOnly
-  anchors               JSHTMLDocument::Anchors           DontDelete|ReadOnly
-  scripts               JSHTMLDocument::Scripts           DontDelete|ReadOnly
-  all                   JSHTMLDocument::All               
-  bgColor               JSHTMLDocument::BgColor           DontDelete
-  fgColor               JSHTMLDocument::FgColor           DontDelete
-  alinkColor            JSHTMLDocument::AlinkColor        DontDelete
-  linkColor             JSHTMLDocument::LinkColor         DontDelete
-  vlinkColor            JSHTMLDocument::VlinkColor        DontDelete
-  lastModified          JSHTMLDocument::LastModified      DontDelete|ReadOnly
-  height                JSHTMLDocument::Height            DontDelete|ReadOnly
-  width                 JSHTMLDocument::Width             DontDelete|ReadOnly
-  dir                   JSHTMLDocument::Dir               DontDelete
-  designMode            JSHTMLDocument::DesignMode        DontDelete
-#potentially obsolete array properties
-# layers
-# plugins
-# tags
-#potentially obsolete properties
-# embeds
-# ids
-@end
-*/
-
-JSHTMLDocument::JSHTMLDocument(ExecState* exec, HTMLDocument *d)
-  : JSDocument(exec, d)
-{
-    setPrototype(JSHTMLDocumentPrototype::self(exec));
-}
-
-JSValue *JSHTMLDocument::namedItemGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
-{
-  JSHTMLDocument *thisObj = static_cast<JSHTMLDocument*>(slot.slotBase());
-  HTMLDocument &doc = *static_cast<HTMLDocument*>(thisObj->impl());
-
-  String name = propertyName;
-  RefPtr<HTMLCollection> collection = doc.documentNamedItems(name);
-
-  if (collection->length() == 1) {
-    Node* node = collection->firstItem();
-    Frame *frame;
-    if (node->hasTagName(iframeTag) && (frame = static_cast<HTMLIFrameElement*>(node)->contentFrame()))
-      return Window::retrieve(frame);
-    return toJS(exec, node);
-  } else if (collection->length() == 0)
-      return jsUndefined();
-
-  return getHTMLCollection(exec, collection.get());
-}
-
-JSValue *JSHTMLDocument::getValueProperty(ExecState* exec, int token) const
-{
-  HTMLDocument& doc = *static_cast<HTMLDocument*>(impl());
-
-  FrameView* view = doc.view();
-  Frame* frame = doc.frame();
-
-  HTMLElement* body = doc.body();
-  HTMLBodyElement* bodyElement = (body && body->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(body) : 0;
-    
-  switch (token) {
-  case Title:
-    return jsString(doc.title());
-  case Referrer:
-    return jsString(doc.referrer());
-  case Domain:
-    return jsString(doc.domain());
-  case Body:
-    return toJS(exec, body);
-  case Location:
-    if (!frame)
-      return jsNull();
-    if (Window* win = Window::retrieveWindow(frame))
-      return win->location();
-    return jsUndefined();
-  case Cookie:
-    return jsString(doc.cookie());
-  case Images:
-    return getHTMLCollection(exec, doc.images().get());
-  case Embeds:
-    return getHTMLCollection(exec, doc.embeds().get());
-  case Applets:
-    return getHTMLCollection(exec, doc.applets().get());
-  case Links:
-    return getHTMLCollection(exec, doc.links().get());
-  case Forms:
-    return getHTMLCollection(exec, doc.forms().get());
-  case Anchors:
-    return getHTMLCollection(exec, doc.anchors().get());
-  case Scripts:
-    return getHTMLCollection(exec, doc.scripts().get());
-  case All:
-    // If "all" has been overwritten, return the overwritten value
-    if (JSValue *v = getDirect("all"))
-      return v;
-    else
-      return getAllHTMLCollection(exec, doc.all().get());
-  case BgColor:
-    if (!bodyElement)
-      return jsUndefined();
-    return jsString(bodyElement->bgColor());
-  case FgColor:
-    if (!bodyElement)
-      return jsUndefined();
-    return jsString(bodyElement->text());
-  case AlinkColor:
-    if (!bodyElement)
-      return jsUndefined();
-    return jsString(bodyElement->aLink());
-  case LinkColor:
-    if (!bodyElement)
-      return jsUndefined();
-    return jsString(bodyElement->link());
-  case VlinkColor:
-    if (!bodyElement)
-      return jsUndefined();
-    return jsString(bodyElement->vLink());
-  case LastModified:
-    return jsString(doc.lastModified());
-  case Height:
-    return jsNumber(view ? view->contentsHeight() : 0);
-  case Width:
-    return jsNumber(view ? view->contentsWidth() : 0);
-  case Dir:
-    if (!body)
-      return jsString("");
-    return jsString(body->dir());
-  case DesignMode:
-    return jsString(doc.inDesignMode() ? "on" : "off");
-  default:
-    ASSERT(0);
-    return jsUndefined();
-  }
-}
-
-bool JSHTMLDocument::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
-{
-  HTMLDocument &doc = *static_cast<HTMLDocument*>(impl());
-
-  String name = propertyName;
-  if (doc.hasNamedItem(name) || doc.hasDocExtraNamedItem(name)) {
-    slot.setCustom(this, namedItemGetter);
-    return true;
-  }
-
-  return getStaticValueSlot<JSHTMLDocument, JSDocument>(exec, &HTMLDocumentTable, this, propertyName, slot);
-}
-
-void JSHTMLDocument::put(ExecState* exec, const Identifier &propertyName, JSValue *value, int attr)
-{
-    lookupPut<JSHTMLDocument, JSDocument>(exec, propertyName, value, attr, &HTMLDocumentTable, this);
-}
-
-void JSHTMLDocument::putValueProperty(ExecState* exec, int token, JSValue *value, int /*attr*/)
-{
-  DOMExceptionTranslator exception(exec);
-  HTMLDocument &doc = *static_cast<HTMLDocument*>(impl());
-  HTMLElement* body = doc.body();
-  HTMLBodyElement* bodyElement = (body && body->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(body) : 0;
-
-  switch (token) {
-  case Title:
-    doc.setTitle(valueToStringWithNullCheck(exec, value));
-    break;
-  case Body:
-    doc.setBody(toHTMLElement(value), exception);
-    break;
-  case Domain: // not part of the DOM
-    doc.setDomain(value->toString(exec));
-    break;
-  case Cookie:
-    doc.setCookie(valueToStringWithNullCheck(exec, value));
-    break;
-  case Location:
-    if (Frame* frame = doc.frame()) {
-      DeprecatedString str = value->toString(exec);
-
-      // When assigning location, IE and Mozilla both resolve the URL
-      // relative to the frame where the JavaScript is executing not
-      // the target frame.
-      Frame* activeFrame = static_cast<ScriptInterpreter*>( exec->dynamicInterpreter() )->frame();
-      if (activeFrame)
-        str = activeFrame->document()->completeURL(str);
-
-      // We want a new history item if this JS was called via a user gesture
-      bool userGesture = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->wasRunByUserGesture();
-      frame->loader()->scheduleLocationChange(str, activeFrame->loader()->outgoingReferrer(), !userGesture);
-    }
-    break;
-  case BgColor:
-    if (bodyElement)
-      bodyElement->setBgColor(valueToStringWithNullCheck(exec, value));
-    break;
-  case FgColor:
-    if (bodyElement)
-      bodyElement->setText(valueToStringWithNullCheck(exec, value));
-    break;
-  case AlinkColor:
-    if (bodyElement) {
-      // this check is a bit silly, but some benchmarks like to set the
-      // document's link colors over and over to the same value and we
-      // don't want to incur a style update each time.
-      String newColor = valueToStringWithNullCheck(exec, value);
-      if (bodyElement->aLink() != newColor)
-        bodyElement->setALink(newColor);
-    }
-    break;
-  case LinkColor:
-    if (bodyElement) {
-      // this check is a bit silly, but some benchmarks like to set the
-      // document's link colors over and over to the same value and we
-      // don't want to incur a style update each time.
-      String newColor = valueToStringWithNullCheck(exec, value);
-      if (bodyElement->link() != newColor)
-        bodyElement->setLink(newColor);
-    }
-    break;
-  case VlinkColor:
-    if (bodyElement) {
-      // this check is a bit silly, but some benchmarks like to set the
-      // document's link colors over and over to the same value and we
-      // don't want to incur a style update each time.
-      String newColor = valueToStringWithNullCheck(exec, value);
-      if (bodyElement->vLink() != newColor)
-        bodyElement->setVLink(newColor);
-    }
-    break;
-  case Dir:
-    if (body)
-      body->setDir(valueToStringWithNullCheck(exec, value));
-    break;
-  case DesignMode:
-    {
-      String modeString = valueToStringWithNullCheck(exec, value);
-      Document::InheritedBool mode;
-      if (equalIgnoringCase(modeString, "on"))
-        mode = Document::on;
-      else if (equalIgnoringCase(modeString, "off"))
-        mode = Document::off;
-      else
-        mode = Document::inherit;
-      doc.setDesignMode(mode);
-      break;
-    }
-  case All:
-    // Add "all" to the property map.
-    putDirect("all", value);
-    break;
-  }
-}
-
-// -------------------------------------------------------------------------
-
 const ClassInfo JSHTMLElement::info = { "HTMLElement", &JSElement::info, &HTMLElementTable, 0 };
 
 const ClassInfo JSHTMLElement::embed_info = { "HTMLEmbedElement", &JSHTMLElement::info, &HTMLEmbedElementTable, 0 };
index c11ab40222c3e15c2b69d3a966ea832f3ff758a4..e58a0d1d9da8e51668220262db9b09db5093991b 100644 (file)
@@ -37,25 +37,6 @@ namespace KJS {
 
   class JSAbstractEventListener;
 
-  KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE(JSHTMLDocumentPrototype, WebCore::JSDocumentPrototype)
-
-  class JSHTMLDocument : public WebCore::JSDocument {
-  public:
-    JSHTMLDocument(ExecState*, WebCore::HTMLDocument*);
-    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
-    JSValue* getValueProperty(ExecState*, int token) const;
-    virtual void put(ExecState*, const Identifier& propertyName, JSValue*, int attr = None);
-    void putValueProperty(ExecState*, int token, JSValue*, int /*attr*/);
-    virtual const ClassInfo* classInfo() const { return &info; }
-    static const ClassInfo info;
-    enum { Title, Referrer, Domain, Body, Location, Cookie,
-           Images, Applets, Embeds, Links, Forms, Anchors, Scripts, All, Clear, Open, Close,
-           Write, WriteLn, GetElementsByName, CaptureEvents, ReleaseEvents,
-           BgColor, FgColor, AlinkColor, LinkColor, VlinkColor, LastModified, Height, Width, Dir, DesignMode };
-  private:
-    static JSValue* namedItemGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
-  };
-
   // The inheritance chain for JSHTMLElement is a bit different from other
   // classes that are "half-autogenerated". Because we return different ClassInfo structs
   // depending on the type of element, we inherit JSHTMLElement from WebCore::JSHTMLElement
index 8eee0cd021fdc257a7da29349d0d7577b9dca489..f0919c49f7ae171b630b1273199a4bd43ea2c8ac 100644 (file)
@@ -42,6 +42,7 @@
 #import <WebCore/DOMHTMLAreaElementPrivate.h>
 #import <WebCore/DOMHTMLBodyElementPrivate.h>
 #import <WebCore/DOMHTMLButtonElementPrivate.h>
+#import <WebCore/DOMHTMLDocumentPrivate.h>
 #import <WebCore/DOMHTMLFormElementPrivate.h>
 #import <WebCore/DOMHTMLFrameElementPrivate.h>
 #import <WebCore/DOMHTMLImageElementPrivate.h>
index 44cbec8bbee9372df1d8a674c79ab2a259260984..06778dc67771461788629008b83a9d0916e7c406 100644 (file)
@@ -3,7 +3,7 @@
 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
 # Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org>
 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
-# Copyright (C) 2006 Apple Computer, Inc.
+# Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
 #
 # This file is part of the KDE project
 #
@@ -572,8 +572,10 @@ sub GenerateImplementation
                                        : WK_ucfirst($attribute->signature->name) . "AttrNum");
             push(@hashValues, $value);
 
-            my $special = "DontDelete";
-            $special .= "|ReadOnly" if ($attribute->type =~ /readonly/);
+            my @specials = ();
+            push(@specials, "DontDelete") unless $attribute->signature->extendedAttributes->{"Deletable"};
+            push(@specials, "ReadOnly") if $attribute->type =~ /readonly/;
+            my $special = (@specials > 0) ? join("|", @specials) : "0";
             push(@hashSpecials, $special);
 
             my $numParameters = "0";
@@ -652,7 +654,10 @@ sub GenerateImplementation
         my $value = $className . "::" . WK_ucfirst($name) . "FuncNum";
         push(@hashValues, $value);
 
-        my $special = "DontDelete|Function";
+        my @specials = ();
+        push(@specials, "DontDelete") unless $function->signature->extendedAttributes->{"Deletable"};
+        push(@specials, "Function");        
+        my $special = (@specials > 0) ? join("|", @specials) : "0";
         push(@hashSpecials, $special);
 
         my $numParameters = @{$function->parameters};
@@ -785,12 +790,6 @@ sub GenerateImplementation
             push(@implContent, "    }\n");
         }
 
-        if ($dataNode->extendedAttributes->{"HasNameGetter"} || $dataNode->extendedAttributes->{"HasOverridingNameGetter"}) {
-            # if it has a prototype, we need to check that first too
-            push(@implContent, "    if (prototype()->isObject() && static_cast<JSObject*>(prototype())->hasProperty(exec, propertyName))\n");
-            push(@implContent, "        return false;\n");
-        }
-
         if ($dataNode->extendedAttributes->{"HasIndexGetter"}) {
             push(@implContent, "    bool ok;\n");
             push(@implContent, "    unsigned u = propertyName.toUInt32(&ok);\n");
@@ -1422,8 +1421,13 @@ sub NativeToJSValue
     } elsif ($type eq "Event") {
         $implIncludes{"kjs_events.h"} = 1;
         $implIncludes{"Event.h"} = 1;
-    } elsif ($type eq "NodeList" or $type eq "NamedNodeMap") {
+    } elsif ($type eq "NodeList") {
+        $implIncludes{"kjs_dom.h"} = 1;
+        $implIncludes{"NodeList.h"} = 1;
+        $implIncludes{"NameNodeList.h"} = 1;
+    } elsif ($type eq "NamedNodeMap") {
         $implIncludes{"kjs_dom.h"} = 1;
+        $implIncludes{"NamedNodeMap.h"} = 1;
     } elsif ($type eq "CSSStyleSheet" or $type eq "StyleSheet" or $type eq "MediaList") {
         $implIncludes{"CSSStyleSheet.h"} = 1;
         $implIncludes{"MediaList.h"} = 1;
index 54b72527c82bfa35c4f6433ecd771a741ef225d4..3b18ba3c6ee253a4c881753189f88ccdd23f8995 100644 (file)
@@ -3329,6 +3329,12 @@ PassRefPtr<HTMLCollection> Document::embeds()
     return new HTMLCollection(this, HTMLCollection::DocEmbeds);
 }
 
+PassRefPtr<HTMLCollection> Document::plugins()
+{
+    // This is an alias for embeds() required for the JS DOM bindings.
+    return new HTMLCollection(this, HTMLCollection::DocEmbeds);
+}
+
 PassRefPtr<HTMLCollection> Document::objects()
 {
     return new HTMLCollection(this, HTMLCollection::DocObjects);
index 3752efeea74c826cfed2370a7387caf8f91c8bea..505413ff41bad5d6a565043301e7b5a0a28ceb9c 100644 (file)
@@ -207,6 +207,7 @@ public:
 
     PassRefPtr<HTMLCollection> images();
     PassRefPtr<HTMLCollection> embeds();
+    PassRefPtr<HTMLCollection> plugins(); // an alias for embeds() required for the JS DOM bindings.
     PassRefPtr<HTMLCollection> applets();
     PassRefPtr<HTMLCollection> links();
     PassRefPtr<HTMLCollection> forms();
index 7612b697f84e6eaed4d4689ee9fdb7ad8220c25b..3a6b8860aee4ddc021b93f224147591ffa03632c 100644 (file)
@@ -61,6 +61,8 @@
 #include "ExceptionCode.h"
 #include "Frame.h"
 #include "FrameLoader.h"
+#include "FrameView.h"
+#include "HTMLBodyElement.h"
 #include "HTMLElement.h"
 #include "HTMLElementFactory.h"
 #include "HTMLNames.h"
@@ -116,6 +118,168 @@ void HTMLDocument::setBody(HTMLElement* newBody, ExceptionCode& ec)
         documentElement()->replaceChild(newBody, b, ec);
 }
 
+int HTMLDocument::width() const
+{
+    FrameView* frameView = view();
+    return frameView ? frameView->contentsWidth() : 0;
+}
+
+int HTMLDocument::height() const
+{
+    FrameView* frameView = view();
+    return frameView ? frameView->contentsHeight() : 0;
+}
+
+String HTMLDocument::dir()
+{
+    HTMLElement* b = body();
+    if (!b)
+        return String();
+    return b->dir();
+}
+
+void HTMLDocument::setDir(const String& value)
+{
+    HTMLElement* b = body();
+    if (b)
+        b->setDir(value);
+}
+
+String HTMLDocument::designMode() const
+{
+    return inDesignMode() ? "on" : "off";
+}
+
+void HTMLDocument::setDesignMode(const String& value)
+{
+    InheritedBool mode;
+    if (equalIgnoringCase(value, "on"))
+        mode = on;
+    else if (equalIgnoringCase(value, "off"))
+        mode = off;
+    else
+        mode = inherit;
+    Document::setDesignMode(mode);
+}
+
+String HTMLDocument::bgColor()
+{
+    HTMLElement* b = body();
+    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
+
+    if (!bodyElement)
+        return String();
+    return bodyElement->bgColor();
+}
+
+void HTMLDocument::setBgColor(const String& value)
+{
+    HTMLElement* b = body();
+    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
+
+    if (bodyElement)
+        bodyElement->setBgColor(value);
+}
+
+String HTMLDocument::fgColor()
+{
+    HTMLElement* b = body();
+    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
+
+    if (!bodyElement)
+        return String();
+    return bodyElement->text();
+}
+
+void HTMLDocument::setFgColor(const String& value)
+{
+    HTMLElement* b = body();
+    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
+
+    if (bodyElement)
+        bodyElement->setText(value);
+}
+
+String HTMLDocument::alinkColor()
+{
+    HTMLElement* b = body();
+    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
+
+    if (!bodyElement)
+        return String();
+    return bodyElement->aLink();
+}
+
+void HTMLDocument::setAlinkColor(const String& value)
+{
+    HTMLElement* b = body();
+    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
+
+    if (bodyElement) {
+        // This check is a bit silly, but some benchmarks like to set the
+        // document's link colors over and over to the same value and we
+        // don't want to incur a style update each time.
+        if (bodyElement->aLink() != value)
+            bodyElement->setALink(value);
+    }
+}
+
+String HTMLDocument::linkColor()
+{
+    HTMLElement* b = body();
+    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
+
+    if (!bodyElement)
+        return String();
+    return bodyElement->link();
+}
+
+void HTMLDocument::setLinkColor(const String& value)
+{
+    HTMLElement* b = body();
+    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
+
+    if (bodyElement) {
+        // This check is a bit silly, but some benchmarks like to set the
+        // document's link colors over and over to the same value and we
+        // don't want to incur a style update each time.
+        if (bodyElement->link() != value)
+            bodyElement->setLink(value);
+    }
+}
+
+String HTMLDocument::vlinkColor()
+{
+    HTMLElement* b = body();
+    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
+
+    if (!bodyElement)
+        return String();
+    return bodyElement->vLink();
+}
+
+void HTMLDocument::setVlinkColor(const String& value)
+{
+    HTMLElement* b = body();
+    HTMLBodyElement* bodyElement = (b && b->hasTagName(bodyTag)) ? static_cast<HTMLBodyElement*>(b) : 0;
+
+    if (bodyElement) {
+        // This check is a bit silly, but some benchmarks like to set the
+        // document's link colors over and over to the same value and we
+        // don't want to incur a style update each time.
+        if (bodyElement->vLink() != value)
+            bodyElement->setVLink(value);
+    }
+}
+
+void HTMLDocument::captureEvents()
+{
+}
+
+void HTMLDocument::releaseEvents()
+{
+}
+
 Tokenizer *HTMLDocument::createTokenizer()
 {
     return new HTMLTokenizer(this);
index 08c7342c72fbf607a76c7f3f5166796d0b0c94c3..220471eab5aa6e570c30717817ad310f15b7df8e 100644 (file)
@@ -44,6 +44,29 @@ public:
 
     void setBody(HTMLElement*, ExceptionCode&);
 
+    int width() const;
+    int height() const;
+
+    String dir();
+    void setDir(const String&);
+
+    String designMode() const;
+    void setDesignMode(const String&);
+
+    String bgColor();
+    void setBgColor(const String&);
+    String fgColor();
+    void setFgColor(const String&);
+    String alinkColor();
+    void setAlinkColor(const String&);
+    String linkColor();
+    void setLinkColor(const String&);
+    String vlinkColor();
+    void setVlinkColor(const String&);
+
+    void captureEvents();
+    void releaseEvents();
+
     virtual Tokenizer* createTokenizer();
 
     virtual bool childAllowed(Node*);
index af804e1d81ca8f887638b48890d169b221f172a2..e7b0ac2e32ba9e76e43282534bece7726a5fc285 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
 
 module html {
 
-    interface [LegacyParent=KJS::JSHTMLDocument, GenerateConstructor] HTMLDocument : Document {
-#if !defined(LANGUAGE_JAVASCRIPT)
+    interface [GenerateConstructor, HasOverridingNameGetter] HTMLDocument : Document {
                  attribute [ConvertNullToNullString] DOMString title;
         readonly attribute DOMString referrer;
+#if defined(LANGUAGE_JAVASCRIPT)
+                 attribute DOMString domain;
+#else
         readonly attribute DOMString domain;
+#endif
         readonly attribute DOMString URL;
                 
         // FIXME: the DOM spec does NOT have this attribute
@@ -43,17 +46,45 @@ module html {
                  attribute [ConvertNullToNullString] DOMString cookie
                      /*setter raises (DOMException)*/;
 
-        void               open();
-        void               close();
-        void               write(in DOMString text);
-        void               writeln(in DOMString text);
-        NodeList           getElementsByName(in DOMString elementName);
+        [Custom] void open();
+        void close();
+        [Custom] void write(in DOMString text);
+        [Custom] void writeln(in DOMString text);
+        NodeList getElementsByName(in DOMString elementName);
+
+        // Extensions
+        Element getElementById(in DOMString elementId);
+
+        readonly attribute HTMLCollection embeds;
+        readonly attribute HTMLCollection plugins;
+        readonly attribute HTMLCollection scripts;
+
+        readonly attribute DOMString lastModified;
+
+#if defined(LANGUAGE_JAVASCRIPT)
+        // FIXME: These should eventually be available (if they are wanted) for all languages.
 
-        // non-standard
+                 attribute [Custom, Deletable] HTMLCollection all;
 
-        Element            getElementById(in DOMString elementId);
+                 attribute [Custom] Window location;
+
+        [Custom] void clear();
 #endif
+
+        void captureEvents();
+        void releaseEvents();
+
+        readonly attribute long width;
+        readonly attribute long height;
+                 attribute [ConvertNullToNullString] DOMString dir;
+                 attribute [ConvertNullToNullString] DOMString designMode;
+
+        // Deprecated attributes
+                 attribute [ConvertNullToNullString] DOMString bgColor;
+                 attribute [ConvertNullToNullString] DOMString fgColor;
+                 attribute [ConvertNullToNullString] DOMString alinkColor;
+                 attribute [ConvertNullToNullString] DOMString linkColor;
+                 attribute [ConvertNullToNullString] DOMString vlinkColor;
     };
 
 }
-    
index 5857bcf48fb8526feeb850802fd5168112cc666d..275fa5e5345253405740ffb31a707f2565b1ca40 100644 (file)
@@ -1,3 +1,14 @@
+2007-05-23  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Darin.
+
+        Patch for http://bugs.webkit.org/show_bug.cgi?id=13830
+        Auto-generate JS DOM bindings for HTMLDocument and most of the rest
+        of HTMLElement
+
+        * MigrateHeaders.make: add DOMHTMLDocumentPrivate.h
+        * WebKit.xcodeproj/project.pbxproj:
+
 2007-05-23  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Geoff.
index 411d8f2f3a0ba35e8b6dd90fe01f05642792e188..f86dae867bf47ad815f40ed2562644a0e02b4b1f 100644 (file)
@@ -93,6 +93,7 @@ all : \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLDirectoryElement.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLDivElement.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLDocument.h \
+    $(PRIVATE_HEADERS_DIR)/DOMHTMLDocumentPrivate.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLElement.h \
     $(INTERNAL_HEADERS_DIR)/DOMHTMLElementInternal.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLEmbedElement.h \
index e2d191921cc60456242d6bca810d28a84d04231f..8a9e808ff7851f3fd1491fc65ce86766cc5b7a04 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
                        projectRoot = "";
-                       shouldCheckCompatibility = 1;
                        targets = (
                                9398100A0824BF01008DF038 /* WebKit */,
                        );