Changeset 22039 in webkit
- Timestamp:
- Jun 6, 2007 9:28:36 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 10 added
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r22038 r22039 1 2007-06-06 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Hyatt. 4 5 Update tests for http://bugs.webkit.org/show_bug.cgi?id=13973 6 Autogenerate most of the rest of kjs_dom.h/cpp 7 8 * fast/dom/Window/window-properties-expected.txt: 9 * fast/dom/prototype-chain-expected.txt: 10 1 11 2007-06-06 Justin Garcia <justin.garcia@apple.com> 2 12 -
trunk/LayoutTests/fast/dom/Window/window-properties-expected.txt
r22035 r22039 679 679 window.MutationEvent.REMOVAL [number] 680 680 window.MutationEvent.prototype [printed above as window.Event.prototype] 681 window.NamedNodeMap [object NamedNodeMapConstructor] 682 window.NamedNodeMap.prototype [object NamedNodeMapPrototype] 683 window.NamedNodeMap.prototype.getNamedItem [function] 684 window.NamedNodeMap.prototype.getNamedItemNS [function] 685 window.NamedNodeMap.prototype.item [function] 686 window.NamedNodeMap.prototype.removeNamedItem [function] 687 window.NamedNodeMap.prototype.removeNamedItemNS [function] 688 window.NamedNodeMap.prototype.setNamedItem [function] 689 window.NamedNodeMap.prototype.setNamedItemNS [function] 681 690 window.Node [object NodeConstructor] 682 691 window.Node.ATTRIBUTE_NODE [number] … … 754 763 window.NodeFilter.prototype.SHOW_TEXT [number] 755 764 window.NodeFilter.prototype.acceptNode [function] 765 window.NodeList [object NodeListConstructor] 766 window.NodeList.prototype [object NodeListPrototype] 767 window.NodeList.prototype.item [function] 756 768 window.Notation [object NotationConstructor] 757 769 window.Notation.prototype [printed above as window.Node.prototype] -
trunk/LayoutTests/fast/dom/prototype-chain-expected.txt
r21842 r22039 11 11 [object NodePrototype] 12 12 13 [object DOMEventTargetNodePrototype]13 [object EventTargetNodePrototype] 14 14 15 15 [object DocumentPrototype] … … 25 25 [object NodePrototype] 26 26 27 [object DOMEventTargetNodePrototype]27 [object EventTargetNodePrototype] 28 28 29 29 [object ElementPrototype] … … 41 41 [object NodePrototype] 42 42 43 [object DOMEventTargetNodePrototype]43 [object EventTargetNodePrototype] 44 44 45 45 [object ElementPrototype] -
trunk/WebCore/ChangeLog
r22038 r22039 1 2007-06-06 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Hyatt. 4 5 Patch for http://bugs.webkit.org/show_bug.cgi?id=13973 6 Autogenerate most of the rest of kjs_dom.h/cpp 7 8 - Autogenerate JSNodeList and JSNamedNodeMap. 9 - Move JSEventTargetNode, JSNamedNodesCollection, and JSDOMExceptionConstructor 10 into their own files. 11 - Rename KJS::DOMEventTargeNode to WebCore::JSEventTargetNode to adhere 12 to convention and allow easier code generation. 13 - Add JS constructors for JSNodeList and JSNamedNodeMap. 14 - Moved more toJS methods into the correct (corresponding) header files. 15 - Cleaned up code in order for changes to work. 16 17 * DerivedSources.make: 18 * WebCore.xcodeproj/project.pbxproj: 19 * bindings/js/JSDOMExceptionConstructor.cpp: Added. 20 (WebCore::): 21 (WebCore::JSDOMExceptionConstructor::JSDOMExceptionConstructor): 22 (WebCore::JSDOMExceptionConstructor::getOwnPropertySlot): 23 (WebCore::JSDOMExceptionConstructor::getValueProperty): 24 (WebCore::getDOMExceptionConstructor): 25 * bindings/js/JSDOMExceptionConstructor.h: Added. 26 (WebCore::JSDOMExceptionConstructor::classInfo): 27 * bindings/js/JSDOMWindowCustom.cpp: Added. 28 (WebCore::JSDOMWindow::customGetOwnPropertySlot): 29 * bindings/js/JSDocumentCustom.cpp: 30 (WebCore::JSDocument::mark): 31 (WebCore::toJS): 32 * bindings/js/JSEventTargetNode.cpp: Added. 33 (WebCore::JSEventTargetNode::JSEventTargetNode): 34 (WebCore::JSEventTargetNode::getOwnPropertySlot): 35 (WebCore::JSEventTargetNode::getValueProperty): 36 (WebCore::JSEventTargetNode::put): 37 (WebCore::JSEventTargetNode::putValueProperty): 38 (WebCore::JSEventTargetNode::setListener): 39 (WebCore::JSEventTargetNode::getListener): 40 (WebCore::JSEventTargetNode::pushEventHandlerScope): 41 (WebCore::JSEventTargetNodePrototypeFunction::callAsFunction): 42 (WebCore::toEventTargetNode): 43 * bindings/js/JSEventTargetNode.h: Added. 44 (WebCore::JSEventTargetNode::): 45 * bindings/js/JSHTMLElementCustom.cpp: 46 * bindings/js/JSHTMLFormElementCustom.cpp: 47 (WebCore::JSHTMLFormElement::nameGetter): 48 * bindings/js/JSHTMLOptionElementConstructor.cpp: 49 * bindings/js/JSNamedNodeMapCustom.cpp: Added. 50 (WebCore::JSNamedNodeMap::canGetItemsForName): 51 (WebCore::JSNamedNodeMap::nameGetter): 52 * bindings/js/JSNamedNodesCollection.cpp: Added. 53 (WebCore::): 54 (WebCore::JSNamedNodesCollection::JSNamedNodesCollection): 55 (WebCore::JSNamedNodesCollection::lengthGetter): 56 (WebCore::JSNamedNodesCollection::indexGetter): 57 (WebCore::JSNamedNodesCollection::getOwnPropertySlot): 58 * bindings/js/JSNamedNodesCollection.h: Added. 59 (WebCore::JSNamedNodesCollection::classInfo): 60 * bindings/js/JSNodeCustom.cpp: Added. 61 (WebCore::toJS): 62 * bindings/js/JSNodeListCustom.cpp: Added. 63 (WebCore::JSNodeList::callAsFunction): 64 (WebCore::JSNodeList::implementsCall): 65 (WebCore::JSNodeList::canGetItemsForName): 66 (WebCore::JSNodeList::nameGetter): 67 * bindings/js/kjs_dom.cpp: 68 * bindings/js/kjs_dom.h: 69 * bindings/js/kjs_domnode.h: 70 * bindings/js/kjs_events.cpp: 71 (KJS::JSLazyEventListener::parseCode): 72 * bindings/js/kjs_html.cpp: 73 (KJS::JSHTMLCollection::getNamedItems): 74 * bindings/js/kjs_html.h: 75 * bindings/js/kjs_window.cpp: 76 (WebCore::toJS): 77 * bindings/js/kjs_window.h: 78 * bindings/objc/DOMInternal.mm: 79 (-[WebScriptObject _initializeScriptDOMNodeImp]): 80 * bindings/objc/DOMUtility.mm: 81 (KJS::createDOMWrapper): 82 * bindings/scripts/CodeGeneratorJS.pm: 83 * bridge/mac/WebCoreAXObject.mm: 84 * dom/Attr.idl: 85 * dom/CharacterData.idl: 86 * dom/Document.idl: 87 * dom/DocumentFragment.idl: 88 * dom/DocumentType.idl: 89 * dom/Element.idl: 90 * dom/NamedNodeMap.idl: 91 * dom/Node.idl: 92 * dom/NodeList.idl: 93 * page/DOMWindow.idl: 94 1 95 2007-06-06 Justin Garcia <justin.garcia@apple.com> 2 96 -
trunk/WebCore/DerivedSources.make
r22035 r22039 320 320 JSCounter.h \ 321 321 JSCSSStyleDeclaration.h \ 322 JSDOMExceptionConstructor.lut.h \ 322 323 JSDOMImplementation.h \ 323 324 JSDOMParser.h \ … … 327 328 JSDocumentType.h \ 328 329 JSElement.h \ 329 JSEvent.h \330 330 JSEntity.h \ 331 331 JSEntityReference.h \ 332 JSEvent.h \ 333 JSEventTargetNode.lut.h \ 332 334 JSHTMLAppletElement.h \ 333 335 JSHTMLAnchorElement.h \ … … 394 396 JSMouseEvent.h \ 395 397 JSMutationEvent.h \ 398 JSNamedNodeMap.h \ 396 399 JSNode.h \ 397 400 JSNodeFilter.h \ 398 401 JSNodeIterator.h \ 402 JSNodeList.h \ 399 403 JSNotation.h \ 400 404 JSOverflowEvent.h \ -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r22035 r22039 377 377 656581F409D1508D000E61D7 /* kjs_html.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581DD09D1508D000E61D7 /* kjs_html.lut.h */; }; 378 378 656581F509D1508D000E61D7 /* kjs_navigator.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581DE09D1508D000E61D7 /* kjs_navigator.lut.h */; }; 379 656581F609D1508D000E61D7 /* kjs_traversal.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581DF09D1508D000E61D7 /* kjs_traversal.lut.h */; };380 379 656581F809D1508D000E61D7 /* kjs_window.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581E109D1508D000E61D7 /* kjs_window.lut.h */; }; 381 380 656581FB09D1508D000E61D7 /* ksvgcssproperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581E409D1508D000E61D7 /* ksvgcssproperties.h */; }; … … 2862 2861 BCCFBAE80B5152ED0001F1D7 /* Tokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCFBAE70B5152ED0001F1D7 /* Tokenizer.h */; }; 2863 2862 BCD41ABB0C060DE800C0E446 /* JSHTMLFrameSetElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD41ABA0C060DE800C0E446 /* JSHTMLFrameSetElementCustom.cpp */; }; 2863 BCD9C2620C17AA67005C90A2 /* JSDOMWindowCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */; }; 2864 BCD9C2630C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C25F0C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp */; }; 2865 BCD9C2640C17AA67005C90A2 /* JSNodeCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C2600C17AA67005C90A2 /* JSNodeCustom.cpp */; }; 2866 BCD9C2650C17AA67005C90A2 /* JSNodeListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C2610C17AA67005C90A2 /* JSNodeListCustom.cpp */; }; 2867 BCD9C26E0C17AA81005C90A2 /* JSDOMExceptionConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C2680C17AA81005C90A2 /* JSDOMExceptionConstructor.cpp */; }; 2868 BCD9C26F0C17AA81005C90A2 /* JSDOMExceptionConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C2690C17AA81005C90A2 /* JSDOMExceptionConstructor.h */; }; 2869 BCD9C2700C17AA81005C90A2 /* JSEventTargetNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C26A0C17AA81005C90A2 /* JSEventTargetNode.cpp */; }; 2870 BCD9C2710C17AA81005C90A2 /* JSEventTargetNode.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C26B0C17AA81005C90A2 /* JSEventTargetNode.h */; }; 2871 BCD9C2720C17AA81005C90A2 /* JSNamedNodesCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C26C0C17AA81005C90A2 /* JSNamedNodesCollection.cpp */; }; 2872 BCD9C2730C17AA81005C90A2 /* JSNamedNodesCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C26D0C17AA81005C90A2 /* JSNamedNodesCollection.h */; }; 2873 BCD9C2C00C17B69E005C90A2 /* JSNamedNodeMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C2BC0C17B69E005C90A2 /* JSNamedNodeMap.cpp */; }; 2874 BCD9C2C10C17B69E005C90A2 /* JSNamedNodeMap.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C2BD0C17B69E005C90A2 /* JSNamedNodeMap.h */; }; 2875 BCD9C2C20C17B69E005C90A2 /* JSNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD9C2BE0C17B69E005C90A2 /* JSNodeList.cpp */; }; 2876 BCD9C2C30C17B69E005C90A2 /* JSNodeList.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C2BF0C17B69E005C90A2 /* JSNodeList.h */; }; 2877 BCD9C2C60C17B6EC005C90A2 /* JSDOMExceptionConstructor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C2C40C17B6EC005C90A2 /* JSDOMExceptionConstructor.lut.h */; }; 2878 BCD9C2C70C17B6EC005C90A2 /* JSEventTargetNode.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD9C2C50C17B6EC005C90A2 /* JSEventTargetNode.lut.h */; }; 2864 2879 BCE0139A0C0BEF180043860A /* JSStyleSheet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE013980C0BEF180043860A /* JSStyleSheet.cpp */; }; 2865 2880 BCE0139B0C0BEF180043860A /* JSStyleSheet.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE013990C0BEF180043860A /* JSStyleSheet.h */; }; … … 3587 3602 656581DD09D1508D000E61D7 /* kjs_html.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_html.lut.h; sourceTree = "<group>"; }; 3588 3603 656581DE09D1508D000E61D7 /* kjs_navigator.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_navigator.lut.h; sourceTree = "<group>"; }; 3589 656581DF09D1508D000E61D7 /* kjs_traversal.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_traversal.lut.h; sourceTree = "<group>"; };3590 3604 656581E109D1508D000E61D7 /* kjs_window.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_window.lut.h; sourceTree = "<group>"; }; 3591 3605 656581E209D1508D000E61D7 /* ksvgcssproperties.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ksvgcssproperties.c; sourceTree = "<group>"; }; … … 6139 6153 BCCFBAE70B5152ED0001F1D7 /* Tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Tokenizer.h; sourceTree = "<group>"; }; 6140 6154 BCD41ABA0C060DE800C0E446 /* JSHTMLFrameSetElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLFrameSetElementCustom.cpp; sourceTree = "<group>"; }; 6155 BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMWindowCustom.cpp; sourceTree = "<group>"; }; 6156 BCD9C25F0C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNamedNodeMapCustom.cpp; sourceTree = "<group>"; }; 6157 BCD9C2600C17AA67005C90A2 /* JSNodeCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeCustom.cpp; sourceTree = "<group>"; }; 6158 BCD9C2610C17AA67005C90A2 /* JSNodeListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeListCustom.cpp; sourceTree = "<group>"; }; 6159 BCD9C2680C17AA81005C90A2 /* JSDOMExceptionConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMExceptionConstructor.cpp; sourceTree = "<group>"; }; 6160 BCD9C2690C17AA81005C90A2 /* JSDOMExceptionConstructor.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSDOMExceptionConstructor.h; sourceTree = "<group>"; }; 6161 BCD9C26A0C17AA81005C90A2 /* JSEventTargetNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventTargetNode.cpp; sourceTree = "<group>"; }; 6162 BCD9C26B0C17AA81005C90A2 /* JSEventTargetNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSEventTargetNode.h; sourceTree = "<group>"; }; 6163 BCD9C26C0C17AA81005C90A2 /* JSNamedNodesCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNamedNodesCollection.cpp; sourceTree = "<group>"; }; 6164 BCD9C26D0C17AA81005C90A2 /* JSNamedNodesCollection.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSNamedNodesCollection.h; sourceTree = "<group>"; }; 6165 BCD9C2BC0C17B69E005C90A2 /* JSNamedNodeMap.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNamedNodeMap.cpp; sourceTree = "<group>"; }; 6166 BCD9C2BD0C17B69E005C90A2 /* JSNamedNodeMap.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSNamedNodeMap.h; sourceTree = "<group>"; }; 6167 BCD9C2BE0C17B69E005C90A2 /* JSNodeList.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSNodeList.cpp; sourceTree = "<group>"; }; 6168 BCD9C2BF0C17B69E005C90A2 /* JSNodeList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSNodeList.h; sourceTree = "<group>"; }; 6169 BCD9C2C40C17B6EC005C90A2 /* JSDOMExceptionConstructor.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSDOMExceptionConstructor.lut.h; sourceTree = "<group>"; }; 6170 BCD9C2C50C17B6EC005C90A2 /* JSEventTargetNode.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSEventTargetNode.lut.h; sourceTree = "<group>"; }; 6141 6171 BCE013980C0BEF180043860A /* JSStyleSheet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSStyleSheet.cpp; sourceTree = "<group>"; }; 6142 6172 BCE013990C0BEF180043860A /* JSStyleSheet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSStyleSheet.h; sourceTree = "<group>"; }; … … 6623 6653 65DF31E709D1CC60000BE325 /* JSMutationEvent.cpp */, 6624 6654 65DF31E809D1CC60000BE325 /* JSMutationEvent.h */, 6655 BCD9C2BC0C17B69E005C90A2 /* JSNamedNodeMap.cpp */, 6656 BCD9C2BD0C17B69E005C90A2 /* JSNamedNodeMap.h */, 6625 6657 14DC0D3509FED073007B0235 /* JSNode.cpp */, 6626 6658 14DC0D3609FED073007B0235 /* JSNode.h */, … … 6629 6661 1A750D8B0A90E521000FF215 /* JSNodeIterator.cpp */, 6630 6662 1A750D8C0A90E521000FF215 /* JSNodeIterator.h */, 6663 BCD9C2BE0C17B69E005C90A2 /* JSNodeList.cpp */, 6664 BCD9C2BF0C17B69E005C90A2 /* JSNodeList.h */, 6631 6665 65DF31E909D1CC60000BE325 /* JSNotation.cpp */, 6632 6666 65DF31EA09D1CC60000BE325 /* JSNotation.h */, … … 6996 7030 A8D06B380A265DCD005E7203 /* HTMLNames.cpp */, 6997 7031 A8D06B370A265DCD005E7203 /* HTMLNames.h */, 7032 BCD9C2C40C17B6EC005C90A2 /* JSDOMExceptionConstructor.lut.h */, 7033 BCD9C2C50C17B6EC005C90A2 /* JSEventTargetNode.lut.h */, 6998 7034 656581DA09D1508D000E61D7 /* kjs_css.lut.h */, 6999 7035 656581DB09D1508D000E61D7 /* kjs_dom.lut.h */, … … 7001 7037 656581DD09D1508D000E61D7 /* kjs_html.lut.h */, 7002 7038 656581DE09D1508D000E61D7 /* kjs_navigator.lut.h */, 7003 656581DF09D1508D000E61D7 /* kjs_traversal.lut.h */,7004 7039 656581E109D1508D000E61D7 /* kjs_window.lut.h */, 7005 7040 656581E209D1508D000E61D7 /* ksvgcssproperties.c */, … … 9163 9198 E10B93C20B73C291003ED890 /* JSCustomXPathNSResolver.cpp */, 9164 9199 E10B937B0B73C00A003ED890 /* JSCustomXPathNSResolver.h */, 9200 BCD9C2680C17AA81005C90A2 /* JSDOMExceptionConstructor.cpp */, 9201 BCD9C2690C17AA81005C90A2 /* JSDOMExceptionConstructor.h */, 9202 BCD9C26A0C17AA81005C90A2 /* JSEventTargetNode.cpp */, 9203 BCD9C26B0C17AA81005C90A2 /* JSEventTargetNode.h */, 9165 9204 938E65F609F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp */, 9166 9205 938E65F009F09840008A48EC /* JSHTMLElementWrapperFactory.h */, … … 9169 9208 A826E8AD0A1A8F2300CD1BB6 /* JSHTMLOptionElementConstructor.cpp */, 9170 9209 A826E8AC0A1A8F2300CD1BB6 /* JSHTMLOptionElementConstructor.h */, 9210 BCD9C26C0C17AA81005C90A2 /* JSNamedNodesCollection.cpp */, 9211 BCD9C26D0C17AA81005C90A2 /* JSNamedNodesCollection.h */, 9212 BCB7735E0C17853D00132BA4 /* JSNodeFilterCondition.cpp */, 9213 BCB7735F0C17853D00132BA4 /* JSNodeFilterCondition.h */, 9171 9214 8574D1F10ADE6122004CBA11 /* JSSVGElementWrapperFactory.cpp */, 9172 9215 8574D1F20ADE6122004CBA11 /* JSSVGElementWrapperFactory.h */, … … 9247 9290 BC20FB7E0C0E8E6C00D1447F /* JSCSSValueCustom.cpp */, 9248 9291 929264760B61FC7200B41D34 /* JSDocumentCustom.cpp */, 9292 BCD9C25E0C17AA67005C90A2 /* JSDOMWindowCustom.cpp */, 9249 9293 BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */, 9250 9294 BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */, … … 9257 9301 BC17F9650B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp */, 9258 9302 AB4CB4EA0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h */, 9259 BC B7735E0C17853D00132BA4 /* JSNodeFilterCondition.cpp */,9260 BC B7735F0C17853D00132BA4 /* JSNodeFilterCondition.h*/,9303 BCD9C25F0C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp */, 9304 BCD9C2600C17AA67005C90A2 /* JSNodeCustom.cpp */, 9261 9305 BCB773600C17853D00132BA4 /* JSNodeFilterCustom.cpp */, 9262 9306 1A750DD30A90E729000FF215 /* JSNodeIteratorCustom.cpp */, 9307 BCD9C2610C17AA67005C90A2 /* JSNodeListCustom.cpp */, 9263 9308 BC98A27C0C0C9950004BEBF7 /* JSStyleSheetCustom.cpp */, 9264 9309 B25DFAAE0B2E2929000E6510 /* JSSVGMatrixCustom.cpp */, … … 10356 10401 656581F409D1508D000E61D7 /* kjs_html.lut.h in Headers */, 10357 10402 656581F509D1508D000E61D7 /* kjs_navigator.lut.h in Headers */, 10358 656581F609D1508D000E61D7 /* kjs_traversal.lut.h in Headers */,10359 10403 656581F809D1508D000E61D7 /* kjs_window.lut.h in Headers */, 10360 10404 656581FB09D1508D000E61D7 /* ksvgcssproperties.h in Headers */, … … 11500 11544 BCC5BE010C0E93110011C2DB /* JSCSSStyleSheet.h in Headers */, 11501 11545 BCB773620C17853D00132BA4 /* JSNodeFilterCondition.h in Headers */, 11546 BCD9C26F0C17AA81005C90A2 /* JSDOMExceptionConstructor.h in Headers */, 11547 BCD9C2710C17AA81005C90A2 /* JSEventTargetNode.h in Headers */, 11548 BCD9C2730C17AA81005C90A2 /* JSNamedNodesCollection.h in Headers */, 11549 BCD9C2C10C17B69E005C90A2 /* JSNamedNodeMap.h in Headers */, 11550 BCD9C2C30C17B69E005C90A2 /* JSNodeList.h in Headers */, 11551 BCD9C2C60C17B6EC005C90A2 /* JSDOMExceptionConstructor.lut.h in Headers */, 11552 BCD9C2C70C17B6EC005C90A2 /* JSEventTargetNode.lut.h in Headers */, 11502 11553 ); 11503 11554 runOnlyForDeploymentPostprocessing = 0; … … 12912 12963 BCB773610C17853D00132BA4 /* JSNodeFilterCondition.cpp in Sources */, 12913 12964 BCB773630C17853D00132BA4 /* JSNodeFilterCustom.cpp in Sources */, 12965 BCD9C2620C17AA67005C90A2 /* JSDOMWindowCustom.cpp in Sources */, 12966 BCD9C2630C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp in Sources */, 12967 BCD9C2640C17AA67005C90A2 /* JSNodeCustom.cpp in Sources */, 12968 BCD9C2650C17AA67005C90A2 /* JSNodeListCustom.cpp in Sources */, 12969 BCD9C26E0C17AA81005C90A2 /* JSDOMExceptionConstructor.cpp in Sources */, 12970 BCD9C2700C17AA81005C90A2 /* JSEventTargetNode.cpp in Sources */, 12971 BCD9C2720C17AA81005C90A2 /* JSNamedNodesCollection.cpp in Sources */, 12972 BCD9C2C00C17B69E005C90A2 /* JSNamedNodeMap.cpp in Sources */, 12973 BCD9C2C20C17B69E005C90A2 /* JSNodeList.cpp in Sources */, 12914 12974 ); 12915 12975 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/bindings/js/JSDocumentCustom.cpp
r19105 r22039 1 1 /* 2 * Copyright (C) 2007 Apple, Inc. 2 * Copyright (C) 2007 Apple, Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 21 21 #include "JSDocument.h" 22 22 23 #include "Document.h" 24 #include "HTMLDocument.h" 25 #include "JSHTMLDocument.h" 23 26 #include "kjs_binding.h" 24 #include "Document.h" 27 #include "kjs_window.h" 28 29 #if ENABLE(SVG) 30 #include "JSSVGDocument.h" 31 #include "SVGDocument.h" 32 #endif 25 33 26 34 namespace WebCore { 35 36 using namespace KJS; 27 37 28 38 void JSDocument::mark() 29 39 { 30 40 DOMObject::mark(); 31 KJS::ScriptInterpreter::markDOMNodesForDocument(static_cast<Document*>(impl())); 32 } 33 41 ScriptInterpreter::markDOMNodesForDocument(static_cast<Document*>(impl())); 34 42 } 35 43 44 JSValue* toJS(ExecState* exec, Document* doc) 45 { 46 if (!doc) 47 return jsNull(); 48 49 ScriptInterpreter* interp = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter()); 50 JSDocument* ret = static_cast<JSDocument*>(interp->getDOMObject(doc)); 51 if (ret) 52 return ret; 53 54 if (doc->isHTMLDocument()) 55 ret = new JSHTMLDocument(exec, static_cast<HTMLDocument*>(doc)); 56 #if ENABLE(SVG) 57 else if (doc->isSVGDocument()) 58 ret = new JSSVGDocument(exec, static_cast<SVGDocument*>(doc)); 59 #endif 60 else 61 ret = new JSDocument(exec, doc); 62 63 // Make sure the document is kept around by the window object, and works right with the 64 // back/forward cache. 65 if (doc->frame()) 66 Window::retrieveWindow(doc->frame())->putDirect("document", ret, DontDelete|ReadOnly); 67 68 interp->putDOMObject(doc, ret); 69 70 return ret; 71 } 72 73 } // namespace WebCore -
trunk/WebCore/bindings/js/JSHTMLElementCustom.cpp
r21856 r22039 29 29 #include "Document.h" 30 30 #include "HTMLFormElement.h" 31 #include "kjs_dom.h" 31 32 32 33 namespace WebCore { -
trunk/WebCore/bindings/js/JSHTMLFormElementCustom.cpp
r21979 r22039 1 1 /* 2 * Copyright (C) 2006 Apple Computer,Inc. All rights reserved.2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 #include "JSHTMLFormElement.h" 28 28 29 #include "HTMLCollection.h" 29 30 #include "HTMLFormElement.h" 30 #include "HTMLCollection.h" 31 #include "JSNamedNodesCollection.h" 32 #include "kjs_dom.h" 31 33 32 34 using namespace KJS; … … 51 53 return toJS(exec, namedItems[0].get()); 52 54 if (namedItems.size() > 1) 53 return new DOMNamedNodesCollection(exec, namedItems);55 return new JSNamedNodesCollection(exec, namedItems); 54 56 return jsUndefined(); 55 57 } -
trunk/WebCore/bindings/js/JSHTMLOptionElementConstructor.cpp
r20310 r22039 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 25 25 #include "JSHTMLOptionElement.h" 26 26 #include "Text.h" 27 #include "kjs_dom.h" 28 29 namespace WebCore { 27 30 28 31 using namespace KJS; 29 30 namespace WebCore {31 32 32 33 JSHTMLOptionElementConstructor::JSHTMLOptionElementConstructor(ExecState* exec, Document* d) … … 66 67 } 67 68 68 } 69 } // namespace WebCore -
trunk/WebCore/bindings/js/JSNodeFilterCondition.cpp
r22035 r22039 23 23 #include "Document.h" 24 24 #include "Frame.h" 25 #include "JSNode.h" 25 26 #include "JSNodeFilter.h" 26 27 #include "NodeFilter.h" … … 48 49 KJS::ExecState* exec = proxy->interpreter()->globalExec(); 49 50 KJS::List args; 50 args.append( KJS::toJS(exec, node));51 args.append(toJS(exec, node)); 51 52 KJS::JSObject* obj = m_filter; 52 53 KJS::JSValue* result = obj->call(exec, obj, args); -
trunk/WebCore/bindings/js/kjs_dom.cpp
r22035 r22039 49 49 #include "JSHTMLDocument.h" 50 50 #include "JSHTMLElementWrapperFactory.h" 51 #include "JSNamedNodeMap.h" 51 52 #include "JSNode.h" 53 #include "JSNodeList.h" 52 54 #include "JSNotation.h" 53 55 #include "JSProcessingInstruction.h" … … 55 57 #include "JSText.h" 56 58 #include "NamedNodeMap.h" 59 #include "NodeList.h" 57 60 #include "Notation.h" 58 61 #include "ProcessingInstruction.h" … … 169 172 // Double check that we actually ended up marked. This assert caught problems in the past. 170 173 ASSERT(marked()); 171 }172 173 bool DOMNode::toBoolean(ExecState* ) const174 {175 return m_impl;176 174 } 177 175 … … 318 316 } 319 317 320 EventTargetNode *toEventTargetNode(JSValue* val)321 {322 if (!val || !val->isObject(&DOMEventTargetNode::info))323 return 0;324 return static_cast<EventTargetNode*>(static_cast<DOMEventTargetNode*>(val)->impl());325 }326 327 Node* toNode(JSValue* val)328 {329 if (!val || !val->isObject(&DOMNode::info))330 return 0;331 return static_cast<DOMNode*>(val)->impl();332 }333 334 // -------------------------------------------------------------------------335 336 /* Source for DOMEventTargetNodeTable337 @begin DOMEventTargetNodeTable 50338 onabort DOMEventTargetNode::OnAbort DontDelete339 onblur DOMEventTargetNode::OnBlur DontDelete340 onchange DOMEventTargetNode::OnChange DontDelete341 onclick DOMEventTargetNode::OnClick DontDelete342 oncontextmenu DOMEventTargetNode::OnContextMenu DontDelete343 ondblclick DOMEventTargetNode::OnDblClick DontDelete344 onbeforecut DOMEventTargetNode::OnBeforeCut DontDelete345 oncut DOMEventTargetNode::OnCut DontDelete346 onbeforecopy DOMEventTargetNode::OnBeforeCopy DontDelete347 oncopy DOMEventTargetNode::OnCopy DontDelete348 onbeforepaste DOMEventTargetNode::OnBeforePaste DontDelete349 onpaste DOMEventTargetNode::OnPaste DontDelete350 ondrag DOMEventTargetNode::OnDrag DontDelete351 ondragend DOMEventTargetNode::OnDragEnd DontDelete352 ondragenter DOMEventTargetNode::OnDragEnter DontDelete353 ondragleave DOMEventTargetNode::OnDragLeave DontDelete354 ondragover DOMEventTargetNode::OnDragOver DontDelete355 ondragstart DOMEventTargetNode::OnDragStart DontDelete356 ondrop DOMEventTargetNode::OnDrop DontDelete357 onerror DOMEventTargetNode::OnError DontDelete358 onfocus DOMEventTargetNode::OnFocus DontDelete359 oninput DOMEventTargetNode::OnInput DontDelete360 onkeydown DOMEventTargetNode::OnKeyDown DontDelete361 onkeypress DOMEventTargetNode::OnKeyPress DontDelete362 onkeyup DOMEventTargetNode::OnKeyUp DontDelete363 onload DOMEventTargetNode::OnLoad DontDelete364 onmousedown DOMEventTargetNode::OnMouseDown DontDelete365 onmousemove DOMEventTargetNode::OnMouseMove DontDelete366 onmouseout DOMEventTargetNode::OnMouseOut DontDelete367 onmouseover DOMEventTargetNode::OnMouseOver DontDelete368 onmouseup DOMEventTargetNode::OnMouseUp DontDelete369 onmousewheel DOMEventTargetNode::OnMouseWheel DontDelete370 onreset DOMEventTargetNode::OnReset DontDelete371 onresize DOMEventTargetNode::OnResize DontDelete372 onscroll DOMEventTargetNode::OnScroll DontDelete373 onsearch DOMEventTargetNode::OnSearch DontDelete374 onselect DOMEventTargetNode::OnSelect DontDelete375 onselectstart DOMEventTargetNode::OnSelectStart DontDelete376 onsubmit DOMEventTargetNode::OnSubmit DontDelete377 onunload DOMEventTargetNode::OnUnload DontDelete378 @end379 */380 381 DOMEventTargetNode::DOMEventTargetNode(ExecState* exec, Node* n)382 : JSNode(exec, n)383 {384 setPrototype(DOMEventTargetNodePrototype::self(exec));385 }386 387 bool DOMEventTargetNode::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)388 {389 return getStaticValueSlot<DOMEventTargetNode, DOMNode>(exec, &DOMEventTargetNodeTable, this, propertyName, slot);390 }391 392 JSValue* DOMEventTargetNode::getValueProperty(ExecState* exec, int token) const393 {394 switch (token) {395 case OnAbort:396 return getListener(abortEvent);397 case OnBlur:398 return getListener(blurEvent);399 case OnChange:400 return getListener(changeEvent);401 case OnClick:402 return getListener(clickEvent);403 case OnContextMenu:404 return getListener(contextmenuEvent);405 case OnDblClick:406 return getListener(dblclickEvent);407 case OnError:408 return getListener(errorEvent);409 case OnFocus:410 return getListener(focusEvent);411 case OnInput:412 return getListener(inputEvent);413 case OnKeyDown:414 return getListener(keydownEvent);415 case OnKeyPress:416 return getListener(keypressEvent);417 case OnKeyUp:418 return getListener(keyupEvent);419 case OnLoad:420 return getListener(loadEvent);421 case OnMouseDown:422 return getListener(mousedownEvent);423 case OnMouseMove:424 return getListener(mousemoveEvent);425 case OnMouseOut:426 return getListener(mouseoutEvent);427 case OnMouseOver:428 return getListener(mouseoverEvent);429 case OnMouseUp:430 return getListener(mouseupEvent);431 case OnMouseWheel:432 return getListener(mousewheelEvent);433 case OnBeforeCut:434 return getListener(beforecutEvent);435 case OnCut:436 return getListener(cutEvent);437 case OnBeforeCopy:438 return getListener(beforecopyEvent);439 case OnCopy:440 return getListener(copyEvent);441 case OnBeforePaste:442 return getListener(beforepasteEvent);443 case OnPaste:444 return getListener(pasteEvent);445 case OnDragEnter:446 return getListener(dragenterEvent);447 case OnDragOver:448 return getListener(dragoverEvent);449 case OnDragLeave:450 return getListener(dragleaveEvent);451 case OnDrop:452 return getListener(dropEvent);453 case OnDragStart:454 return getListener(dragstartEvent);455 case OnDrag:456 return getListener(dragEvent);457 case OnDragEnd:458 return getListener(dragendEvent);459 case OnReset:460 return getListener(resetEvent);461 case OnResize:462 return getListener(resizeEvent);463 case OnScroll:464 return getListener(scrollEvent);465 case OnSearch:466 return getListener(searchEvent);467 case OnSelect:468 return getListener(selectEvent);469 case OnSelectStart:470 return getListener(selectstartEvent);471 case OnSubmit:472 return getListener(submitEvent);473 case OnUnload:474 return getListener(unloadEvent);475 }476 477 return jsUndefined();478 }479 480 void DOMEventTargetNode::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)481 {482 lookupPut<DOMEventTargetNode, DOMNode>(exec, propertyName, value, attr, &DOMEventTargetNodeTable, this);483 }484 485 void DOMEventTargetNode::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/)486 {487 switch (token) {488 case OnAbort:489 setListener(exec, abortEvent, value);490 break;491 case OnBlur:492 setListener(exec, blurEvent, value);493 break;494 case OnChange:495 setListener(exec, changeEvent, value);496 break;497 case OnClick:498 setListener(exec, clickEvent, value);499 break;500 case OnContextMenu:501 setListener(exec, contextmenuEvent, value);502 break;503 case OnDblClick:504 setListener(exec, dblclickEvent, value);505 break;506 case OnError:507 setListener(exec, errorEvent, value);508 break;509 case OnFocus:510 setListener(exec, focusEvent, value);511 break;512 case OnInput:513 setListener(exec, inputEvent, value);514 break;515 case OnKeyDown:516 setListener(exec, keydownEvent, value);517 break;518 case OnKeyPress:519 setListener(exec, keypressEvent, value);520 break;521 case OnKeyUp:522 setListener(exec, keyupEvent, value);523 break;524 case OnLoad:525 setListener(exec, loadEvent, value);526 break;527 case OnMouseDown:528 setListener(exec, mousedownEvent, value);529 break;530 case OnMouseMove:531 setListener(exec, mousemoveEvent, value);532 break;533 case OnMouseOut:534 setListener(exec, mouseoutEvent, value);535 break;536 case OnMouseOver:537 setListener(exec, mouseoverEvent, value);538 break;539 case OnMouseUp:540 setListener(exec, mouseupEvent, value);541 break;542 case OnMouseWheel:543 setListener(exec, mousewheelEvent, value);544 break;545 case OnBeforeCut:546 setListener(exec, beforecutEvent, value);547 break;548 case OnCut:549 setListener(exec, cutEvent, value);550 break;551 case OnBeforeCopy:552 setListener(exec, beforecopyEvent, value);553 break;554 case OnCopy:555 setListener(exec, copyEvent, value);556 break;557 case OnBeforePaste:558 setListener(exec, beforepasteEvent, value);559 break;560 case OnPaste:561 setListener(exec, pasteEvent, value);562 break;563 case OnDragEnter:564 setListener(exec, dragenterEvent, value);565 break;566 case OnDragOver:567 setListener(exec, dragoverEvent, value);568 break;569 case OnDragLeave:570 setListener(exec, dragleaveEvent, value);571 break;572 case OnDrop:573 setListener(exec, dropEvent, value);574 break;575 case OnDragStart:576 setListener(exec, dragstartEvent, value);577 break;578 case OnDrag:579 setListener(exec, dragEvent, value);580 break;581 case OnDragEnd:582 setListener(exec, dragendEvent, value);583 break;584 case OnReset:585 setListener(exec, resetEvent, value);586 break;587 case OnResize:588 setListener(exec, resizeEvent, value);589 break;590 case OnScroll:591 setListener(exec, scrollEvent, value);592 break;593 case OnSearch:594 setListener(exec, searchEvent, value);595 break;596 case OnSelect:597 setListener(exec, selectEvent, value);598 break;599 case OnSelectStart:600 setListener(exec, selectstartEvent, value);601 break;602 case OnSubmit:603 setListener(exec, submitEvent, value);604 break;605 case OnUnload:606 setListener(exec, unloadEvent, value);607 break;608 }609 }610 611 void DOMEventTargetNode::setListener(ExecState* exec, const AtomicString &eventType, JSValue* func) const612 {613 EventTargetNodeCast(impl())->setHTMLEventListener(eventType, Window::retrieveActive(exec)->findOrCreateJSEventListener(func, true));614 }615 616 JSValue* DOMEventTargetNode::getListener(const AtomicString &eventType) const617 {618 EventListener *listener = EventTargetNodeCast(impl())->getHTMLEventListener(eventType);619 JSEventListener *jsListener = static_cast<JSEventListener*>(listener);620 if (jsListener && jsListener->listenerObj())621 return jsListener->listenerObj();622 else623 return jsNull();624 }625 626 void DOMEventTargetNode::pushEventHandlerScope(ExecState*, ScopeChain &) const627 {628 }629 630 /*631 @begin DOMEventTargetNodePrototypeTable 5632 # from the EventTarget interface633 addEventListener DOMEventTargetNode::AddEventListener DontDelete|Function 3634 removeEventListener DOMEventTargetNode::RemoveEventListener DontDelete|Function 3635 dispatchEvent DOMEventTargetNode::DispatchEvent DontDelete|Function 1636 @end637 */638 639 KJS_IMPLEMENT_PROTOTYPE_FUNCTION(DOMEventTargetNodePrototypeFunction)640 KJS_IMPLEMENT_PROTOTYPE("DOMEventTargetNode", DOMEventTargetNodePrototype, DOMEventTargetNodePrototypeFunction)641 642 JSValue* DOMEventTargetNodePrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List &args)643 {644 if (!thisObj->inherits(&DOMEventTargetNode::info))645 return throwError(exec, TypeError);646 DOMExceptionTranslator exception(exec);647 DOMEventTargetNode* DOMNode = static_cast<DOMEventTargetNode*>(thisObj);648 EventTargetNode* node = static_cast<EventTargetNode*>(DOMNode->impl());649 switch (id) {650 case DOMEventTargetNode::AddEventListener: {651 JSEventListener *listener = Window::retrieveActive(exec)->findOrCreateJSEventListener(args[1]);652 if (listener)653 node->addEventListener(args[0]->toString(exec), listener,args[2]->toBoolean(exec));654 return jsUndefined();655 }656 case DOMEventTargetNode::RemoveEventListener: {657 JSEventListener *listener = Window::retrieveActive(exec)->findJSEventListener(args[1]);658 if (listener)659 node->removeEventListener(args[0]->toString(exec), listener,args[2]->toBoolean(exec));660 return jsUndefined();661 }662 case DOMEventTargetNode::DispatchEvent:663 return jsBoolean(node->dispatchEvent(toEvent(args[0]), exception));664 }665 666 return jsUndefined();667 }668 669 // -------------------------------------------------------------------------670 671 /*672 @begin DOMNodeListTable 2673 length DOMNodeList::Length DontDelete|ReadOnly674 item DOMNodeList::Item DontDelete|Function 1675 @end676 */677 678 KJS_IMPLEMENT_PROTOTYPE_FUNCTION(DOMNodeListFunc)679 680 const ClassInfo DOMNodeList::info = { "NodeList", 0, &DOMNodeListTable, 0 };681 682 DOMNodeList::DOMNodeList(ExecState* exec, NodeList *l)683 : m_impl(l)684 {685 setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());686 }687 688 DOMNodeList::~DOMNodeList()689 {690 ScriptInterpreter::forgetDOMObject(m_impl.get());691 }692 693 JSValue* DOMNodeList::getValueProperty(ExecState* exec, int token) const694 {695 ASSERT(token == Length);696 return jsNumber(m_impl->length());697 }698 699 JSValue* DOMNodeList::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)700 {701 DOMNodeList *thisObj = static_cast<DOMNodeList*>(slot.slotBase());702 return toJS(exec, thisObj->m_impl->item(slot.index()));703 }704 705 JSValue* DOMNodeList::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)706 {707 DOMNodeList *thisObj = static_cast<DOMNodeList*>(slot.slotBase());708 return toJS(exec, thisObj->m_impl->itemWithName(propertyName));709 }710 711 bool DOMNodeList::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)712 {713 const HashEntry* entry = Lookup::findEntry(&DOMNodeListTable, propertyName);714 715 if (entry) {716 if (entry->attr & Function)717 slot.setStaticEntry(this, entry, staticFunctionGetter<DOMNodeListFunc>);718 else719 slot.setStaticEntry(this, entry, staticValueGetter<DOMNodeList>);720 return true;721 }722 723 // array index ?724 bool ok;725 unsigned idx = propertyName.toUInt32(&ok);726 if (ok && idx < m_impl->length()) {727 slot.setCustomIndex(this, idx, indexGetter);728 return true;729 } else if (m_impl->itemWithName(propertyName)) {730 slot.setCustom(this, nameGetter);731 return true;732 }733 734 return DOMObject::getOwnPropertySlot(exec, propertyName, slot);735 }736 737 // Need to support both get and call, so that list[0] and list(0) work.738 JSValue* DOMNodeList::callAsFunction(ExecState* exec, JSObject*, const List &args)739 {740 // Do not use thisObj here. See JSHTMLCollection.741 UString s = args[0]->toString(exec);742 bool ok;743 unsigned int u = s.toUInt32(&ok);744 if (ok)745 return toJS(exec, m_impl->item(u));746 747 return jsUndefined();748 }749 750 // Not a prototype class currently, but should probably be converted to one751 JSValue* DOMNodeListFunc::callAsFunction(ExecState* exec, JSObject* thisObj, const List &args)752 {753 if (!thisObj->inherits(&KJS::DOMNodeList::info))754 return throwError(exec, TypeError);755 NodeList &list = *static_cast<DOMNodeList*>(thisObj)->impl();756 757 if (id == DOMNodeList::Item)758 return toJS(exec, list.item(args[0]->toInt32(exec)));759 760 return jsUndefined();761 }762 763 318 Attr* toAttr(JSValue* val, bool& ok) 764 319 { … … 772 327 } 773 328 774 Element* toElement(JSValue* val)775 {776 if (!val || !val->isObject(&JSElement::info))777 return 0;778 return static_cast<Element*>(static_cast<JSElement*>(val)->impl());779 }780 781 DocumentType* toDocumentType(JSValue* val)782 {783 if (!val || !val->isObject(&JSDocumentType::info))784 return 0;785 return static_cast<DocumentType*>(static_cast<DOMNode*>(val)->impl());786 }787 788 329 // ------------------------------------------------------------------------- 789 790 /* Source for DOMNamedNodeMapPrototypeTable. Use "make hashtables" to regenerate.791 @begin DOMNamedNodeMapPrototypeTable 10792 getNamedItem DOMNamedNodeMap::GetNamedItem DontDelete|Function 1793 setNamedItem DOMNamedNodeMap::SetNamedItem DontDelete|Function 1794 removeNamedItem DOMNamedNodeMap::RemoveNamedItem DontDelete|Function 1795 item DOMNamedNodeMap::Item DontDelete|Function 1796 # DOM2797 getNamedItemNS DOMNamedNodeMap::GetNamedItemNS DontDelete|Function 2798 setNamedItemNS DOMNamedNodeMap::SetNamedItemNS DontDelete|Function 1799 removeNamedItemNS DOMNamedNodeMap::RemoveNamedItemNS DontDelete|Function 2800 @end801 */802 KJS_DEFINE_PROTOTYPE(DOMNamedNodeMapPrototype)803 KJS_IMPLEMENT_PROTOTYPE_FUNCTION(DOMNamedNodeMapPrototypeFunction)804 KJS_IMPLEMENT_PROTOTYPE("NamedNodeMap", DOMNamedNodeMapPrototype, DOMNamedNodeMapPrototypeFunction)805 806 const ClassInfo DOMNamedNodeMap::info = { "NamedNodeMap", 0, 0, 0 };807 808 DOMNamedNodeMap::DOMNamedNodeMap(ExecState* exec, NamedNodeMap* m)809 : m_impl(m)810 {811 setPrototype(DOMNamedNodeMapPrototype::self(exec));812 }813 814 DOMNamedNodeMap::~DOMNamedNodeMap()815 {816 ScriptInterpreter::forgetDOMObject(m_impl.get());817 }818 819 JSValue* DOMNamedNodeMap::lengthGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)820 {821 DOMNamedNodeMap* thisObj = static_cast<DOMNamedNodeMap*>(slot.slotBase());822 return jsNumber(thisObj->m_impl->length());823 }824 825 JSValue* DOMNamedNodeMap::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)826 {827 DOMNamedNodeMap* thisObj = static_cast<DOMNamedNodeMap*>(slot.slotBase());828 return toJS(exec, thisObj->m_impl->item(slot.index()));829 }830 831 JSValue* DOMNamedNodeMap::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)832 {833 DOMNamedNodeMap* thisObj = static_cast<DOMNamedNodeMap*>(slot.slotBase());834 return toJS(exec, thisObj->m_impl->getNamedItem(propertyName));835 }836 837 bool DOMNamedNodeMap::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)838 {839 if (propertyName == exec->propertyNames().length) {840 slot.setCustom(this, lengthGetter);841 return true;842 } else {843 // Look in the prototype (for functions) before assuming it's an item's name844 JSValue* proto = prototype();845 if (proto->isObject() && static_cast<JSObject*>(proto)->hasProperty(exec, propertyName))846 return false;847 848 // name or index ?849 bool ok;850 unsigned idx = propertyName.toUInt32(&ok);851 if (ok && idx < m_impl->length()) {852 slot.setCustomIndex(this, idx, indexGetter);853 return true;854 }855 856 if (m_impl->getNamedItem(propertyName)) {857 slot.setCustom(this, nameGetter);858 return true;859 }860 }861 862 return DOMObject::getOwnPropertySlot(exec, propertyName, slot);863 }864 865 JSValue* DOMNamedNodeMapPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List &args)866 {867 if (!thisObj->inherits(&KJS::DOMNamedNodeMap::info))868 return throwError(exec, TypeError);869 DOMExceptionTranslator exception(exec);870 NamedNodeMap &map = *static_cast<DOMNamedNodeMap*>(thisObj)->impl();871 switch (id) {872 case DOMNamedNodeMap::GetNamedItem:873 return toJS(exec, map.getNamedItem(args[0]->toString(exec)));874 case DOMNamedNodeMap::SetNamedItem:875 return toJS(exec, map.setNamedItem(toNode(args[0]), exception).get());876 case DOMNamedNodeMap::RemoveNamedItem:877 return toJS(exec, map.removeNamedItem(args[0]->toString(exec), exception).get());878 case DOMNamedNodeMap::Item:879 return toJS(exec, map.item(args[0]->toInt32(exec)));880 case DOMNamedNodeMap::GetNamedItemNS: // DOM2881 return toJS(exec, map.getNamedItemNS(valueToStringWithNullCheck(exec, args[0]), args[1]->toString(exec)));882 case DOMNamedNodeMap::SetNamedItemNS: // DOM2883 return toJS(exec, map.setNamedItemNS(toNode(args[0]), exception).get());884 case DOMNamedNodeMap::RemoveNamedItemNS: // DOM2885 return toJS(exec, map.removeNamedItemNS(valueToStringWithNullCheck(exec, args[0]), args[1]->toString(exec), exception).get());886 }887 return jsUndefined();888 }889 890 // -------------------------------------------------------------------------891 892 JSValue* toJS(ExecState* exec, Document *n)893 {894 if (!n)895 return jsNull();896 897 JSDocument* ret = 0;898 ScriptInterpreter* interp = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter());899 900 if ((ret = static_cast<JSDocument*>(interp->getDOMObject(n))))901 return ret;902 903 if (n->isHTMLDocument())904 ret = new WebCore::JSHTMLDocument(exec, static_cast<HTMLDocument*>(n));905 #if ENABLE(SVG)906 else if (n->isSVGDocument())907 ret = new WebCore::JSSVGDocument(exec, static_cast<SVGDocument*>(n));908 #endif909 else910 ret = new JSDocument(exec, n);911 912 // Make sure the document is kept around by the window object, and works right with the913 // back/forward cache.914 if (n->frame())915 Window::retrieveWindow(n->frame())->putDirect("document", ret, DontDelete|ReadOnly);916 917 interp->putDOMObject(n, ret);918 919 return ret;920 }921 330 922 331 bool checkNodeSecurity(ExecState* exec, Node* n) … … 928 337 Window* win = Window::retrieveWindow(n->document()->frame()); 929 338 return win && win->isSafeScript(exec); 930 }931 932 JSValue* toJS(ExecState* exec, PassRefPtr<Node> node)933 {934 Node* n = node.get();935 DOMNode* ret = 0;936 if (!n)937 return jsNull();938 ScriptInterpreter* interp = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter());939 Document* doc = n->document();940 941 if ((ret = interp->getDOMNodeForDocument(doc, n)))942 return ret;943 944 switch (n->nodeType()) {945 case Node::ELEMENT_NODE:946 if (n->isHTMLElement())947 ret = createJSHTMLWrapper(exec, static_pointer_cast<HTMLElement>(node));948 #if ENABLE(SVG)949 else if (n->isSVGElement())950 ret = createJSSVGWrapper(exec, static_pointer_cast<SVGElement>(node));951 #endif952 else953 ret = new JSElement(exec, static_cast<Element*>(n));954 break;955 case Node::ATTRIBUTE_NODE:956 ret = new JSAttr(exec, static_cast<Attr*>(n));957 break;958 case Node::TEXT_NODE:959 ret = new JSText(exec, static_cast<Text*>(n));960 break;961 case Node::CDATA_SECTION_NODE:962 ret = new JSCDATASection(exec, static_cast<CDATASection*>(n));963 break;964 case Node::ENTITY_NODE:965 ret = new JSEntity(exec, static_cast<Entity*>(n));966 break;967 case Node::PROCESSING_INSTRUCTION_NODE:968 ret = new JSProcessingInstruction(exec, static_cast<ProcessingInstruction*>(n));969 break;970 case Node::COMMENT_NODE:971 ret = new JSComment(exec, static_cast<WebCore::Comment*>(n));972 break;973 case Node::DOCUMENT_NODE:974 // we don't want to cache the document itself in the per-document dictionary975 return toJS(exec, static_cast<Document*>(n));976 case Node::DOCUMENT_TYPE_NODE:977 ret = new JSDocumentType(exec, static_cast<DocumentType*>(n));978 break;979 case Node::NOTATION_NODE:980 ret = new JSNotation(exec, static_cast<Notation*>(n));981 break;982 case Node::DOCUMENT_FRAGMENT_NODE:983 ret = new JSDocumentFragment(exec, static_cast<DocumentFragment*>(n));984 break;985 case Node::ENTITY_REFERENCE_NODE:986 ret = new JSEntityReference(exec, static_cast<EntityReference*>(n));987 break;988 default:989 ret = new JSNode(exec, n);990 }991 992 interp->putDOMNodeForDocument(doc, n, ret);993 994 return ret;995 }996 997 JSValue* toJS(ExecState* exec, NamedNodeMap* m)998 {999 return cacheDOMObject<NamedNodeMap, DOMNamedNodeMap>(exec, m);1000 339 } 1001 340 … … 1047 386 } 1048 387 1049 JSValue* toJS(ExecState* exec, NodeList* l) 1050 { 1051 return cacheDOMObject<NodeList, DOMNodeList>(exec, l); 1052 } 1053 1054 // ------------------------------------------------------------------------- 1055 1056 const ClassInfo DOMExceptionConstructor::info = { "DOMExceptionConstructor", 0, 0, 0 }; 1057 1058 /* Source for DOMExceptionConstructorTable. Use "make hashtables" to regenerate. 1059 @begin DOMExceptionConstructorTable 15 1060 INDEX_SIZE_ERR WebCore::INDEX_SIZE_ERR DontDelete|ReadOnly 1061 DOMSTRING_SIZE_ERR WebCore::DOMSTRING_SIZE_ERR DontDelete|ReadOnly 1062 HIERARCHY_REQUEST_ERR WebCore::HIERARCHY_REQUEST_ERR DontDelete|ReadOnly 1063 WRONG_DOCUMENT_ERR WebCore::WRONG_DOCUMENT_ERR DontDelete|ReadOnly 1064 INVALID_CHARACTER_ERR WebCore::INVALID_CHARACTER_ERR DontDelete|ReadOnly 1065 NO_DATA_ALLOWED_ERR WebCore::NO_DATA_ALLOWED_ERR DontDelete|ReadOnly 1066 NO_MODIFICATION_ALLOWED_ERR WebCore::NO_MODIFICATION_ALLOWED_ERR DontDelete|ReadOnly 1067 NOT_FOUND_ERR WebCore::NOT_FOUND_ERR DontDelete|ReadOnly 1068 NOT_SUPPORTED_ERR WebCore::NOT_SUPPORTED_ERR DontDelete|ReadOnly 1069 INUSE_ATTRIBUTE_ERR WebCore::INUSE_ATTRIBUTE_ERR DontDelete|ReadOnly 1070 INVALID_STATE_ERR WebCore::INVALID_STATE_ERR DontDelete|ReadOnly 1071 SYNTAX_ERR WebCore::SYNTAX_ERR DontDelete|ReadOnly 1072 INVALID_MODIFICATION_ERR WebCore::INVALID_MODIFICATION_ERR DontDelete|ReadOnly 1073 NAMESPACE_ERR WebCore::NAMESPACE_ERR DontDelete|ReadOnly 1074 INVALID_ACCESS_ERR WebCore::INVALID_ACCESS_ERR DontDelete|ReadOnly 1075 @end 1076 */ 1077 1078 DOMExceptionConstructor::DOMExceptionConstructor(ExecState* exec) 1079 { 1080 setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype()); 1081 } 1082 1083 bool DOMExceptionConstructor::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot) 1084 { 1085 return getStaticValueSlot<DOMExceptionConstructor, DOMObject>(exec, &DOMExceptionConstructorTable, this, propertyName, slot); 1086 } 1087 1088 JSValue* DOMExceptionConstructor::getValueProperty(ExecState*, int token) const 1089 { 1090 // We use the token as the value to return directly 1091 return jsNumber(token); 1092 } 1093 1094 JSObject* getDOMExceptionConstructor(ExecState* exec) 1095 { 1096 return cacheGlobalObject<DOMExceptionConstructor>(exec, "[[DOMException.constructor]]"); 1097 } 1098 1099 // ------------------------------------------------------------------------- 1100 1101 const ClassInfo DOMNamedNodesCollection::info = { "Collection", 0, 0, 0 }; 1102 1103 // Such a collection is usually very short-lived, it only exists 1104 // for constructs like document.forms.<name>[1], 1105 // so it shouldn't be a problem that it's storing all the nodes (with the same name). (David) 1106 DOMNamedNodesCollection::DOMNamedNodesCollection(ExecState* exec, const Vector<RefPtr<Node> >& nodes) 1107 : m_nodes(nodes) 1108 { 1109 setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype()); 1110 } 1111 1112 JSValue* DOMNamedNodesCollection::lengthGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot) 1113 { 1114 DOMNamedNodesCollection *thisObj = static_cast<DOMNamedNodesCollection*>(slot.slotBase()); 1115 return jsNumber(thisObj->m_nodes.size()); 1116 } 1117 1118 JSValue* DOMNamedNodesCollection::indexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot) 1119 { 1120 DOMNamedNodesCollection *thisObj = static_cast<DOMNamedNodesCollection*>(slot.slotBase()); 1121 return toJS(exec, thisObj->m_nodes[slot.index()].get()); 1122 } 1123 1124 bool DOMNamedNodesCollection::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) 1125 { 1126 if (propertyName == exec->propertyNames().length) { 1127 slot.setCustom(this, lengthGetter); 1128 return true; 1129 } 1130 1131 // array index ? 1132 bool ok; 1133 unsigned idx = propertyName.toUInt32(&ok); 1134 if (ok && idx < m_nodes.size()) { 1135 slot.setCustomIndex(this, idx, indexGetter); 1136 return true; 1137 } 1138 1139 // For IE compatibility, we need to be able to look up elements in a 1140 // document.formName.name result by id as well as be index. 1141 1142 AtomicString atomicPropertyName = propertyName; 1143 for (unsigned i = 0; i < m_nodes.size(); i++) { 1144 Node* node = m_nodes[i].get(); 1145 if (node->hasAttributes() && node->attributes()->id() == atomicPropertyName) { 1146 slot.setCustomIndex(this, i, indexGetter); 1147 return true; 1148 } 1149 } 1150 1151 return DOMObject::getOwnPropertySlot(exec, propertyName, slot); 1152 } 1153 1154 } // namespace 388 } // namespace KJS -
trunk/WebCore/bindings/js/kjs_dom.h
r21927 r22039 22 22 23 23 #include "JSNode.h" 24 #include "Node List.h"24 #include "Node.h" 25 25 #include "kjs_binding.h" 26 27 26 #include <wtf/Vector.h> 28 27 29 28 namespace WebCore { 30 class AtomicString;31 29 class Attr; 32 class CharacterData;33 class DocumentType;34 class DOMImplementation;35 class Element;36 class Entity;37 30 class EventTarget; 38 class EventTargetNode;39 class NamedNodeMap;40 class Notation;41 class ProcessingInstruction;42 class Text;43 31 } 44 32 45 33 namespace KJS { 46 34 47 KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE(DOMEventTargetNodePrototype, WebCore::JSNodePrototype)48 49 class DOMEventTargetNode : public WebCore::JSNode {50 public:51 DOMEventTargetNode(ExecState *exec, WebCore::Node *n);52 53 void setListener(ExecState* exec, const WebCore::AtomicString &eventType, JSValue* func) const;54 JSValue* getListener(const WebCore::AtomicString &eventType) const;55 virtual void pushEventHandlerScope(ExecState* exec, ScopeChain &scope) const;56 57 bool getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot);58 JSValue* getValueProperty(ExecState* exec, int token) const;59 virtual void put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr);60 void putValueProperty(ExecState* exec, int token, JSValue* value, int);61 62 enum {63 AddEventListener, RemoveEventListener, DispatchEvent,64 OnAbort, OnBlur, OnChange, OnClick, OnContextMenu, OnDblClick, OnError,65 OnDragEnter, OnDragOver, OnDragLeave, OnDrop, OnDragStart, OnDrag, OnDragEnd,66 OnBeforeCut, OnCut, OnBeforeCopy, OnCopy, OnBeforePaste, OnPaste, OnSelectStart,67 OnFocus, OnInput, OnKeyDown, OnKeyPress, OnKeyUp, OnLoad, OnMouseDown,68 OnMouseMove, OnMouseOut, OnMouseOver, OnMouseUp, OnMouseWheel, OnReset,69 OnResize, OnScroll, OnSearch, OnSelect, OnSubmit, OnUnload70 };71 };72 73 WebCore::EventTargetNode* toEventTargetNode(JSValue*); // returns 0 if passed-in value is not a EventTargetNode object74 WebCore::Node* toNode(JSValue*); // returns 0 if passed-in value is not a DOMNode object75 76 class DOMNodeList : public DOMObject {77 public:78 DOMNodeList(ExecState *, WebCore::NodeList *l);79 ~DOMNodeList();80 virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);81 JSValue *getValueProperty(ExecState *exec, int token) const;82 virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List&args);83 virtual bool implementsCall() const { return true; }84 // no put - all read-only85 virtual const ClassInfo* classInfo() const { return &info; }86 virtual bool toBoolean(ExecState *) const { return true; }87 static const ClassInfo info;88 enum { Length, Item };89 WebCore::NodeList *impl() const { return m_impl.get(); }90 91 private:92 static JSValue *indexGetter(ExecState *exec, JSObject *, const Identifier&, const PropertySlot& slot);93 static JSValue *nameGetter(ExecState *exec, JSObject *, const Identifier&, const PropertySlot& slot);94 95 RefPtr<WebCore::NodeList> m_impl;96 };97 98 35 WebCore::Attr* toAttr(JSValue*, bool& ok); 99 36 100 WebCore::Element *toElement(JSValue *); // returns 0 if passed-in value is not a DOMElement object101 102 WebCore::DocumentType *toDocumentType(JSValue *); // returns 0 if passed-in value is not a DOMDocumentType object103 104 class DOMNamedNodeMap : public DOMObject {105 public:106 DOMNamedNodeMap(ExecState *, WebCore::NamedNodeMap *m);107 ~DOMNamedNodeMap();108 virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);109 // no put - all read-only110 virtual const ClassInfo* classInfo() const { return &info; }111 virtual bool toBoolean(ExecState *) const { return true; }112 static const ClassInfo info;113 enum { GetNamedItem, SetNamedItem, RemoveNamedItem, Item,114 GetNamedItemNS, SetNamedItemNS, RemoveNamedItemNS };115 WebCore::NamedNodeMap *impl() const { return m_impl.get(); }116 private:117 static JSValue *lengthGetter(ExecState* exec, JSObject *, const Identifier&, const PropertySlot& slot);118 static JSValue *indexGetter(ExecState* exec, JSObject *, const Identifier&, const PropertySlot& slot);119 static JSValue *nameGetter(ExecState *exec, JSObject *, const Identifier&, const PropertySlot& slot);120 121 RefPtr<WebCore::NamedNodeMap> m_impl;122 };123 124 // Constructor for DOMException - constructor stuff not implemented yet125 class DOMExceptionConstructor : public DOMObject {126 public:127 DOMExceptionConstructor(ExecState*);128 virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);129 JSValue *getValueProperty(ExecState *exec, int token) const;130 // no put - all read-only131 virtual const ClassInfo* classInfo() const { return &info; }132 static const ClassInfo info;133 };134 135 JSValue* toJS(ExecState*, WebCore::Document*);136 37 bool checkNodeSecurity(ExecState*, WebCore::Node*); 137 38 JSValue* getRuntimeObject(ExecState*, WebCore::Node*); 138 JSValue* toJS(ExecState*, PassRefPtr<WebCore::Node>);139 JSValue* toJS(ExecState*, WebCore::NamedNodeMap*);140 JSValue* toJS(ExecState*, WebCore::NodeList*);141 39 JSValue* toJS(ExecState*, WebCore::EventTarget*); 142 40 JSObject* getNodeConstructor(ExecState*); 143 JSObject* getDOMExceptionConstructor(ExecState*);144 145 // Internal class, used for the collection return by e.g. document.forms.myinput146 // when multiple nodes have the same name.147 class DOMNamedNodesCollection : public DOMObject {148 public:149 DOMNamedNodesCollection(ExecState *exec, const Vector<RefPtr<WebCore::Node> >& nodes);150 virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);151 virtual const ClassInfo* classInfo() const { return &info; }152 static const ClassInfo info;153 private:154 static JSValue *lengthGetter(ExecState* exec, JSObject *, const Identifier&, const PropertySlot& slot);155 static JSValue *indexGetter(ExecState* exec, JSObject *, const Identifier&, const PropertySlot& slot);156 157 Vector<RefPtr<WebCore::Node> > m_nodes;158 };159 41 160 42 } // namespace -
trunk/WebCore/bindings/js/kjs_domnode.h
r21927 r22039 36 36 public: 37 37 virtual ~DOMNode(); 38 virtual bool toBoolean(ExecState*) const; 38 39 39 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); 40 40 JSValue *getValueProperty(ExecState*, int token) const; -
trunk/WebCore/bindings/js/kjs_events.cpp
r21706 r22039 22 22 #include "kjs_events.h" 23 23 24 #include "CString.h" 24 25 #include "Chrome.h" 25 #include "CString.h"26 26 #include "Clipboard.h" 27 27 #include "ClipboardEvent.h" … … 34 34 #include "HTMLNames.h" 35 35 #include "JSEvent.h" 36 #include "JSEventTargetNode.h" 36 37 #include "JSKeyboardEvent.h" 37 38 #include "JSMouseEvent.h" … … 335 336 JSValue* thisObj = toJS(exec, originalNode); 336 337 if (thisObj->isObject()) { 337 static_cast< DOMEventTargetNode*>(thisObj)->pushEventHandlerScope(exec, scope);338 static_cast<JSEventTargetNode*>(thisObj)->pushEventHandlerScope(exec, scope); 338 339 listenerAsFunction->setScope(scope); 339 340 } -
trunk/WebCore/bindings/js/kjs_html.cpp
r21842 r22039 34 34 #include "HTMLOptionsCollection.h" 35 35 #include "JSHTMLOptionsCollection.h" 36 #include "JSNamedNodesCollection.h" 37 #include "JSNodeList.h" 36 38 #include "NameNodeList.h" 37 39 #include "RenderLayer.h" … … 175 177 return toJS(exec, namedItems[0].get()); 176 178 177 return new DOMNamedNodesCollection(exec, namedItems);179 return new JSNamedNodesCollection(exec, namedItems); 178 180 } 179 181 -
trunk/WebCore/bindings/js/kjs_html.h
r21842 r22039 26 26 #include "JSElement.h" 27 27 #include "JSHTMLElement.h" 28 #include "kjs_dom.h" 28 29 29 30 namespace WebCore { -
trunk/WebCore/bindings/js/kjs_window.cpp
r22035 r22039 41 41 #include "JSCSSRule.h" 42 42 #include "JSCSSValue.h" 43 #include "JSDOMExceptionConstructor.h" 43 44 #include "JSDOMWindow.h" 44 45 #include "JSEvent.h" … … 2609 2610 return Window::retrieve(frame); 2610 2611 } 2611 2612 DOMWindow* toDOMWindow(JSValue* val)2613 {2614 return val->isObject(&JSDOMWindow::info) ? static_cast<JSDOMWindow*>(val)->impl() : 0;2615 }2616 2612 2617 2613 } // namespace WebCore -
trunk/WebCore/bindings/js/kjs_window.h
r21927 r22039 277 277 namespace WebCore { 278 278 KJS::JSValue* toJS(KJS::ExecState*, DOMWindow*); 279 DOMWindow* toDOMWindow(KJS::JSValue*);280 279 } // namespace WebCore 281 280 -
trunk/WebCore/bindings/objc/DOMInternal.mm
r21324 r22039 1 1 /* 2 * Copyright (C) 2004, 2006 Apple Computer,Inc. All rights reserved.2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 30 30 #import "Event.h" 31 31 #import "Frame.h" 32 #import "JSNode.h" 32 33 #import "Node.h" 33 34 #import "PlatformString.h" … … 37 38 #import "WebScriptObjectPrivate.h" 38 39 #import "XPathEvaluator.h" 39 #import "kjs_dom.h"40 40 #import "kjs_proxy.h" 41 41 … … 118 118 119 119 // Get (or create) a cached JS object for the DOM node. 120 KJS::JSObject *scriptImp = static_cast<KJS::JSObject*>( KJS::toJS(exec, nodeImpl));120 KJS::JSObject *scriptImp = static_cast<KJS::JSObject*>(WebCore::toJS(exec, nodeImpl)); 121 121 122 122 KJS::Bindings::RootObject* rootObject = frame->bindingRootObject(); -
trunk/WebCore/bindings/objc/DOMUtility.mm
r21910 r22039 38 38 #import "JSHTMLOptionsCollection.h" 39 39 #import "JSMediaList.h" 40 #import "JSNamedNodeMap.h" 40 41 #import "JSNodeIterator.h" 42 #import "JSNodeList.h" 41 43 #import "JSRange.h" 42 44 #import "JSStyleSheet.h" … … 77 79 WRAP(HTMLOptionsCollection) 78 80 WRAP(MediaList) 81 WRAP(NamedNodeMap) 82 WRAP(NodeList) 79 83 WRAP(Range) 80 84 WRAP(StyleSheet) … … 89 93 90 94 WRAP(Event) 91 WRAP(NamedNodeMap)92 95 WRAP(Node) 93 WRAP(NodeList)94 96 WRAP(RGBColor) 95 97 WRAP(Rect) -
trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm
r22035 r22039 162 162 my $type = shift; 163 163 164 return 1 if $type eq " SVGPathSeg" or $type eq "StyleSheet" or $type eq "CSSRule" or $type eq "CSSValue";164 return 1 if $type eq "Node" or $type eq "Document" or $type eq "SVGPathSeg" or $type eq "StyleSheet" or $type eq "CSSRule" or $type eq "CSSValue"; 165 165 return 0; 166 166 } … … 367 367 # Custom call functions 368 368 if ($dataNode->extendedAttributes->{"CustomCall"}) { 369 push(@headerContent, " virtual KJS::JSValue* callAsFunction(KJS::ExecState*, KJS::JSObject*, const KJS::List& args);\n");369 push(@headerContent, " virtual KJS::JSValue* callAsFunction(KJS::ExecState*, KJS::JSObject*, const KJS::List&);\n"); 370 370 push(@headerContent, " virtual bool implementsCall() const;\n\n"); 371 371 } … … 476 476 if ($dataNode->extendedAttributes->{"HasNameGetter"} || $dataNode->extendedAttributes->{"HasOverridingNameGetter"}) { 477 477 push(@headerContent, "private:\n"); 478 push(@headerContent, " static bool canGetItemsForName(KJS::ExecState*, $implClassName*, const KJS::Identifier&);\n"); 478 479 push(@headerContent, " static KJS::JSValue* nameGetter(KJS::ExecState*, KJS::JSObject*, const KJS::Identifier&, const KJS::PropertySlot&);\n"); 479 push(@headerContent, " static bool canGetItemsForName(KJS::ExecState*, $implClassName*, const KJS::Identifier&);\n")480 480 } 481 481 482 482 push(@headerContent, "};\n\n"); 483 483 484 if (!$hasParent ) {484 if (!$hasParent || $dataNode->extendedAttributes->{"GenerateToJS"}) { 485 485 if ($podType) { 486 486 push(@headerContent, "KJS::JSValue* toJS(KJS::ExecState*, JSSVGPODTypeWrapper<$podType>*);\n"); 487 } elsif ($interfaceName eq "Node") { 488 push(@headerContent, "KJS::JSValue* toJS(KJS::ExecState*, PassRefPtr<Node>);\n"); 487 489 } else { 488 490 push(@headerContent, "KJS::JSValue* toJS(KJS::ExecState*, $passType);\n"); … … 789 791 push(@implContent, "bool ${className}::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n"); 790 792 push(@implContent, "{\n"); 791 # FIXME: We need to provide scalable hooks/attributes for this kind of extension 792 if ($interfaceName eq "DOMWindow") { 793 push(@implContent, " if (getOverridePropertySlot(exec, propertyName, slot))\n"); 794 push(@implContent, " return true;\n"); 793 794 if ($interfaceName eq "NamedNodeMap") { 795 push(@implContent, " JSValue* proto = prototype();\n"); 796 push(@implContent, " if (proto->isObject() && static_cast<JSObject*>(proto)->hasProperty(exec, propertyName))\n"); 797 push(@implContent, " return false;\n"); 795 798 } 796 799 … … 830 833 831 834 if ($dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}) { 832 push(@implContent, " bool didGet = customGetOwnPropertySlot(exec, propertyName, slot);\n"); 833 push(@implContent, " if (didGet)\n"); 835 push(@implContent, " if (customGetOwnPropertySlot(exec, propertyName, slot))\n"); 834 836 push(@implContent, " return true;\n"); 835 837 } … … 867 869 push(@implContent, " return checkNodeSecurity(exec, imp->contentDocument()) ? " . NativeToJSValue($attribute->signature, $implClassNameForValueConversion, "imp->$name()") . " : jsUndefined();\n"); 868 870 $implIncludes{"Document.h"} = 1; 871 $implIncludes{"kjs_dom.h"} = 1; 869 872 } elsif ($attribute->signature->type =~ /Constructor$/) { 870 873 my $constructorType = $codeGenerator->StripModule($attribute->signature->type); … … 1065 1068 push(@implContent, " if (!checkNodeSecurity(exec, imp->getSVGDocument(" . (@{$function->raisesExceptions} ? "ec" : "") .")))\n"); 1066 1069 push(@implContent, " return jsUndefined();\n"); 1070 $implIncludes{"kjs_dom.h"} = 1; 1067 1071 } 1068 1072 … … 1145 1149 } 1146 1150 1147 if ( !$hasParentand !UsesManualToJSImplementation($implClassName)) {1151 if ((!$hasParent or $dataNode->extendedAttributes->{"GenerateToJS"}) and !UsesManualToJSImplementation($implClassName)) { 1148 1152 if ($podType) { 1149 1153 push(@implContent, "KJS::JSValue* toJS(KJS::ExecState* exec, JSSVGPODTypeWrapper<$podType>* obj)\n"); … … 1329 1333 } 1330 1334 1331 if ($type eq "Node") {1332 $implIncludes{"kjs_dom.h"} = 1;1333 return "toNode($value)";1334 }1335 1336 1335 if ($type eq "EventTarget") { 1337 $implIncludes{" kjs_dom.h"} = 1;1336 $implIncludes{"JSEventTargetNode.h"} = 1; 1338 1337 return "toEventTargetNode($value)"; 1339 1338 } … … 1342 1341 $implIncludes{"kjs_dom.h"} = 1; 1343 1342 return "toAttr($value${maybeOkParam})"; 1344 }1345 1346 if ($type eq "DocumentType") {1347 $implIncludes{"kjs_dom.h"} = 1;1348 return "toDocumentType($value)";1349 }1350 1351 if ($type eq "Element") {1352 $implIncludes{"kjs_dom.h"} = 1;1353 return "toElement($value)";1354 }1355 1356 if ($type eq "DOMWindow") {1357 $implIncludes{"kjs_window.h"} = 1;1358 return "toDOMWindow($value)";1359 1343 } 1360 1344 … … 1445 1429 } 1446 1430 1447 if ($type eq "DOMImplementation") { 1431 if ($type eq "EventTarget") { 1432 $implIncludes{"EventTargetNode.h"} = 1; 1433 $implIncludes{"JSEventTargetNode.h"} = 1; 1448 1434 $implIncludes{"kjs_dom.h"} = 1; 1449 $implIncludes{"JSDOMImplementation.h"} = 1;1450 } elsif ($type eq "Attr" or1451 $type eq "CDATASection" or1452 $type eq "Comment" or1453 $type eq "Document" or1454 $type eq "DocumentFragment" or1455 $type eq "DocumentType" or1456 $type eq "Element" or1457 $type eq "EntityReference" or1458 $type eq "HTMLDocument" or1459 $type eq "Node" or1460 $type eq "ProcessingInstruction" or1461 $type eq "Text") {1462 $implIncludes{"kjs_dom.h"} = 1;1463 $implIncludes{"Comment.h"} = 1;1464 $implIncludes{"CDATASection.h"} = 1;1465 $implIncludes{"Node.h"} = 1;1466 $implIncludes{"Element.h"} = 1;1467 $implIncludes{"DocumentType.h"} = 1;1468 } elsif ($type eq "EventTarget") {1469 $implIncludes{"kjs_dom.h"} = 1;1470 $implIncludes{"EventTargetNode.h"} = 1;1471 1435 } elsif ($type eq "Event") { 1472 1436 $implIncludes{"kjs_events.h"} = 1; 1473 1437 $implIncludes{"Event.h"} = 1; 1474 1438 } elsif ($type eq "NodeList") { 1475 $implIncludes{" kjs_dom.h"} = 1;1476 $implIncludes{" NodeList.h"} = 1;1439 $implIncludes{"JS$type.h"} = 1; 1440 $implIncludes{"$type.h"} = 1; 1477 1441 $implIncludes{"NameNodeList.h"} = 1; 1478 } elsif ($type eq "NamedNodeMap") {1479 $implIncludes{"kjs_dom.h"} = 1;1480 $implIncludes{"NamedNodeMap.h"} = 1;1481 1442 } elsif ($type eq "Rect") { 1482 1443 $implIncludes{"RectImpl.h"} = 1; … … 1489 1450 } elsif ($type eq "DOMObject") { 1490 1451 $implIncludes{"JSCanvasRenderingContext2D.h"} = 1; 1491 } elsif ($type eq "HTMLFormElement") {1492 $implIncludes{"kjs_html.h"} = 1;1493 $implIncludes{"HTMLFormElement.h"} = 1;1494 1452 } elsif ($type =~ /SVGPathSeg/) { 1495 1453 $implIncludes{"JS$type.h"} = 1; … … 1769 1727 put(exec, exec->propertyNames().length, jsNumber(len), DontDelete|ReadOnly|DontEnum); 1770 1728 } 1771 virtual JSValue* callAsFunction(ExecState* exec, JSObject* thisObj, const List& args);1729 virtual JSValue* callAsFunction(ExecState*, JSObject*, const List&); 1772 1730 private: 1773 1731 int id; -
trunk/WebCore/bridge/mac/WebCoreAXObject.mm
r21917 r22039 32 32 #import "FocusController.h" 33 33 #import "FontData.h" 34 #import "Frame.h" 34 35 #import "FrameLoader.h" 35 #import "Frame.h"36 36 #import "FrameView.h" 37 37 #import "HTMLAreaElement.h" … … 47 47 #import "HitTestResult.h" 48 48 #import "LocalizedStrings.h" 49 #import "NodeList.h" 49 50 #import "Page.h" 50 51 #import "RenderImage.h" -
trunk/WebCore/dom/Attr.idl
r21489 r22039 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 4 * … … 21 21 module core { 22 22 23 interface [ LegacyParent=KJS::DOMEventTargetNode,GenerateConstructor] Attr : EventTargetNode {23 interface [GenerateConstructor] Attr : EventTargetNode { 24 24 25 25 // DOM Level 1 -
trunk/WebCore/dom/CharacterData.idl
r21489 r22039 1 1 /* 2 * Copyright (C) 2006, 2007 Apple Inc. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 20 20 module core { 21 21 22 interface [ LegacyParent=KJS::DOMEventTargetNode,GenerateConstructor] CharacterData : EventTargetNode {22 interface [GenerateConstructor] CharacterData : EventTargetNode { 23 23 24 24 attribute [ConvertNullToNullString] DOMString data -
trunk/WebCore/dom/Document.idl
r21470 r22039 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org> 4 4 * … … 21 21 module core { 22 22 23 interface [ LegacyParent=KJS::DOMEventTargetNode, GenerateConstructor, CustomMarkFunction] Document : EventTargetNode {23 interface [GenerateConstructor, GenerateToJS, CustomMarkFunction] Document : EventTargetNode { 24 24 25 25 // DOM Level 1 Core -
trunk/WebCore/dom/DocumentFragment.idl
r14298 r22039 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 20 20 module core { 21 21 22 interface [ LegacyParent=KJS::DOMEventTargetNode,GenerateConstructor] DocumentFragment : EventTargetNode {22 interface [GenerateConstructor] DocumentFragment : EventTargetNode { 23 23 }; 24 24 -
trunk/WebCore/dom/DocumentType.idl
r21308 r22039 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 3 * 4 4 * This library is free software; you can redistribute it and/or … … 20 20 module core { 21 21 22 interface [GenerateConstructor ] DocumentType : Node {22 interface [GenerateConstructor, GenerateNativeConverter] DocumentType : Node { 23 23 24 24 // DOM Level 1 -
trunk/WebCore/dom/Element.idl
r18134 r22039 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 4 * … … 21 21 module core { 22 22 23 interface [ LegacyParent=KJS::DOMEventTargetNode, GenerateConstructor] Element : EventTargetNode {23 interface [GenerateConstructor, GenerateNativeConverter] Element : EventTargetNode { 24 24 25 25 // DOM Level 1 Core -
trunk/WebCore/dom/NamedNodeMap.idl
r16299 r22039 1 1 /* 2 2 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 3 * Copyright (C) 2007 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 20 21 module core { 21 22 22 interface NamedNodeMap {23 interface [GenerateConstructor, HasIndexGetter, HasNameGetter] NamedNodeMap { 23 24 24 25 Node getNamedItem(in DOMString name); … … 37 38 // Introduced in DOM Level 2: 38 39 39 [OldStyleObjC] Node getNamedItemNS(in DOMString namespaceURI,40 [OldStyleObjC] Node getNamedItemNS(in [ConvertNullToNullString] DOMString namespaceURI, 40 41 in DOMString localName) 41 42 // FIXME: the implementation does take an exceptioncode parameter. … … 45 46 raises(DOMException); 46 47 47 [OldStyleObjC] Node removeNamedItemNS(in DOMString namespaceURI,48 [OldStyleObjC] Node removeNamedItemNS(in [ConvertNullToNullString] DOMString namespaceURI, 48 49 in DOMString localName) 49 50 raises(DOMException); -
trunk/WebCore/dom/Node.idl
r21470 r22039 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc.2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 4 * … … 21 21 module core { 22 22 23 interface [LegacyParent=KJS::DOMNode, GenerateConstructor, ObjCCustomInternalImpl] Node {23 interface [LegacyParent=KJS::DOMNode, GenerateConstructor, GenerateNativeConverter, GenerateToJS, ObjCCustomInternalImpl] Node { 24 24 // NodeType 25 25 const unsigned short ELEMENT_NODE = 1; -
trunk/WebCore/dom/NodeList.idl
r16068 r22039 1 1 /* 2 2 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 3 * Copyright (C) 2007 Apple Inc. All rights reserved. 3 4 * 4 5 * This library is free software; you can redistribute it and/or … … 20 21 module core { 21 22 22 interface NodeList {23 interface [GenerateConstructor, HasIndexGetter, HasNameGetter, CustomCall] NodeList { 23 24 24 25 Node item(in [IsIndex] unsigned long index); -
trunk/WebCore/page/DOMWindow.idl
r21911 r22039 28 28 // You can't cache the Window object in the global object because it *is* the global object. 29 29 // For the same reason, there's no need to. 30 interface [LegacyParent=KJS::Window, DoNotCache ] DOMWindow {30 interface [LegacyParent=KJS::Window, DoNotCache, GenerateNativeConverter, CustomGetOwnPropertySlot] DOMWindow { 31 31 // DOM Level 2 AbstractView Interface 32 32 readonly attribute Document document; … … 73 73 attribute DocumentConstructor Document; 74 74 attribute NodeConstructor Node; 75 //attribute NodeListConstructor NodeList;76 //attribute NamedNodeMapConstructor NamedNodeMap;75 attribute NodeListConstructor NodeList; 76 attribute NamedNodeMapConstructor NamedNodeMap; 77 77 attribute CharacterDataConstructor CharacterData; 78 78 attribute AttrConstructor Attr;
Note: See TracChangeset
for help on using the changeset viewer.