WebCore:
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 May 2006 11:38:55 +0000 (11:38 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 May 2006 11:38:55 +0000 (11:38 +0000)
2006-05-11  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Darin.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=7838
        Add support for mozilla-style node constructors as properties of the window object

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

        * bindings/js/JSCanvasRenderingContext2DBase.cpp:
        (WebCore::JSCanvasRenderingContext2DBaseProtoFunc::callAsFunction):
        * bindings/js/JSHTMLElementWrapperFactory.cpp:
        (WebCore::createJSWrapper):
        Specify the KJS namespace for JSHTMLElmement.

        * bindings/js/kjs_dom.cpp:
        (KJS::toJS):
        Create a WebCore::JSHTMLDocument for document nodes. Also, create
        JSDocumentFragments for document fragments (instead of plain node objects).

        * bindings/js/kjs_html.cpp:
        (KJS::JSHTMLDocumentProtoFunc::callAsFunction):
        (KJS::JSHTMLDocument::JSHTMLDocument):
        (KJS::JSHTMLDocument::getOwnPropertySlot):
        Add a prototype for JSHTMLDocument and move all functions there.

        (KJS::JSHTMLElement::JSHTMLElement):
        (KJS::JSHTMLElement::getOwnPropertySlot):
        Update since JSHTMLElement now inherits from WebCore::JSHTMLElement.

        (KJS::JSHTMLElement::getValueProperty):
        (KJS::JSHTMLElement::putValueProperty):
        Remove title setter and getter. Those are autogenerated now.

        * bindings/js/kjs_html.h:
        (KJS::JSHTMLElement::):
        Inherit from WebCore::JSHTMLElement. Clarify the inheritance chain.

        * bindings/scripts/CodeGeneratorJS.pm:
        Always generate a prototype object, regardless of whether the object has any functions or
        constants.

        Use the type of generator attributes to determine what constructor to use. This is useful for
        the XMLDocument property in DOMWindow.idl, since that's just an alias for the Document constructor.

        * dom/DocumentFragment.idl: Added.
        * html/HTMLDocument.idl: Added.
        * html/HTMLElement.idl: Added.

        * page/DOMWindow.idl:
        Add constructors for DocumentFragment, HTMLElement, HTMLDocument and XMLDocument. XMLDocument is just
        an alias for the Document constructor.

LayoutTests:

2006-05-11  Anders Carlsson  <acarlsson@apple.com>

        Reviewed by Darin.

        http://bugzilla.opendarwin.org/show_bug.cgi?id=7838
        Add support for mozilla-style node constructors as properties of the window object

        * fast/dom/prototype-chain-expected.txt:
        Update prototype chains.

        * fast/dom/global-constructors-expected.txt:
        * fast/dom/global-constructors.html:
        Test new constructor objects.

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

17 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/global-constructors-expected.txt
LayoutTests/fast/dom/global-constructors.html
LayoutTests/fast/dom/prototype-chain-expected.txt
WebCore/ChangeLog
WebCore/DerivedSources.make
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/JSCanvasRenderingContext2DBase.cpp
WebCore/bindings/js/JSHTMLElementWrapperFactory.cpp
WebCore/bindings/js/kjs_dom.cpp
WebCore/bindings/js/kjs_html.cpp
WebCore/bindings/js/kjs_html.h
WebCore/bindings/scripts/CodeGeneratorJS.pm
WebCore/dom/DocumentFragment.idl [new file with mode: 0644]
WebCore/html/HTMLDocument.idl [new file with mode: 0644]
WebCore/html/HTMLElement.idl [new file with mode: 0644]
WebCore/page/DOMWindow.idl

index 4512f5fd663ea8c0646a2128afd4c991be101a07..d7ac846a9227ff9883b80002380a9ba851e63c2a 100644 (file)
@@ -1,3 +1,17 @@
+2006-05-11  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Darin.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=7838
+        Add support for mozilla-style node constructors as properties of the window object
+
+        * fast/dom/prototype-chain-expected.txt:
+        Update prototype chains.
+
+        * fast/dom/global-constructors-expected.txt:
+        * fast/dom/global-constructors.html:
+        Test new constructor objects.
+        
 2006-05-10  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by darin
index 02ebb278e941b6972fbd0e66e39f2e24a0371667..d07286c331ee9b9650f5557493b712ba4776b208 100644 (file)
@@ -1,8 +1,10 @@
 This page tests global constructor objects like window.HTMLDocument. If it passes, you'll see a series of 'PASS' messages below.
 
 PASS: window.Document.prototype.isPrototypeOf(document) should be true and is.
+PASS: window.HTMLDocument.prototype.isPrototypeOf(document) should be true and is.
 PASS: window.Node.prototype.isPrototypeOf(element) should be true and is.
 PASS: window.Element.prototype.isPrototypeOf(element) should be true and is.
+PASS: window.HTMLElement.prototype.isPrototypeOf(element) should be true and is.
 PASS: window.Range.prototype.isPrototypeOf(range) should be true and is.
 PASS: window.CSSRule.prototype.isPrototypeOf(cssRule) should be true and is.
 PASS: window.CSSValue.prototype.isPrototypeOf(cssPrimitiveValue) should be true and is.
@@ -10,6 +12,10 @@ PASS: window.CSSPrimitiveValue.prototype.isPrototypeOf(cssPrimitiveValue) should
 PASS: window.CSSStyleDeclaration.prototype.isPrototypeOf(cssStyleDeclaration) should be true and is.
 PASS: window.Event.prototype.isPrototypeOf(event) should be true and is.
 PASS: window.MutationEvent.prototype.isPrototypeOf(event) should be true and is.
+PASS: window.XMLDocument.prototype.isPrototypeOf(xmldoc) should be true and is.
+PASS: window.DocumentFragment.prototype.isPrototypeOf(fragment) should be true and is.
+PASS: window.XPathEvaluator.prototype.isPrototypeOf(xpathevaluator) should be true and is.
+PASS: window.XPathResult.prototype.isPrototypeOf(xpathresult) should be true and is.
 PASS: window.NodeFilter.prototype.isPrototypeOf(nodeFilter) should be true and is.
 [Deleted window.Node.prototype]
 PASS: window.Node.prototype should be undefined and is.
index d9c66d1b30284c1a717be3d055e73f54f86f857d..c52bc2f80e6b0f4f0a473d59606111816a1b7c02 100644 (file)
@@ -39,10 +39,12 @@ function test()
         layoutTestController.dumpAsText();
         
     shouldBe("window.Document.prototype.isPrototypeOf(document)", true);
-
+    shouldBe("window.HTMLDocument.prototype.isPrototypeOf(document)", true);
+    
     element = document.body;
     shouldBe("window.Node.prototype.isPrototypeOf(element)", true);
     shouldBe("window.Element.prototype.isPrototypeOf(element)", true);
+    shouldBe("window.HTMLElement.prototype.isPrototypeOf(element)", true);
     
     range = document.createRange();
     shouldBe("window.Range.prototype.isPrototypeOf(range)", true);
@@ -61,6 +63,18 @@ function test()
     shouldBe("window.Event.prototype.isPrototypeOf(event)", true);
     shouldBe("window.MutationEvent.prototype.isPrototypeOf(event)", true);
 
+    xmldoc = document.implementation.createDocument(null, null, null);
+    shouldBe("window.XMLDocument.prototype.isPrototypeOf(xmldoc)", true);
+    
+    fragment = document.createDocumentFragment();
+    shouldBe("window.DocumentFragment.prototype.isPrototypeOf(fragment)", true);
+    
+    xpathevaluator = new XPathEvaluator();
+    shouldBe("window.XPathEvaluator.prototype.isPrototypeOf(xpathevaluator)", true);
+    
+    xpathresult = xpathevaluator.evaluate('/', document, null, 0, null);
+    shouldBe("window.XPathResult.prototype.isPrototypeOf(xpathresult)", true);
+    
     try {
       nodeFilter = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, function () {}, false).filter;
     } catch(e) {}
index 88c320ee91723dd1335e1c5afc8a3e057011f134..018b12803faf670bb5feff034c5fca44cd98c208 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] (5 prototypes) -----
+----- [object HTMLDocument] (7 prototypes) -----
 
 [object Object]
 
@@ -14,7 +14,11 @@ NOTE: This test will start failing if you change the layout of a related prototy
 
 [object Document]
 
------ [object DIV] (5 prototypes) -----
+[object HTMLDocument]
+
+[object HTMLDocument]
+
+----- [object DIV] (7 prototypes) -----
 
 [object Object]
 
@@ -26,6 +30,10 @@ NOTE: This test will start failing if you change the layout of a related prototy
 
 [object Element]
 
+[object HTMLElement]
+
+[object HTMLElement]
+
 ----- [object UIEvent] (4 prototypes) -----
 
 [object Object]
index 6a17c583b37a080e292daa8fdc089eb708cda4e0..493e08e3886cf636d53e674acf1eb04bbdb189b7 100644 (file)
@@ -1,3 +1,58 @@
+2006-05-11  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Darin.
+
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=7838
+        Add support for mozilla-style node constructors as properties of the window object
+        
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        Add new generated files.
+        
+        * bindings/js/JSCanvasRenderingContext2DBase.cpp:
+        (WebCore::JSCanvasRenderingContext2DBaseProtoFunc::callAsFunction):
+        * bindings/js/JSHTMLElementWrapperFactory.cpp:
+        (WebCore::createJSWrapper):
+        Specify the KJS namespace for JSHTMLElmement.
+                
+        * bindings/js/kjs_dom.cpp:
+        (KJS::toJS):
+        Create a WebCore::JSHTMLDocument for document nodes. Also, create
+        JSDocumentFragments for document fragments (instead of plain node objects).
+        
+        * bindings/js/kjs_html.cpp:
+        (KJS::JSHTMLDocumentProtoFunc::callAsFunction):
+        (KJS::JSHTMLDocument::JSHTMLDocument):
+        (KJS::JSHTMLDocument::getOwnPropertySlot):
+        Add a prototype for JSHTMLDocument and move all functions there.
+        
+        (KJS::JSHTMLElement::JSHTMLElement):
+        (KJS::JSHTMLElement::getOwnPropertySlot):
+        Update since JSHTMLElement now inherits from WebCore::JSHTMLElement.
+        
+        (KJS::JSHTMLElement::getValueProperty):
+        (KJS::JSHTMLElement::putValueProperty):
+        Remove title setter and getter. Those are autogenerated now.
+        
+        * bindings/js/kjs_html.h:
+        (KJS::JSHTMLElement::):
+        Inherit from WebCore::JSHTMLElement. Clarify the inheritance chain.
+        
+        * bindings/scripts/CodeGeneratorJS.pm:
+        Always generate a prototype object, regardless of whether the object has any functions or
+        constants.
+        
+        Use the type of generator attributes to determine what constructor to use. This is useful for
+        the XMLDocument property in DOMWindow.idl, since that's just an alias for the Document constructor.
+        
+        * dom/DocumentFragment.idl: Added.        
+        * html/HTMLDocument.idl: Added.
+        * html/HTMLElement.idl: Added.
+        
+        * page/DOMWindow.idl:
+        Add constructors for DocumentFragment, HTMLElement, HTMLDocument and XMLDocument. XMLDocument is just
+        an alias for the Document constructor.
+        
 2006-05-11  David Hyatt  <hyatt@apple.com>
 
         Bug 8845.  Define a TextRun (similar to the old WebCoreTextRun) and
 
         * WebCore: Removed an extra WebCore subtree that somehow got checked in.
 
+>>>>>>> .r14297
 2006-05-10  David Carson <dacarson@gmail.com>
 
         - Fix for bug 8833. Removed inline keyword from functions declared
index 3e4b36fc2fa0a63fcfce509343541c29134f8e2f..47b0ce400ea34fc3014a98ce27067ea94dd93022 100644 (file)
@@ -58,11 +58,14 @@ all : \
     JSDOMParser.lut.h \
     JSDOMWindow.h \
     JSDocument.h \
+    JSDocumentFragment.h \
     JSDocumentType.h \
     JSElement.h \
     JSEvent.h \
     JSEntity.h \
+    JSHTMLDocument.h \
     JSHTMLCanvasElement.h \
+    JSHTMLElement.h \
     JSKeyboardEvent.h \
     JSMouseEvent.h \
     JSMutationEvent.h \
index 893fc30096b047fae95cb55cd0bbb76f10b91673..5e9fabd36e9dc1d32224fe2eebc5ae555c273f58 100644 (file)
                14E8378E09F85D4F00B85AE4 /* JSEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 14E8378D09F85D4F00B85AE4 /* JSEvent.h */; };
                14EC267F09CA07E000E1EEEC /* EventTargetNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 14EC267D09CA07E000E1EEEC /* EventTargetNode.h */; };
                14EC268009CA07E000E1EEEC /* EventTargetNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14EC267E09CA07E000E1EEEC /* EventTargetNode.cpp */; };
+               1A494BBC0A122DCD00FDAFC1 /* HTMLElement.idl in Resources */ = {isa = PBXBuildFile; fileRef = 1A494BBB0A122DCD00FDAFC1 /* HTMLElement.idl */; };
+               1A494BFA0A122F4400FDAFC1 /* JSHTMLElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A494BF80A122F4400FDAFC1 /* JSHTMLElement.cpp */; };
+               1A494BFB0A122F4400FDAFC1 /* JSHTMLElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A494BF90A122F4400FDAFC1 /* JSHTMLElement.h */; };
+               1A494E2A0A12354300FDAFC1 /* HTMLDocument.idl in Resources */ = {isa = PBXBuildFile; fileRef = 1A494E290A12354300FDAFC1 /* HTMLDocument.idl */; };
+               1A494E340A12358B00FDAFC1 /* JSHTMLDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A494E320A12358A00FDAFC1 /* JSHTMLDocument.cpp */; };
+               1A494E350A12358B00FDAFC1 /* JSHTMLDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A494E330A12358B00FDAFC1 /* JSHTMLDocument.h */; };
+               1A494ED60A123F1A00FDAFC1 /* DocumentFragment.idl in Resources */ = {isa = PBXBuildFile; fileRef = 1A494ED50A123F1A00FDAFC1 /* DocumentFragment.idl */; };
+               1A494EDE0A123F4C00FDAFC1 /* JSDocumentFragment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A494EDC0A123F4C00FDAFC1 /* JSDocumentFragment.cpp */; };
+               1A494EDF0A123F4C00FDAFC1 /* JSDocumentFragment.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A494EDD0A123F4C00FDAFC1 /* JSDocumentFragment.h */; };
                1A5D938E0A0B9ACC00B1121F /* XPathParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A5D938C0A0B9ACC00B1121F /* XPathParser.cpp */; };
                1A5D938F0A0B9ACC00B1121F /* XPathParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A5D938D0A0B9ACC00B1121F /* XPathParser.h */; };
                1A6931760A0CD4FA00C127FE /* XPathValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6931740A0CD4FA00C127FE /* XPathValue.h */; };
                14E8378D09F85D4F00B85AE4 /* JSEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSEvent.h; sourceTree = "<group>"; };
                14EC267D09CA07E000E1EEEC /* EventTargetNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventTargetNode.h; sourceTree = "<group>"; };
                14EC267E09CA07E000E1EEEC /* EventTargetNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventTargetNode.cpp; sourceTree = "<group>"; };
+               1A494BBB0A122DCD00FDAFC1 /* HTMLElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLElement.idl; sourceTree = "<group>"; };
+               1A494BF80A122F4400FDAFC1 /* JSHTMLElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLElement.cpp; sourceTree = "<group>"; };
+               1A494BF90A122F4400FDAFC1 /* JSHTMLElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLElement.h; sourceTree = "<group>"; };
+               1A494E290A12354300FDAFC1 /* HTMLDocument.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLDocument.idl; sourceTree = "<group>"; };
+               1A494E320A12358A00FDAFC1 /* JSHTMLDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLDocument.cpp; sourceTree = "<group>"; };
+               1A494E330A12358B00FDAFC1 /* JSHTMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLDocument.h; sourceTree = "<group>"; };
+               1A494ED50A123F1A00FDAFC1 /* DocumentFragment.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DocumentFragment.idl; sourceTree = "<group>"; };
+               1A494EDC0A123F4C00FDAFC1 /* JSDocumentFragment.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSDocumentFragment.cpp; sourceTree = "<group>"; };
+               1A494EDD0A123F4C00FDAFC1 /* JSDocumentFragment.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSDocumentFragment.h; sourceTree = "<group>"; };
                1A5D938C0A0B9ACC00B1121F /* XPathParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = XPathParser.cpp; sourceTree = "<group>"; };
                1A5D938D0A0B9ACC00B1121F /* XPathParser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = XPathParser.h; sourceTree = "<group>"; };
                1A6931740A0CD4FA00C127FE /* XPathValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathValue.h; sourceTree = "<group>"; };
                                14CF78A509F58CD800EB3665 /* JSCSSValue.h */,
                                659DDC8009E198BA001BF3C6 /* JSDocument.cpp */,
                                659DDC8109E198BA001BF3C6 /* JSDocument.h */,
+                               1A494EDC0A123F4C00FDAFC1 /* JSDocumentFragment.cpp */,
+                               1A494EDD0A123F4C00FDAFC1 /* JSDocumentFragment.h */,
                                65DF31E109D1CC60000BE325 /* JSDocumentType.cpp */,
                                65DF31E209D1CC60000BE325 /* JSDocumentType.h */,
                                65DF31E309D1CC60000BE325 /* JSDOMImplementation.cpp */,
                                14E8378D09F85D4F00B85AE4 /* JSEvent.h */,
                                938E665F09F09B81008A48EC /* JSHTMLCanvasElement.cpp */,
                                938E666109F09B87008A48EC /* JSHTMLCanvasElement.h */,
+                               1A494E320A12358A00FDAFC1 /* JSHTMLDocument.cpp */,
+                               1A494E330A12358B00FDAFC1 /* JSHTMLDocument.h */,
+                               1A494BF80A122F4400FDAFC1 /* JSHTMLElement.cpp */,
+                               1A494BF90A122F4400FDAFC1 /* JSHTMLElement.h */,
                                A86629CE09DA2B47009633A5 /* JSKeyboardEvent.cpp */,
                                A86629CD09DA2B47009633A5 /* JSKeyboardEvent.h */,
                                A86629CC09DA2B47009633A5 /* JSMouseEvent.cpp */,
                                F523D23C02DE4396018635CA /* HTMLDocument.h */,
                                F523D23E02DE4396018635CA /* HTMLElement.cpp */,
                                F523D23F02DE4396018635CA /* HTMLElement.h */,
+                               1A494BBB0A122DCD00FDAFC1 /* HTMLElement.idl */,
                                BCEF3432087B563E00BBF833 /* HTMLElementFactory.cpp */,
                                BCEF3433087B563E00BBF833 /* HTMLElementFactory.h */,
                                A81369B9097374F500D74463 /* HTMLFieldSetElement.cpp */,
                                AB23A31109BBA7760067CC53 /* HTMLTextFieldInnerElement.h */,
                                F523D25202DE4396018635CA /* HTMLTokenizer.cpp */,
                                F523D25302DE4396018635CA /* HTMLTokenizer.h */,
+                               1A494E290A12354300FDAFC1 /* HTMLDocument.idl */,
                        );
                        path = html;
                        sourceTree = "<group>";
                                F523D30A02DE4476018635CA /* xml_tokenizer.h */,
                                14E836D209F8512000B85AE4 /* Event.idl */,
                                14DC0D0B09FECFA4007B0235 /* Node.idl */,
+                               1A494ED50A123F1A00FDAFC1 /* DocumentFragment.idl */,
                        );
                        path = dom;
                        sourceTree = "<group>";
                                1A5D938F0A0B9ACC00B1121F /* XPathParser.h in Headers */,
                                1A6931760A0CD4FA00C127FE /* XPathValue.h in Headers */,
                                1A6938020A11100A00C127FE /* TextDocument.h in Headers */,
+                               1A494BFB0A122F4400FDAFC1 /* JSHTMLElement.h in Headers */,
+                               1A494E350A12358B00FDAFC1 /* JSHTMLDocument.h in Headers */,
+                               1A494EDF0A123F4C00FDAFC1 /* JSDocumentFragment.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                14E836D309F8512000B85AE4 /* Event.idl in Resources */,
                                14DC0D0C09FECFA4007B0235 /* Node.idl in Resources */,
                                142011AF0A003117008303F9 /* CSSStyleDeclaration.idl in Resources */,
+                               1A494BBC0A122DCD00FDAFC1 /* HTMLElement.idl in Resources */,
+                               1A494E2A0A12354300FDAFC1 /* HTMLDocument.idl in Resources */,
+                               1A494ED60A123F1A00FDAFC1 /* DocumentFragment.idl in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                BCCD13200A0C0030001AFA8B /* FontData.mm in Sources */,
                                1A6931770A0CD4FA00C127FE /* XPathValue.cpp in Sources */,
                                1A6938010A11100A00C127FE /* TextDocument.cpp in Sources */,
+                               1A494BFA0A122F4400FDAFC1 /* JSHTMLElement.cpp in Sources */,
+                               1A494E340A12358B00FDAFC1 /* JSHTMLDocument.cpp in Sources */,
+                               1A494EDE0A123F4C00FDAFC1 /* JSDocumentFragment.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 9d4858bc391a7d1163be3f387b87b8fde58001f7..fb762ef0225e47a165086c0e4f255c20566a24f4 100644 (file)
@@ -31,6 +31,8 @@
 #include "JSCanvasRenderingContext2D.h"
 #include "JSHTMLCanvasElement.h"
 
+#include "kjs_html.h"
+
 #include "JSCanvasRenderingContext2DBaseTable.cpp"
 
 using namespace KJS;
@@ -190,7 +192,7 @@ JSValue* JSCanvasRenderingContext2DBaseProtoFunc::callAsFunction(ExecState* exec
             if (!o->isObject())
                 return throwError(exec, TypeError);
             ExceptionCode ec;
-            if (o->inherits(&JSHTMLElement::img_info)) {
+            if (o->inherits(&KJS::JSHTMLElement::img_info)) {
                 HTMLImageElement* imgElt = static_cast<HTMLImageElement*>(static_cast<JSHTMLElement*>(args[0])->impl());
                 switch (args.size()) {
                     case 3:
@@ -243,7 +245,7 @@ JSValue* JSCanvasRenderingContext2DBaseProtoFunc::callAsFunction(ExecState* exec
             JSObject* o = static_cast<JSObject*>(args[0]);
             if (!o->isObject())
                 return throwError(exec, TypeError);
-            if (!o->inherits(&JSHTMLElement::img_info))
+            if (!o->inherits(&KJS::JSHTMLElement::img_info))
                 return throwError(exec, TypeError);
             context->drawImageFromRect(static_cast<HTMLImageElement*>(static_cast<JSHTMLElement*>(args[0])->impl()),
                 args[1]->toNumber(exec), args[2]->toNumber(exec),
@@ -257,7 +259,7 @@ JSValue* JSCanvasRenderingContext2DBaseProtoFunc::callAsFunction(ExecState* exec
             JSObject* o = static_cast<JSObject*>(args[0]);
             if (!o->isObject())
                 return throwError(exec, TypeError);
-            if (o->inherits(&JSHTMLElement::img_info)) {
+            if (o->inherits(&KJS::JSHTMLElement::img_info)) {
                 ExceptionCode ec;
                 JSValue* pattern = toJS(exec,
                     context->createPattern(static_cast<HTMLImageElement*>(static_cast<JSHTMLElement*>(args[0])->impl()),
index 7f33ecb48b5974f16eb312ebd6b4d5951224a555..104560ea07f811759fe6c6b4b347993690d96584 100644 (file)
@@ -22,6 +22,7 @@
 #include "HTMLCanvasElement.h"
 #include "HTMLNames.h"
 #include "JSHTMLCanvasElement.h"
+#include "JSHTMLElement.h"
 #include "kjs_html.h"
 
 using namespace KJS;
@@ -46,7 +47,7 @@ DOMNode* createJSWrapper(ExecState* exec, PassRefPtr<HTMLElement> element)
     CreateHTMLElementWrapperFunction f = map.get(element->localName().impl());
     if (f)
         return f(exec, element);
-    return new JSHTMLElement(exec, element.get());
+    return new KJS::JSHTMLElement(exec, element.get());
 }
 
 }
index 10a24b5eccb703bcd5eff743d4e1d99c6e5bb6fb..160e09a3d78e1c55ead596776272ae667cd9ec80 100644 (file)
 #include "JSElement.h"
 #include "JSCharacterData.h"
 #include "JSDOMImplementation.h"
+#include "JSDocumentFragment.h"
 #include "JSDocumentType.h"
 #include "JSEntity.h"
+#include "JSHTMLDocument.h"
 #include "JSNode.h"
 #include "JSNotation.h"
 #include "JSProcessingInstruction.h"
@@ -926,7 +928,7 @@ JSValue* toJS(ExecState *exec, Document *n)
     return ret;
 
   if (n->isHTMLDocument())
-    ret = new JSHTMLDocument(exec, static_cast<HTMLDocument *>(n));
+    ret = new WebCore::JSHTMLDocument(exec, static_cast<HTMLDocument *>(n));
   else
     ret = new JSDocument(exec, n);
 
@@ -995,6 +997,8 @@ JSValue* toJS(ExecState *exec, PassRefPtr<WebCore::Node> node)
       ret = new JSNotation(exec, static_cast<Notation *>(n));
       break;
     case WebCore::Node::DOCUMENT_FRAGMENT_NODE:
+      ret = new JSDocumentFragment(exec, static_cast<DocumentFragment*>(n));
+      break;
     case WebCore::Node::ENTITY_REFERENCE_NODE:
     default:
       ret = new JSNode(exec, n);
index cde55730a95fc0a3dd8a190111ae60e699a113fd..ee694e0dbaf6520377a3883fa56dda551df1cf85 100644 (file)
@@ -72,62 +72,76 @@ private:
   int id;
 };
 
-KJS_IMPLEMENT_PROTOFUNC(HTMLDocFunction)
+/* 
+@begin JSHTMLDocumentProtoTable 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_PROTOFUNC(JSHTMLDocumentProtoFunc)
+KJS_IMPLEMENT_PROTOTYPE("HTMLDocument", JSHTMLDocumentProto, JSHTMLDocumentProtoFunc)
 
-JSValue *HTMLDocFunction::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)
+JSValue *JSHTMLDocumentProtoFunc::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);
+    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();
         }
-      }
-      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;
     }
-    // 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 =
   { "HTMLDocument", &JSDocument::info, &HTMLDocumentTable, 0 };
@@ -149,14 +163,6 @@ const ClassInfo JSHTMLDocument::info =
   anchors               JSHTMLDocument::Anchors           DontDelete|ReadOnly
   scripts               JSHTMLDocument::Scripts           DontDelete|ReadOnly
   all                   JSHTMLDocument::All               
-  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
   bgColor               JSHTMLDocument::BgColor           DontDelete
   fgColor               JSHTMLDocument::FgColor           DontDelete
   alinkColor            JSHTMLDocument::AlinkColor        DontDelete
@@ -180,6 +186,7 @@ const ClassInfo JSHTMLDocument::info =
 JSHTMLDocument::JSHTMLDocument(ExecState *exec, HTMLDocument *d)
   : JSDocument(exec, d)
 {
+    setPrototype(JSHTMLDocumentProto::self(exec));
 }
 
 JSValue *JSHTMLDocument::namedItemGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
@@ -301,12 +308,11 @@ bool JSHTMLDocument::getOwnPropertySlot(ExecState *exec, const Identifier& prope
     return true;
   }
 
+  return getStaticValueSlot<JSHTMLDocument, JSDocument>(exec, &HTMLDocumentTable, this, propertyName, slot);
+
   const HashEntry* entry = Lookup::findEntry(&HTMLDocumentTable, propertyName);
   if (entry) {
-    if (entry->attr & Function)
-      slot.setStaticEntry(this, entry, staticFunctionGetter<HTMLDocFunction>);
-    else 
-      slot.setStaticEntry(this, entry, staticValueGetter<JSHTMLDocument>);
+    slot.setStaticEntry(this, entry, staticValueGetter<JSHTMLDocument>);
     return true;
   }
 
@@ -695,7 +701,6 @@ const JSHTMLElement::Accessors* JSHTMLElement::accessors() const
 
 @begin HTMLElementTable 14
   id            KJS::JSHTMLElement::ElementId     DontDelete
-  title         KJS::JSHTMLElement::ElementTitle  DontDelete
   lang          KJS::JSHTMLElement::ElementLang   DontDelete
   dir           KJS::JSHTMLElement::ElementDir    DontDelete
 ### isn't this "class" in the HTML spec?
@@ -1187,8 +1192,9 @@ JSValue* JSHTMLElementProtoFunc::callAsFunction(ExecState*, JSObject*, const Lis
 }
 
 JSHTMLElement::JSHTMLElement(ExecState *exec, HTMLElement *e)
-    : JSElement(exec, e)
+    : WebCore::JSHTMLElement(exec, e)
 {
+    setPrototype(JSHTMLElementProto::self(exec));
 }
 
 JSValue *JSHTMLElement::formIndexGetter(ExecState *exec, JSObject *originalObject, const Identifier& propertyName, const PropertySlot& slot)
@@ -1323,7 +1329,7 @@ bool JSHTMLElement::getOwnPropertySlot(ExecState *exec, const Identifier& proper
     }
 
     // Base JSHTMLElement stuff or parent class forward, as usual
-    return getStaticPropertySlot<HTMLElementFunction, JSHTMLElement, JSElement>(exec, &HTMLElementTable, this, propertyName, slot);
+    return getStaticPropertySlot<HTMLElementFunction, JSHTMLElement, WebCore::JSHTMLElement>(exec, &HTMLElementTable, this, propertyName, slot);
 }
 
 bool JSHTMLElement::implementsCall() const
@@ -2159,8 +2165,6 @@ JSValue *JSHTMLElement::getValueProperty(ExecState *exec, int token) const
             // iht.com relies on this value being "" when no id is present. Other browsers do this as well.
             // So we use jsString() instead of jsStringOrNull() here.
             return jsString(element.id());
-        case ElementTitle:
-            return jsString(element.title());
         case ElementLang:
             return jsString(element.lang());
         case ElementDir:
@@ -3149,9 +3153,6 @@ void JSHTMLElement::putValueProperty(ExecState *exec, int token, JSValue *value,
         case ElementId:
             element.setId(str);
             return;
-        case ElementTitle:
-            element.setTitle(str);
-            return;
         case ElementLang:
             element.setLang(str);
             return;
index 9014027da19e198c6e1acc8aec84d5eb15e06c58..9ab31bd61f77555c8e43cae3b8d55b015be3d40f 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "JSDocument.h"
 #include "JSElement.h"
+#include "JSHTMLElement.h"
 
 namespace WebCore {
     class HTMLCollection;
@@ -38,6 +39,8 @@ namespace KJS {
 
   class JSAbstractEventListener;
 
+  KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE(JSHTMLDocumentProto, WebCore::JSDocumentProto)
+
   class JSHTMLDocument : public WebCore::JSDocument {
   public:
     JSHTMLDocument(ExecState *exec, WebCore::HTMLDocument *d);
@@ -55,9 +58,13 @@ namespace KJS {
     static JSValue *namedItemGetter(ExecState *, JSObject *, const Identifier&, const PropertySlot&);
   };
 
-  KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE(JSHTMLElementProto, WebCore::JSElementProto)
+  // 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
+  // instead of the other way around. 
+  KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE(JSHTMLElementProto, WebCore::JSHTMLElementProto)
 
-  class JSHTMLElement : public WebCore::JSElement {
+  class JSHTMLElement : public WebCore::JSHTMLElement {
   public:
     JSHTMLElement(ExecState *exec, WebCore::HTMLElement *e);
     virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
@@ -282,7 +289,7 @@ namespace KJS {
            IFrameMarginHeight, IFrameMarginWidth, IFrameScrolling, IFrameWidth, IFrameContentDocument, IFrameContentWindow,
            MarqueeStart, MarqueeStop,
            GetContext,
-           ElementInnerHTML, ElementTitle, ElementId, ElementDir, ElementLang,
+           ElementInnerHTML, ElementId, ElementDir, ElementLang,
            ElementClassName, ElementInnerText, ElementDocument, ElementChildren, ElementContentEditable,
            ElementIsContentEditable, ElementOuterHTML, ElementOuterText};
   private:
index 3b02ceb8661e22644c01684535541da48a58d291..321e03d6ed3e2e662060445ee3b0e34c80665639 100644 (file)
@@ -159,6 +159,7 @@ sub AddIncludesForType
       $type eq "DocumentType" or 
       $type eq "Element" or
       $type eq "HTMLCanvasElement" or
+      $type eq "HTMLElement" or 
       $type eq "Node" or
       $type eq "NodeList" or 
       $type eq "Range" or 
@@ -370,36 +371,36 @@ sub GenerateHeader
   }
 
   # Add prototype declaration -- code adopted from the KJS_DEFINE_PROTOTYPE and KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE macros
+  push(@headerContent, "class ${className}Proto : public KJS::JSObject {\n");
+  if (!$dataNode->extendedAttributes->{"DoNotCache"}) {
+      push(@headerContent, "    friend KJS::JSObject* KJS_GCC_ROOT_NS_HACK cacheGlobalObject<${className}Proto>(KJS::ExecState*, const KJS::Identifier& propertyName);\n");
+  }
+  push(@headerContent, "public:\n");
+  if ($dataNode->extendedAttributes->{"DoNotCache"}) {
+      push(@headerContent, "    static KJS::JSObject* self();\n");
+  } else {
+      push(@headerContent, "    static KJS::JSObject* self(KJS::ExecState* exec);\n");
+  }
+  push(@headerContent, "    virtual const KJS::ClassInfo* classInfo() const { return &info; }\n");
+  push(@headerContent, "    static const KJS::ClassInfo info;\n");
   if ($numFunctions > 0 || $numConstants > 0) {
-      push(@headerContent, "class ${className}Proto : public KJS::JSObject {\n");
-      if (!$dataNode->extendedAttributes->{"DoNotCache"}) {
-          push(@headerContent, "    friend KJS::JSObject* KJS_GCC_ROOT_NS_HACK cacheGlobalObject<${className}Proto>(KJS::ExecState*, const KJS::Identifier& propertyName);\n");
-      }
-      push(@headerContent, "public:\n");
-      if ($dataNode->extendedAttributes->{"DoNotCache"}) {
-          push(@headerContent, "    static KJS::JSObject* self();\n");
-      } else {
-          push(@headerContent, "    static KJS::JSObject* self(KJS::ExecState* exec);\n");
-      }
-      push(@headerContent, "    virtual const KJS::ClassInfo* classInfo() const { return &info; }\n");
-      push(@headerContent, "    static const KJS::ClassInfo info;\n");
       push(@headerContent, "    bool getOwnPropertySlot(KJS::ExecState*, const KJS::Identifier&, KJS::PropertySlot&);\n");
-      if ($numConstants ne 0) {
-          push(@headerContent, "    KJS::JSValue* getValueProperty(KJS::ExecState*, int token) const;\n");
-      }
-      push(@headerContent, "protected:\n");
-      if ($dataNode->extendedAttributes->{"DoNotCache"}) {
-          push(@headerContent, "    ${className}Proto() { }\n");
+  }
+  if ($numConstants ne 0) {
+      push(@headerContent, "    KJS::JSValue* getValueProperty(KJS::ExecState*, int token) const;\n");
+  }
+  push(@headerContent, "protected:\n");
+  if ($dataNode->extendedAttributes->{"DoNotCache"}) {
+      push(@headerContent, "    ${className}Proto() { }\n");
+  } else {
+      push(@headerContent, "    ${className}Proto(KJS::ExecState* exec)\n");
+      if ($hasParent && $parentClassName ne "KJS::DOMCSSRule" && $parentClassName ne "KJS::DOMNodeFilter") {
+          push(@headerContent, "        : KJS::JSObject(${parentClassName}Proto::self(exec)) { }\n");
       } else {
-          push(@headerContent, "    ${className}Proto(KJS::ExecState* exec)\n");
-          if ($hasParent && $parentClassName ne "KJS::DOMCSSRule" && $parentClassName ne "KJS::DOMNodeFilter") {
-              push(@headerContent, "        : KJS::JSObject(${parentClassName}Proto::self(exec)) { }\n");
-          } else {
-              push(@headerContent, "        : KJS::JSObject(exec->lexicalInterpreter()->builtinObjectPrototype()) { }\n");
-          }
+          push(@headerContent, "        : KJS::JSObject(exec->lexicalInterpreter()->builtinObjectPrototype()) { }\n");
       }
-      push(@headerContent, "};\n\n");
   }
+  push(@headerContent, "};\n\n");
   
   push(@headerContent, "}\n\n#endif\n");
 }
@@ -497,90 +498,84 @@ sub GenerateImplementation
                                \@hashSpecials, \@hashParameters);
 
     my $protoClassName;
-    if ($numFunctions ne 0 || $numConstants ne 0) {
-      $protoClassName = "${className}Proto";
-    } else {
-      # Since we have no functions or constants, we won't have generated 
-      # our own prototype -- use our parent's instead
-      $protoClassName = "${parentClassName}Proto";
-    }
+    $protoClassName = "${className}Proto";
 
     push(@implContent, constructorFor($className, $protoClassName, $interfaceName, $dataNode->extendedAttributes->{"CanBeConstructed"}));
   }
   
   # - Add functions and constants to a hashtable definition
-  if ($numFunctions > 0 || $numConstants > 0) {
-    $hashSize = $numFunctions + $numConstants;
-    $hashName = $className . "ProtoTable";
+  $hashSize = $numFunctions + $numConstants;
+  $hashName = $className . "ProtoTable";
 
-    @hashKeys = ();
-    @hashValues = ();
-    @hashSpecials = ();
-    @hashParameters = ();
+  @hashKeys = ();
+  @hashValues = ();
+  @hashSpecials = ();
+  @hashParameters = ();
 
-    foreach my $constant (@{$dataNode->constants}) {
-        my $name = $constant->name;
-        push(@hashKeys, $name);
+  foreach my $constant (@{$dataNode->constants}) {
+      my $name = $constant->name;
+      push(@hashKeys, $name);
         
-        my $value = "${implClassName}::$name";
-        push(@hashValues, $value);
+      my $value = "${implClassName}::$name";
+      push(@hashValues, $value);
         
-        my $special = "DontDelete|ReadOnly";
-        push(@hashSpecials, $special);
+      my $special = "DontDelete|ReadOnly";
+      push(@hashSpecials, $special);
         
-        my $numParameters = 0;
-        push(@hashParameters, $numParameters); 
-    }
+      my $numParameters = 0;
+      push(@hashParameters, $numParameters); 
+  }
     
-    foreach my $function (@{$dataNode->functions}) {
-      my $name = $function->signature->name;
-      push(@hashKeys, $name);
+  foreach my $function (@{$dataNode->functions}) {
+    my $name = $function->signature->name;
+    push(@hashKeys, $name);
     
-      my $value = $className . "::" . ucfirst($name) . "FuncNum";
-      push(@hashValues, $value);
+    my $value = $className . "::" . ucfirst($name) . "FuncNum";
+    push(@hashValues, $value);
     
-      my $special = "DontDelete|Function";
-      push(@hashSpecials, $special);
+    my $special = "DontDelete|Function";
+    push(@hashSpecials, $special);
     
-      my $numParameters = @{$function->parameters};
-      push(@hashParameters, $numParameters);
-    }
+    my $numParameters = @{$function->parameters};
+    push(@hashParameters, $numParameters);
+  }
     
-    $object->GenerateHashTable($hashName, $hashSize,
-                               \@hashKeys, \@hashValues,
-                               \@hashSpecials, \@hashParameters);
+  $object->GenerateHashTable($hashName, $hashSize,
+                             \@hashKeys, \@hashValues,
+                             \@hashSpecials, \@hashParameters);
 
-    if($numFunctions > 0) {
-        push(@implContent, protoFuncFor($className));
-    }
+  if($numFunctions > 0) {
+      push(@implContent, protoFuncFor($className));
+  }
 
-    push(@implContent, "const ClassInfo ${className}Proto::info = { \"$interfaceName\", 0, &${className}ProtoTable, 0 };\n\n");
-    if ($dataNode->extendedAttributes->{"DoNotCache"}) {
-        push(@implContent, "JSObject* ${className}Proto::self()\n");
-        push(@implContent, "{\n");
-        push(@implContent, "    return new ${className}Proto();\n");
-        push(@implContent, "}\n\n");
-    } else {
-        push(@implContent, "JSObject* ${className}Proto::self(ExecState* exec)\n");
-        push(@implContent, "{\n");
-        push(@implContent, "    return ::cacheGlobalObject<${className}Proto>(exec, \"[[${className}.prototype]]\");\n");
-        push(@implContent, "}\n\n");
-    }
-    push(@implContent, "bool ${className}Proto::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n");
-    push(@implContent, "{\n");
-    if ($numConstants eq 0) {
-        push(@implContent, "    return getStaticFunctionSlot<${className}ProtoFunc, JSObject>(exec, &${className}ProtoTable, this, propertyName, slot);\n");
-    } elsif ($numFunctions eq 0) {
-        push(@implContent, "    return getStaticValueSlot<${className}Proto, JSObject>(exec, &${className}ProtoTable, this, propertyName, slot);\n");
-    } else {
-        push(@implContent, "    return getStaticPropertySlot<${className}ProtoFunc, ${className}Proto, JSObject>(exec, &${className}ProtoTable, this, propertyName, slot);\n");
-    }
-    push(@implContent, "}\n\n");
-    if ($numConstants ne 0) {
-        push(@implContent, "JSValue* ${className}Proto::getValueProperty(ExecState*, int token) const\n{\n");
-        push(@implContent, "    // The token is the numeric value of its associated constant\n");
-        push(@implContent, "    return jsNumber(token);\n}\n\n");
-    }
+  push(@implContent, "const ClassInfo ${className}Proto::info = { \"$interfaceName\", 0, &${className}ProtoTable, 0 };\n\n");
+  if ($dataNode->extendedAttributes->{"DoNotCache"}) {
+      push(@implContent, "JSObject* ${className}Proto::self()\n");
+      push(@implContent, "{\n");
+      push(@implContent, "    return new ${className}Proto();\n");
+      push(@implContent, "}\n\n");
+  } else {
+      push(@implContent, "JSObject* ${className}Proto::self(ExecState* exec)\n");
+      push(@implContent, "{\n");
+      push(@implContent, "    return ::cacheGlobalObject<${className}Proto>(exec, \"[[${className}.prototype]]\");\n");
+      push(@implContent, "}\n\n");
+  }
+  if ($numConstants > 0 || $numFunctions > 0) {
+      push(@implContent, "bool ${className}Proto::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n");
+      push(@implContent, "{\n");
+      if ($numConstants eq 0) {
+          push(@implContent, "    return getStaticFunctionSlot<${className}ProtoFunc, JSObject>(exec, &${className}ProtoTable, this, propertyName, slot);\n");
+      } elsif ($numFunctions eq 0) {
+          push(@implContent, "    return getStaticValueSlot<${className}Proto, JSObject>(exec, &${className}ProtoTable, this, propertyName, slot);\n");
+      } else {
+          push(@implContent, "    return getStaticPropertySlot<${className}ProtoFunc, ${className}Proto, JSObject>(exec, &${className}ProtoTable, this, propertyName, slot);\n");
+      }
+      push(@implContent, "}\n\n");
+  }
+  if ($numConstants ne 0) {
+      push(@implContent, "JSValue* ${className}Proto::getValueProperty(ExecState*, int token) const\n{\n");
+      push(@implContent, "    // The token is the numeric value of its associated constant\n");
+      push(@implContent, "    return jsNumber(token);\n}\n\n");
   }
   
   # - Initialize static ClassInfo object
@@ -613,10 +608,8 @@ sub GenerateImplementation
   
   if ($dataNode->extendedAttributes->{"DoNotCache"}) {
       push(@implContent, "{\n    setPrototype(${className}Proto::self());\n}\n\n");
-  } elsif ($numFunctions ne 0 || $numConstants ne 0) {
-      push(@implContent, "{\n    setPrototype(${className}Proto::self(exec));\n}\n\n");
   } else {
-      push(@implContent, "{\n}\n\n");    
+      push(@implContent, "{\n    setPrototype(${className}Proto::self(exec));\n}\n\n");
   }
   
   # Destructor
@@ -650,10 +643,13 @@ sub GenerateImplementation
 
     foreach my $attribute (@{$dataNode->attributes}) {
       my $name = $attribute->signature->name;
-
+        
       if ($attribute->signature->type =~ /Constructor$/) {
+        my $constructorType = $attribute->signature->type;
+        $constructorType =~ s/Constructor$//;
+
         push(@implContent, "    case " . $name . "ConstructorAttrNum:\n");
-        push(@implContent, "        return JS" . $name . "::getConstructor(exec);\n");
+        push(@implContent, "        return JS" . $constructorType . "::getConstructor(exec);\n");
       } elsif (!@{$attribute->getterExceptions}) {
         push(@implContent, "    case " . ucfirst($name) . "AttrNum:\n");
         push(@implContent, "        return " . NativeToJSValue($attribute->signature, "impl->$name()") . ";\n");
@@ -688,7 +684,10 @@ sub GenerateImplementation
         if ($attribute->type !~ /^readonly/) {
           my $name = $attribute->signature->name;
           if ($attribute->signature->type =~ /Constructor$/) {
-              $implIncludes{"JS" . $attribute->signature->name . ".h"} = 1;
+              my $constructorType = $attribute->signature->type;
+              $constructorType =~ s/Constructor$//;
+
+              $implIncludes{"JS" . $constructorType . ".h"} = 1;
               push(@implContent, "    case " . $name ."ConstructorAttrNum: {\n");
               push(@implContent, "        // Shadowing a built-in constructor\n");
 
diff --git a/WebCore/dom/DocumentFragment.idl b/WebCore/dom/DocumentFragment.idl
new file mode 100644 (file)
index 0000000..9f34305
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * 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 core {
+
+    interface [LegacyParent=KJS::DOMEventTargetNode, GenerateConstructor] DocumentFragment : EventTargetNode {
+    };
+
+}
diff --git a/WebCore/html/HTMLDocument.idl b/WebCore/html/HTMLDocument.idl
new file mode 100644 (file)
index 0000000..6a664d8
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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 html {
+
+    interface [LegacyParent=KJS::JSHTMLDocument, GenerateConstructor] HTMLDocument : Document {
+    };
+
+}
+    
diff --git a/WebCore/html/HTMLElement.idl b/WebCore/html/HTMLElement.idl
new file mode 100644 (file)
index 0000000..d0e8421
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * 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 html {
+
+    interface [GenerateConstructor] HTMLElement : Element {
+        attribute DOMString title;
+    };
+
+}
index 61bcfd9eb509672775314cb888fe7f8143e39dc3..c21e991c8eccd6753d8a06fb612a225f21cbe1c1 100644 (file)
@@ -46,12 +46,20 @@ module window {
         attribute CSSStyleDeclarationConstructor CSSStyleDeclaration;
         attribute CSSValueConstructor CSSValue;
         attribute DocumentConstructor Document;
+        attribute DocumentFragmentConstructor DocumentFragment;
         attribute ElementConstructor Element;
         attribute EventConstructor Event;
+        attribute HTMLElementConstructor HTMLElement;
+        attribute HTMLDocumentConstructor HTMLDocument;
         attribute MutationEventConstructor MutationEvent;
         attribute NodeConstructor Node;
         attribute NodeFilterConstructor NodeFilter;
         attribute RangeConstructor Range;
+        
+        // Mozilla has a separate XMLDocument object for XML documents. 
+        // We just use Document for this.
+        attribute DocumentConstructor XMLDocument;
+
         attribute XPathEvaluatorConstructor XPathEvaluator;
         attribute XPathResultConstructor XPathResult;
     };