Commit 9ce7dcca authored by ap's avatar ap
Browse files

Reviewed by Darin.

        http://bugs.webkit.org/show_bug.cgi?id=10934
        REGRESSION: prototype.js logs error (HTMLFormElement) on webkit builds

        Added constructors for most HTML elements; started auto-generating HTMLSelectElement JS binding.

        Test: fast/dom/Window/element-constructors-on-window.html

        * DerivedSources.make: Generate JSHTMLSelectElement.
        * WebCore.xcodeproj/project.pbxproj: Added JSHTMLSelectElement{Custom}.
        * bindings/js/JSHTMLElementWrapperFactory.cpp: Create a proper binding for SELECT.

        * bindings/js/kjs_html.cpp:
        (KJS::):
        (KJS::JSHTMLElement::classInfo):
        (KJS::JSHTMLElement::accessors):
        (KJS::JSHTMLElement::getOwnPropertySlot):
        (KJS::HTMLElementFunction::callAsFunction):
        (KJS::JSHTMLElement::put):
        * bindings/js/kjs_html.h:
        (KJS::JSHTMLElement::):
        Removed everything related to SELECT. Renamed getHTMLOptionsCollection to toJS for autogenerated code 
        to be happy, and rewrote it using cacheDOMObject.

        * bindings/scripts/CodeGeneratorJS.pm: Added HTMLElement to the list of types that cannot fail conversion.

        * html/HTMLAnchorElement.idl:
        * html/HTMLAppletElement.idl:
        * html/HTMLAreaElement.idl:
        * html/HTMLBRElement.idl:
        * html/HTMLBaseElement.idl:
        * html/HTMLBaseFontElement.idl:
        * html/HTMLBodyElement.idl:
        * html/HTMLButtonElement.idl:
        * html/HTMLCanvasElement.idl:
        * html/HTMLDListElement.idl:
        * html/HTMLDirectoryElement.idl:
        * html/HTMLDivElement.idl:
        * html/HTMLFieldSetElement.idl:
        * html/HTMLFontElement.idl:
        * html/HTMLFormElement.idl:
        * html/HTMLHRElement.idl:
        * html/HTMLHeadElement.idl:
        * html/HTMLHeadingElement.idl:
        * html/HTMLHtmlElement.idl:
        * html/HTMLImageElement.idl:
        * html/HTMLInputElement.idl:
        * html/HTMLIsIndexElement.idl:
        * html/HTMLLIElement.idl:
        * html/HTMLLabelElement.idl:
        * html/HTMLLegendElement.idl:
        * html/HTMLLinkElement.idl:
        * html/HTMLMapElement.idl:
        * html/HTMLMenuElement.idl:
        * html/HTMLMetaElement.idl:
        * html/HTMLModElement.idl:
        * html/HTMLOListElement.idl:
        * html/HTMLOptGroupElement.idl:
        * html/HTMLParagraphElement.idl:
        * html/HTMLParamElement.idl:
        * html/HTMLPreElement.idl:
        * html/HTMLQuoteElement.idl:
        * html/HTMLScriptElement.idl:
        * html/HTMLStyleElement.idl:
        * html/HTMLTextAreaElement.idl:
        * html/HTMLTitleElement.idl:
        * html/HTMLUListElement.idl:
        Generate constructors.

        * html/HTMLSelectElement.cpp:
        (WebCore::HTMLSelectElement::length):
        * html/HTMLSelectElement.h:
        Make length() return unsigned for auto-generated code to be happy.

        * html/HTMLSelectElement.idl: Adjusted to be usable for JS.

        * bindings/JSHTMLSelectElementCustom.cpp: Added. Implements remove().

        * page/DOMWindow.idl:
        Added properties for most elements' constructors.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@19024 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 46f7ec9c
2007-01-21 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=10934
REGRESSION: prototype.js logs error (HTMLFormElement) on webkit builds
* fast/dom/Window/window-properties-expected.txt: Updated results.
* fast/dom/Window/element-constructors-on-window.html: Added a more explicit test
for element constructors, as it isn't always easy to recognize regressions via window-properties.html.
* fast/dom/Window/element-constructors-on-window-expected.txt: Added.
2007-01-21 Mitz Pettel <mitz@webkit.org>
 
Reviewed by Darin.
Test that HTML element constructors are accessible as window object properties.
HTMLElement: [object HTMLElementConstructor]
HTMLAnchorElement: [object HTMLAnchorElementConstructor]
HTMLAppletElement: [object HTMLAppletElementConstructor]
HTMLAreaElement: [object HTMLAreaElementConstructor]
HTMLBaseElement: [object HTMLBaseElementConstructor]
HTMLBaseFontElement: [object HTMLBaseFontElementConstructor]
HTMLBodyElement: [object HTMLBodyElementConstructor]
HTMLBRElement: [object HTMLBRElementConstructor]
HTMLButtonElement: [object HTMLButtonElementConstructor]
HTMLDirectoryElement: [object HTMLDirectoryElementConstructor]
HTMLDivElement: [object HTMLDivElementConstructor]
HTMLDListElement: [object HTMLDListElementConstructor]
HTMLFieldSetElement: [object HTMLFieldSetElementConstructor]
HTMLFontElement: [object HTMLFontElementConstructor]
HTMLFormElement: [object HTMLFormElementConstructor]
HTMLFrameElement: undefined
HTMLFrameSetElement: undefined
HTMLHeadElement: [object HTMLHeadElementConstructor]
HTMLHeadingElement: [object HTMLHeadingElementConstructor]
HTMLHRElement: [object HTMLHRElementConstructor]
HTMLHtmlElement: [object HTMLHtmlElementConstructor]
HTMLIFrameElement: undefined
HTMLImageElement: [object HTMLImageElementConstructor]
HTMLInputElement: [object HTMLInputElementConstructor]
HTMLIsIndexElement: [object HTMLIsIndexElementConstructor]
HTMLLabelElement: [object HTMLLabelElementConstructor]
HTMLLegendElement: [object HTMLLegendElementConstructor]
HTMLLIElement: [object HTMLLIElementConstructor]
HTMLLinkElement: [object HTMLLinkElementConstructor]
HTMLMapElement: [object HTMLMapElementConstructor]
HTMLMenuElement: [object HTMLMenuElementConstructor]
HTMLMetaElement: [object HTMLMetaElementConstructor]
HTMLModElement: [object HTMLModElementConstructor]
HTMLObjectElement: undefined
HTMLOListElement: [object HTMLOListElementConstructor]
HTMLOptGroupElement: [object HTMLOptGroupElementConstructor]
HTMLOptionElement: [object HTMLElementConstructor]
HTMLParagraphElement: [object HTMLParagraphElementConstructor]
HTMLParamElement: [object HTMLParamElementConstructor]
HTMLPreElement: [object HTMLPreElementConstructor]
HTMLQuoteElement: [object HTMLQuoteElementConstructor]
HTMLScriptElement: [object HTMLScriptElementConstructor]
HTMLSelectElement: [object HTMLSelectElementConstructor]
HTMLStyleElement: [object HTMLStyleElementConstructor]
HTMLTableCaptionElement: undefined
HTMLTableCellElement: undefined
HTMLTableColElement: undefined
HTMLTableElement: undefined
HTMLTableRowElement: undefined
HTMLTableSectionElement: undefined
HTMLTextAreaElement: [object HTMLTextAreaElementConstructor]
HTMLTitleElement: [object HTMLTitleElementConstructor]
HTMLUListElement: [object HTMLUListElementConstructor]
HTMLCanvasElement: [object HTMLCanvasElementConstructor]
HTMLInsElement: undefined
HTMLDelElement: undefined
HTMLEmbedElement: undefined
<html>
<body>
<p>Test that HTML element constructors are accessible as window object properties.</p>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
function test(className) {
document.write("<p>" + className + ": " + eval("window." + className) + "</p>");
}
test("HTMLElement");
// DOM 2 elements
test("HTMLAnchorElement");
test("HTMLAppletElement");
test("HTMLAreaElement");
test("HTMLBaseElement");
test("HTMLBaseFontElement");
test("HTMLBodyElement");
test("HTMLBRElement");
test("HTMLButtonElement");
test("HTMLDirectoryElement");
test("HTMLDivElement");
test("HTMLDListElement");
test("HTMLFieldSetElement");
test("HTMLFontElement");
test("HTMLFormElement");
test("HTMLFrameElement");
test("HTMLFrameSetElement");
test("HTMLHeadElement");
test("HTMLHeadingElement");
test("HTMLHRElement");
test("HTMLHtmlElement");
test("HTMLIFrameElement");
test("HTMLImageElement");
test("HTMLInputElement");
test("HTMLIsIndexElement");
test("HTMLLabelElement");
test("HTMLLegendElement");
test("HTMLLIElement");
test("HTMLLinkElement");
test("HTMLMapElement");
test("HTMLMenuElement");
test("HTMLMetaElement");
test("HTMLModElement");
test("HTMLObjectElement");
test("HTMLOListElement");
test("HTMLOptGroupElement");
test("HTMLOptionElement");
test("HTMLParagraphElement");
test("HTMLParamElement");
test("HTMLPreElement");
test("HTMLQuoteElement");
test("HTMLScriptElement");
test("HTMLSelectElement");
test("HTMLStyleElement");
test("HTMLTableCaptionElement");
test("HTMLTableCellElement");
test("HTMLTableColElement");
test("HTMLTableElement");
test("HTMLTableRowElement");
test("HTMLTableSectionElement");
test("HTMLTextAreaElement");
test("HTMLTitleElement");
test("HTMLUListElement");
// Some other elements
test("HTMLCanvasElement");
test("HTMLInsElement");
test("HTMLDelElement");
test("HTMLEmbedElement");
</script>
</body>
</html>
2007-01-21 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
http://bugs.webkit.org/show_bug.cgi?id=10934
REGRESSION: prototype.js logs error (HTMLFormElement) on webkit builds
Added constructors for most HTML elements; started auto-generating HTMLSelectElement JS binding.
Test: fast/dom/Window/element-constructors-on-window.html
* DerivedSources.make: Generate JSHTMLSelectElement.
* WebCore.xcodeproj/project.pbxproj: Added JSHTMLSelectElement{Custom}.
* bindings/js/JSHTMLElementWrapperFactory.cpp: Create a proper binding for SELECT.
* bindings/js/kjs_html.cpp:
(KJS::):
(KJS::JSHTMLElement::classInfo):
(KJS::JSHTMLElement::accessors):
(KJS::JSHTMLElement::getOwnPropertySlot):
(KJS::HTMLElementFunction::callAsFunction):
(KJS::JSHTMLElement::put):
* bindings/js/kjs_html.h:
(KJS::JSHTMLElement::):
Removed everything related to SELECT. Renamed getHTMLOptionsCollection to toJS for autogenerated code
to be happy, and rewrote it using cacheDOMObject.
* bindings/scripts/CodeGeneratorJS.pm: Added HTMLElement to the list of types that cannot fail conversion.
* html/HTMLAnchorElement.idl:
* html/HTMLAppletElement.idl:
* html/HTMLAreaElement.idl:
* html/HTMLBRElement.idl:
* html/HTMLBaseElement.idl:
* html/HTMLBaseFontElement.idl:
* html/HTMLBodyElement.idl:
* html/HTMLButtonElement.idl:
* html/HTMLCanvasElement.idl:
* html/HTMLDListElement.idl:
* html/HTMLDirectoryElement.idl:
* html/HTMLDivElement.idl:
* html/HTMLFieldSetElement.idl:
* html/HTMLFontElement.idl:
* html/HTMLFormElement.idl:
* html/HTMLHRElement.idl:
* html/HTMLHeadElement.idl:
* html/HTMLHeadingElement.idl:
* html/HTMLHtmlElement.idl:
* html/HTMLImageElement.idl:
* html/HTMLInputElement.idl:
* html/HTMLIsIndexElement.idl:
* html/HTMLLIElement.idl:
* html/HTMLLabelElement.idl:
* html/HTMLLegendElement.idl:
* html/HTMLLinkElement.idl:
* html/HTMLMapElement.idl:
* html/HTMLMenuElement.idl:
* html/HTMLMetaElement.idl:
* html/HTMLModElement.idl:
* html/HTMLOListElement.idl:
* html/HTMLOptGroupElement.idl:
* html/HTMLParagraphElement.idl:
* html/HTMLParamElement.idl:
* html/HTMLPreElement.idl:
* html/HTMLQuoteElement.idl:
* html/HTMLScriptElement.idl:
* html/HTMLStyleElement.idl:
* html/HTMLTextAreaElement.idl:
* html/HTMLTitleElement.idl:
* html/HTMLUListElement.idl:
Generate constructors.
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::length):
* html/HTMLSelectElement.h:
Make length() return unsigned for auto-generated code to be happy.
* html/HTMLSelectElement.idl: Adjusted to be usable for JS.
* bindings/JSHTMLSelectElementCustom.cpp: Added. Implements remove().
* page/DOMWindow.idl:
Added properties for most elements' constructors.
2007-01-21 Mark Rowe <mrowe@apple.com>
Reviewed by Maciej.
......
......@@ -359,6 +359,7 @@ all : \
JSHTMLParamElement.h \
JSHTMLPreElement.h \
JSHTMLScriptElement.h \
JSHTMLSelectElement.h \
JSHTMLStyleElement.h \
JSHTMLTextAreaElement.h \
JSHTMLTitleElement.h \
......
......@@ -2840,8 +2840,11 @@
E14842FF0A674A31007E4D39 /* TextCodecICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E14842FE0A674A31007E4D39 /* TextCodecICU.cpp */; };
E148432F0A674FC2007E4D39 /* TextCodecMac.h in Headers */ = {isa = PBXBuildFile; fileRef = E148432E0A674FC2007E4D39 /* TextCodecMac.h */; };
E14843D60A6754A6007E4D39 /* TextCodecMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E14843910A6752BF007E4D39 /* TextCodecMac.cpp */; };
E1A9B6670B6340CE0084FCDB /* JSHTMLSelectElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1A9B6660B6340CE0084FCDB /* JSHTMLSelectElementCustom.cpp */; };
E1D8E3160B29E39C00F4BAF6 /* HTTPParsers.h in Headers */ = {isa = PBXBuildFile; fileRef = E1D8E3150B29E39C00F4BAF6 /* HTTPParsers.h */; };
E1D8E31A0B29E3B600F4BAF6 /* HTTPParsers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1D8E3190B29E3B600F4BAF6 /* HTTPParsers.cpp */; };
E1E6EEA40B628DA8005F2F70 /* JSHTMLSelectElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1E6EEA30B628DA8005F2F70 /* JSHTMLSelectElement.cpp */; };
E1E6EEA80B628DB3005F2F70 /* JSHTMLSelectElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E1E6EEA70B628DB3005F2F70 /* JSHTMLSelectElement.h */; };
E1EBBBD40AAC9B87001FE8E2 /* CSSCharsetRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1EBBBD30AAC9B87001FE8E2 /* CSSCharsetRule.cpp */; };
E1F0424609839389006694EA /* xmlhttprequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1F0424409839389006694EA /* xmlhttprequest.cpp */; };
E1F0424709839389006694EA /* xmlhttprequest.h in Headers */ = {isa = PBXBuildFile; fileRef = E1F0424509839389006694EA /* xmlhttprequest.h */; };
......@@ -5989,8 +5992,11 @@
E14842FE0A674A31007E4D39 /* TextCodecICU.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextCodecICU.cpp; sourceTree = "<group>"; };
E148432E0A674FC2007E4D39 /* TextCodecMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = TextCodecMac.h; path = mac/TextCodecMac.h; sourceTree = "<group>"; };
E14843910A6752BF007E4D39 /* TextCodecMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = TextCodecMac.cpp; path = mac/TextCodecMac.cpp; sourceTree = "<group>"; };
E1A9B6660B6340CE0084FCDB /* JSHTMLSelectElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSHTMLSelectElementCustom.cpp; path = ../JSHTMLSelectElementCustom.cpp; sourceTree = "<group>"; };
E1D8E3150B29E39C00F4BAF6 /* HTTPParsers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTTPParsers.h; sourceTree = "<group>"; };
E1D8E3190B29E3B600F4BAF6 /* HTTPParsers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTTPParsers.cpp; sourceTree = "<group>"; };
E1E6EEA30B628DA8005F2F70 /* JSHTMLSelectElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLSelectElement.cpp; sourceTree = "<group>"; };
E1E6EEA70B628DB3005F2F70 /* JSHTMLSelectElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = JSHTMLSelectElement.h; sourceTree = "<group>"; };
E1EBBBD30AAC9B87001FE8E2 /* CSSCharsetRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSCharsetRule.cpp; sourceTree = "<group>"; };
E1F0424409839389006694EA /* xmlhttprequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xmlhttprequest.cpp; sourceTree = "<group>"; };
E1F0424509839389006694EA /* xmlhttprequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xmlhttprequest.h; sourceTree = "<group>"; };
......@@ -6526,6 +6532,8 @@
1AE2AEC40A1D297B00B42B25 /* JSHTMLQuoteElement.h */,
1AE2ABA40A1CE90500B42B25 /* JSHTMLScriptElement.cpp */,
1AE2ABA50A1CE90500B42B25 /* JSHTMLScriptElement.h */,
E1E6EEA30B628DA8005F2F70 /* JSHTMLSelectElement.cpp */,
E1E6EEA70B628DB3005F2F70 /* JSHTMLSelectElement.h */,
A80E7B050A19D606007FB8C5 /* JSHTMLStyleElement.cpp */,
A80E7B040A19D606007FB8C5 /* JSHTMLStyleElement.h */,
A80E7E940A1A83E3007FB8C5 /* JSHTMLTextAreaElement.cpp */,
......@@ -8791,6 +8799,7 @@
A826E8AD0A1A8F2300CD1BB6 /* JSHTMLOptionElementConstructor.cpp */,
A826E8AC0A1A8F2300CD1BB6 /* JSHTMLOptionElementConstructor.h */,
448AD27A0A4813790023D179 /* JSHTMLOptionsCollectionCustom.cpp */,
E1A9B6660B6340CE0084FCDB /* JSHTMLSelectElementCustom.cpp */,
1A750DD30A90E729000FF215 /* JSNodeIteratorCustom.cpp */,
8574D1F10ADE6122004CBA11 /* JSSVGElementWrapperFactory.cpp */,
8574D1F20ADE6122004CBA11 /* JSSVGElementWrapperFactory.h */,
......@@ -11006,6 +11015,7 @@
B24055660B5BE640002A28C0 /* DOMSVGElementInstanceListInternal.h in Headers */,
1A2A68240B5BEDE70002A480 /* ProgressTracker.h in Headers */,
A80CEBAC0B60FC49007637C1 /* SVGMPathElement.h in Headers */,
E1E6EEA80B628DB3005F2F70 /* JSHTMLSelectElement.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -12346,6 +12356,8 @@
B2F273F30B5BFAC80068C956 /* SVGElementInstanceList.cpp in Sources */,
1A2A68230B5BEDE70002A480 /* ProgressTracker.cpp in Sources */,
A80CEBAD0B60FC49007637C1 /* SVGMPathElement.cpp in Sources */,
E1E6EEA40B628DA8005F2F70 /* JSHTMLSelectElement.cpp in Sources */,
E1A9B6670B6340CE0084FCDB /* JSHTMLSelectElementCustom.cpp in Sources */,
929264770B61FC7200B41D34 /* JSDocumentCustom.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
/*
* Copyright (C) 2007 Apple, Inc.
* Copyright (C) 2007 Alexey Proskuryakov (ap@webkit.org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "JSHTMLSelectElement.h"
#include "HTMLNames.h"
#include "HTMLOptionElement.h"
#include "HTMLSelectElement.h"
namespace WebCore {
using namespace KJS;
using namespace HTMLNames;
JSValue* JSHTMLSelectElement::remove(ExecState* exec, const List& args)
{
HTMLSelectElement& select = *static_cast<HTMLSelectElement*>(impl());
// we support both options index and options objects
HTMLElement* element = toHTMLElement(args[0]);
if (element && element->hasTagName(optionTag))
select.remove(static_cast<HTMLOptionElement*>(element)->index());
else
select.remove(static_cast<int>(args[0]->toNumber(exec)));
return jsUndefined();
}
}
......@@ -58,6 +58,7 @@
#include "HTMLPreElement.h"
#include "HTMLQuoteElement.h"
#include "HTMLScriptElement.h"
#include "HTMLSelectElement.h"
#include "HTMLStyleElement.h"
#include "HTMLTextAreaElement.h"
#include "HTMLTitleElement.h"
......@@ -104,6 +105,7 @@
#include "JSHTMLPreElement.h"
#include "JSHTMLQuoteElement.h"
#include "JSHTMLScriptElement.h"
#include "JSHTMLSelectElement.h"
#include "JSHTMLStyleElement.h"
#include "JSHTMLTextAreaElement.h"
#include "JSHTMLTitleElement.h"
......@@ -161,6 +163,7 @@ typedef DOMNode* (*CreateHTMLElementWrapperFunction)(ExecState*, PassRefPtr<HTML
macro(pre, Pre) \
macro(q, Quote) \
macro(script, Script) \
macro(select, Select) \
macro(style, Style) \
macro(textarea, TextArea) \
macro(title, Title) \
......
......@@ -41,7 +41,6 @@
#include "HTMLObjectElement.h"
#include "HTMLOptionElement.h"
#include "HTMLOptionsCollection.h"
#include "HTMLSelectElement.h"
#include "HTMLTableCaptionElement.h"
#include "HTMLTableCellElement.h"
#include "HTMLTableColElement.h"
......@@ -425,7 +424,6 @@ const ClassInfo JSHTMLElement::iFrame_info = { "HTMLIFrameElement", &JSHTMLEleme
const ClassInfo JSHTMLElement::info = { "DOMHTMLElement", &JSElement::info, &HTMLElementTable, 0 };
const ClassInfo JSHTMLElement::marquee_info = { "HTMLMarqueeElement", &JSHTMLElement::info, &HTMLMarqueeElementTable, 0 };
const ClassInfo JSHTMLElement::object_info = { "HTMLObjectElement", &JSHTMLElement::info, &HTMLObjectElementTable, 0 };
const ClassInfo JSHTMLElement::select_info = { "HTMLSelectElement", &JSHTMLElement::info, &HTMLSelectElementTable, 0 };
const ClassInfo JSHTMLElement::table_info = { "HTMLTableElement", &JSHTMLElement::info, &HTMLTableElementTable, 0 };
const ClassInfo JSHTMLElement::tablecell_info = { "HTMLTableCellElement", &JSHTMLElement::info, &HTMLTableCellElementTable, 0 };
const ClassInfo JSHTMLElement::tablesection_info = { "HTMLTableSectionElement", &JSHTMLElement::info, &HTMLTableSectionElementTable, 0 };
......@@ -444,7 +442,6 @@ const ClassInfo* JSHTMLElement::classInfo() const
classInfoMap.set(iframeTag.localName().impl(), &iFrame_info);
classInfoMap.set(marqueeTag.localName().impl(), &marquee_info);
classInfoMap.set(objectTag.localName().impl(), &object_info);
classInfoMap.set(selectTag.localName().impl(), &select_info);
classInfoMap.set(tableTag.localName().impl(), &table_info);
classInfoMap.set(tbodyTag.localName().impl(), &tablesection_info);
classInfoMap.set(tdTag.localName().impl(), &tablecell_info);
......@@ -461,7 +458,6 @@ const ClassInfo* JSHTMLElement::classInfo() const
return &info;
}
const JSHTMLElement::Accessors JSHTMLElement::select_accessors = { &JSHTMLElement::selectGetter, &JSHTMLElement::selectSetter };
const JSHTMLElement::Accessors JSHTMLElement::object_accessors = { &JSHTMLElement::objectGetter, &JSHTMLElement::objectSetter };
const JSHTMLElement::Accessors JSHTMLElement::embed_accessors = { &JSHTMLElement::embedGetter, &JSHTMLElement::embedSetter };
const JSHTMLElement::Accessors JSHTMLElement::table_accessors = { &JSHTMLElement::tableGetter, &JSHTMLElement::tableSetter };
......@@ -488,7 +484,6 @@ const JSHTMLElement::Accessors* JSHTMLElement::accessors() const
accessorMap.add(iframeTag.localName().impl(), &iFrame_accessors);
accessorMap.add(marqueeTag.localName().impl(), &marquee_accessors);
accessorMap.add(objectTag.localName().impl(), &object_accessors);
accessorMap.add(selectTag.localName().impl(), &select_accessors);
accessorMap.add(tableTag.localName().impl(), &table_accessors);
accessorMap.add(tbodyTag.localName().impl(), &tablesection_accessors);
accessorMap.add(tdTag.localName().impl(), &tablecell_accessors);
......@@ -523,26 +518,6 @@ const JSHTMLElement::Accessors* JSHTMLElement::accessors() const
contentEditable KJS::JSHTMLElement::ElementContentEditable DontDelete
isContentEditable KJS::JSHTMLElement::ElementIsContentEditable DontDelete|ReadOnly
@end
@begin HTMLSelectElementTable 11
# Also supported, by index
type KJS::JSHTMLElement::SelectType DontDelete|ReadOnly
selectedIndex KJS::JSHTMLElement::SelectSelectedIndex DontDelete
value KJS::JSHTMLElement::SelectValue DontDelete
length KJS::JSHTMLElement::SelectLength DontDelete
form KJS::JSHTMLElement::SelectForm DontDelete|ReadOnly
options KJS::JSHTMLElement::SelectOptions DontDelete|ReadOnly
item KJS::JSHTMLElement::SelectItem DontDelete|Function 1
namedItem KJS::JSHTMLElement::SelectNamedItem DontDelete|Function 1
disabled KJS::JSHTMLElement::SelectDisabled DontDelete
multiple KJS::JSHTMLElement::SelectMultiple DontDelete
name KJS::JSHTMLElement::SelectName DontDelete
size KJS::JSHTMLElement::SelectSize DontDelete
tabIndex KJS::JSHTMLElement::SelectTabIndex DontDelete
add KJS::JSHTMLElement::SelectAdd DontDelete|Function 2
remove KJS::JSHTMLElement::SelectRemove DontDelete|Function 1
blur KJS::JSHTMLElement::SelectBlur DontDelete|Function 0
focus KJS::JSHTMLElement::SelectFocus DontDelete|Function 0
@end
@begin HTMLObjectElementTable 20
form KJS::JSHTMLElement::ObjectForm DontDelete|ReadOnly
code KJS::JSHTMLElement::ObjectCode DontDelete
......@@ -702,14 +677,6 @@ JSHTMLElement::JSHTMLElement(ExecState* exec, HTMLElement* e)
setPrototype(JSHTMLElementPrototype::self(exec));
}
JSValue *JSHTMLElement::selectIndexGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
{
JSHTMLElement* thisObj = static_cast<JSHTMLElement*>(slot.slotBase());
HTMLSelectElement* select = static_cast<HTMLSelectElement*>(thisObj->impl());
return toJS(exec, select->options()->item(slot.index()));
}
JSValue *JSHTMLElement::framesetNameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
{
JSHTMLElement* thisObj = static_cast<JSHTMLElement*>(slot.slotBase());
......@@ -746,15 +713,7 @@ bool JSHTMLElement::getOwnPropertySlot(ExecState* exec, const Identifier& proper
HTMLElement &element = *static_cast<HTMLElement*>(impl());
// First look at dynamic properties
if (element.hasLocalName(selectTag)) {
bool ok;
unsigned u = propertyName.toUInt32(&ok);
if (ok) {
// not specified by DOM(?) but supported in netscape/IE
slot.setCustomIndex(this, u, selectIndexGetter);
return true;
}
} else if (element.hasLocalName(framesetTag)) {
if (element.hasLocalName(framesetTag)) {
WebCore::Node *frame = element.children()->namedItem(propertyName);
if (frame && frame->hasTagName(frameTag)) {
slot.setCustom(this, framesetNameGetter);
......@@ -812,25 +771,6 @@ JSValue *JSHTMLElement::callAsFunction(ExecState* exec, JSObject* thisObj, const
return jsUndefined();
}
JSValue *JSHTMLElement::selectGetter(ExecState* exec, int token) const
{
HTMLSelectElement& select = *static_cast<HTMLSelectElement*>(impl());
switch (token) {
case SelectType: return jsString(select.type());
case SelectSelectedIndex: return jsNumber(select.selectedIndex());
case SelectValue: return jsString(select.value());
case SelectLength: return jsNumber(select.length());
case SelectForm: return toJS(exec, select.form()); // type HTMLFormElement
case SelectOptions: return getHTMLOptionsCollection(exec, select.options().get());
case SelectDisabled: return jsBoolean(select.disabled());
case SelectMultiple: return jsBoolean(select.multiple());
case SelectName: return jsString(select.name());
case SelectSize: return jsNumber(select.size());
case SelectTabIndex: return jsNumber(select.tabIndex());
}
return jsUndefined();
}
JSValue *JSHTMLElement::objectGetter(ExecState* exec, int token) const
{
HTMLObjectElement& object = *static_cast<HTMLObjectElement*>(impl());
......@@ -1137,37 +1077,7 @@ JSValue *HTMLElementFunction::callAsFunction(ExecState* exec, JSObject* thisObj,
DOMExceptionTranslator exception(exec);
HTMLElement &element = *static_cast<HTMLElement*>(static_cast<JSHTMLElement*>(thisObj)->impl());
if (element.hasLocalName(selectTag)) {
HTMLSelectElement &select = static_cast<HTMLSelectElement &>(element);
if (id == JSHTMLElement::SelectAdd) {
select.add(toHTMLElement(args[0]), toHTMLElement(args[1]), exception);
return jsUndefined();
}
else if (id == JSHTMLElement::SelectRemove) {
// we support both options index and options objects
HTMLElement* element = toHTMLElement(args[0]);
if (element && element->hasTagName(optionTag))
select.remove(((HTMLOptionElement*)element)->index());
else
select.remove(int(args[0]->toNumber(exec)));
return jsUndefined();
}
else if (id == JSHTMLElement::SelectBlur) {
select.blur();
return jsUndefined();
}
else if (id == JSHTMLElement::SelectFocus) {
select.focus();
return jsUndefined();
}
else if (id == JSHTMLElement::SelectItem) {
return toJS(exec, select.item(args[0]->toUInt32(exec)));
}
else if (id == JSHTMLElement::SelectNamedItem) {
return toJS(exec, select.namedItem(Identifier(args[0]->toString(exec))));
}
}
else if (element.hasLocalName(tableTag)) {
if (element.hasLocalName(tableTag)) {
HTMLTableElement &table = static_cast<HTMLTableElement &>(element);
if (id == JSHTMLElement::TableCreateTHead)
return toJS(exec,table.createTHead());
......@@ -1247,17 +1157,7 @@ void JSHTMLElement::put(ExecState* exec, const Identifier &propertyName, JSValue
{
HTMLElement &element = *static_cast<HTMLElement*>(impl());
// First look at dynamic properties
if (element.hasLocalName(selectTag)) {