Commit 3975ff64 authored by weinig's avatar weinig
Browse files

LayoutTests:

        Reviewed by Darin.

        Update tests for http://bugs.webkit.org/show_bug.cgi?id=13894
        Remove the legacy class KJS::JSHTMLElement

        - Corrects prototype chain for all HTMLElement subclasses which
          now only have one HTMLElement prototype and not two.

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

WebCore:

        Reviewed by Darin.

        Patch for http://bugs.webkit.org/show_bug.cgi?id=13894
        Remove the legacy class KJS::JSHTMLElement

        - Now that all of the subclasses of JSHTMLElement are
          autogenerated and no longer rely on the legacy parent,
          we can remove it and update all the HTML idl files to
          reflect so.

        - Also adds JSHTMLBlockquoteElement's JS constructor which
          was mistakingly missing.

        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSHTMLAnchorElementCustom.cpp:
        (WebCore::JSHTMLAnchorElement::toString):
        * bindings/js/JSHTMLElementCustom.cpp: Added.
        (WebCore::JSHTMLElement::pushEventHandlerScope):
        * bindings/js/JSHTMLElementWrapperFactory.cpp:
        (WebCore::createJSHTMLWrapper):
        * bindings/js/JSHTMLInputElementBase.cpp:
        (WebCore::):
        (WebCore::JSHTMLInputElementBase::JSHTMLInputElementBase):
        (WebCore::JSHTMLInputElementBase::getOwnPropertySlot):
        (WebCore::JSHTMLInputElementBase::put):
        * bindings/js/JSHTMLInputElementBase.h:
        * bindings/js/JSHTMLSelectElementCustom.cpp:
        * bindings/js/kjs_html.cpp:
        (KJS::runtimeObjectCustomGetOwnPropertySlot):
        * bindings/js/kjs_html.h:
        * bindings/scripts/CodeGeneratorJS.pm:
        * html/HTMLAnchorElement.idl:
        * html/HTMLAppletElement.idl:
        * html/HTMLAreaElement.idl:
        * html/HTMLBRElement.idl:
        * html/HTMLBaseElement.idl:
        * html/HTMLBaseFontElement.idl:
        * html/HTMLBlockquoteElement.idl:
        * html/HTMLBodyElement.idl:
        * html/HTMLButtonElement.idl:
        * html/HTMLCanvasElement.idl:
        * html/HTMLDListElement.idl:
        * html/HTMLDirectoryElement.idl:
        * html/HTMLDivElement.idl:
        * html/HTMLElement.cpp:
        (WebCore::HTMLElement::formForEventHandlerScope):
        * html/HTMLElement.h:
        * html/HTMLElement.idl:
        * html/HTMLEmbedElement.idl:
        * html/HTMLFieldSetElement.idl:
        * html/HTMLFontElement.idl:
        * html/HTMLFormElement.idl:
        * html/HTMLFrameElement.idl:
        * html/HTMLFrameSetElement.idl:
        * html/HTMLGenericFormElement.cpp:
        (WebCore::HTMLGenericFormElement::formForEventHandlerScope):
        * html/HTMLGenericFormElement.h:
        * html/HTMLHRElement.idl:
        * html/HTMLHeadElement.idl:
        * html/HTMLHeadingElement.idl:
        * html/HTMLHtmlElement.idl:
        * html/HTMLIFrameElement.idl:
        * html/HTMLImageElement.idl:
        * html/HTMLIsIndexElement.idl:
        * html/HTMLLIElement.idl:
        * html/HTMLLabelElement.cpp:
        (WebCore::HTMLLabelElement::form):
        (WebCore::HTMLLabelElement::formForEventHandlerScope):
        * html/HTMLLabelElement.h:
        * html/HTMLLabelElement.idl:
        * html/HTMLLegendElement.idl:
        * html/HTMLLinkElement.idl:
        * html/HTMLMapElement.idl:
        * html/HTMLMarqueeElement.idl:
        * html/HTMLMenuElement.idl:
        * html/HTMLMetaElement.idl:
        * html/HTMLModElement.idl:
        * html/HTMLOListElement.idl:
        * html/HTMLObjectElement.cpp:
        (WebCore::HTMLObjectElement::formForEventHandlerScope):
        * html/HTMLObjectElement.h:
        * html/HTMLObjectElement.idl:
        * html/HTMLOptGroupElement.idl:
        * html/HTMLOptionElement.idl:
        * html/HTMLParagraphElement.idl:
        * html/HTMLParamElement.idl:
        * html/HTMLPreElement.idl:
        * html/HTMLQuoteElement.idl:
        * html/HTMLScriptElement.idl:
        * html/HTMLSelectElement.idl:
        * html/HTMLStyleElement.idl:
        * html/HTMLTableCaptionElement.idl:
        * html/HTMLTableCellElement.idl:
        * html/HTMLTableColElement.idl:
        * html/HTMLTableElement.idl:
        * html/HTMLTableRowElement.idl:
        * html/HTMLTableSectionElement.idl:
        * html/HTMLTextAreaElement.idl:
        * html/HTMLTitleElement.idl:
        * html/HTMLUListElement.idl:
        * page/DOMWindow.idl:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21842 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f623c231
2007-05-28 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
Update tests for http://bugs.webkit.org/show_bug.cgi?id=13894
Remove the legacy class KJS::JSHTMLElement
- Corrects prototype chain for all HTMLElement subclasses which
now only have one HTMLElement prototype and not two.
* fast/dom/Window/window-properties-expected.txt:
* fast/dom/prototype-chain-expected.txt:
2007-05-28 David Kilzer <ddkilzer@webkit.org>
 
Reviewed by NOBODY (newly passing tests).
......@@ -506,6 +506,8 @@ window.HTMLBaseElement [object HTMLBaseElementConstructor]
window.HTMLBaseElement.prototype [printed above as window.Element.prototype]
window.HTMLBaseFontElement [object HTMLBaseFontElementConstructor]
window.HTMLBaseFontElement.prototype [printed above as window.Element.prototype]
window.HTMLBlockquoteElement [object HTMLBlockquoteElementConstructor]
window.HTMLBlockquoteElement.prototype [printed above as window.Element.prototype]
window.HTMLBodyElement [object HTMLBodyElementConstructor]
window.HTMLBodyElement.prototype [printed above as window.Element.prototype]
window.HTMLButtonElement [object HTMLButtonElementConstructor]
......
......@@ -16,7 +16,7 @@ NOTE: This test will start failing if you change the layout of a related prototy
[object HTMLDocumentPrototype]
----- [object HTMLDivElement] (8 prototypes) -----
----- [object HTMLDivElement] (7 prototypes) -----
[object Object]
......@@ -30,11 +30,9 @@ NOTE: This test will start failing if you change the layout of a related prototy
[object HTMLElementPrototype]
[object HTMLElementPrototype]
[object HTMLDivElementPrototype]
----- [object HTMLFormElement] (8 prototypes) -----
----- [object HTMLFormElement] (7 prototypes) -----
[object Object]
......@@ -48,8 +46,6 @@ NOTE: This test will start failing if you change the layout of a related prototy
[object HTMLElementPrototype]
[object HTMLElementPrototype]
[object HTMLFormElementPrototype]
----- [object UIEvent] (4 prototypes) -----
......
2007-05-28 Sam Weinig <sam@webkit.org>
Reviewed by Darin.
Patch for http://bugs.webkit.org/show_bug.cgi?id=13894
Remove the legacy class KJS::JSHTMLElement
- Now that all of the subclasses of JSHTMLElement are
autogenerated and no longer rely on the legacy parent,
we can remove it and update all the HTML idl files to
reflect so.
- Also adds JSHTMLBlockquoteElement's JS constructor which
was mistakingly missing.
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSHTMLAnchorElementCustom.cpp:
(WebCore::JSHTMLAnchorElement::toString):
* bindings/js/JSHTMLElementCustom.cpp: Added.
(WebCore::JSHTMLElement::pushEventHandlerScope):
* bindings/js/JSHTMLElementWrapperFactory.cpp:
(WebCore::createJSHTMLWrapper):
* bindings/js/JSHTMLInputElementBase.cpp:
(WebCore::):
(WebCore::JSHTMLInputElementBase::JSHTMLInputElementBase):
(WebCore::JSHTMLInputElementBase::getOwnPropertySlot):
(WebCore::JSHTMLInputElementBase::put):
* bindings/js/JSHTMLInputElementBase.h:
* bindings/js/JSHTMLSelectElementCustom.cpp:
* bindings/js/kjs_html.cpp:
(KJS::runtimeObjectCustomGetOwnPropertySlot):
* bindings/js/kjs_html.h:
* bindings/scripts/CodeGeneratorJS.pm:
* html/HTMLAnchorElement.idl:
* html/HTMLAppletElement.idl:
* html/HTMLAreaElement.idl:
* html/HTMLBRElement.idl:
* html/HTMLBaseElement.idl:
* html/HTMLBaseFontElement.idl:
* html/HTMLBlockquoteElement.idl:
* html/HTMLBodyElement.idl:
* html/HTMLButtonElement.idl:
* html/HTMLCanvasElement.idl:
* html/HTMLDListElement.idl:
* html/HTMLDirectoryElement.idl:
* html/HTMLDivElement.idl:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::formForEventHandlerScope):
* html/HTMLElement.h:
* html/HTMLElement.idl:
* html/HTMLEmbedElement.idl:
* html/HTMLFieldSetElement.idl:
* html/HTMLFontElement.idl:
* html/HTMLFormElement.idl:
* html/HTMLFrameElement.idl:
* html/HTMLFrameSetElement.idl:
* html/HTMLGenericFormElement.cpp:
(WebCore::HTMLGenericFormElement::formForEventHandlerScope):
* html/HTMLGenericFormElement.h:
* html/HTMLHRElement.idl:
* html/HTMLHeadElement.idl:
* html/HTMLHeadingElement.idl:
* html/HTMLHtmlElement.idl:
* html/HTMLIFrameElement.idl:
* html/HTMLImageElement.idl:
* html/HTMLIsIndexElement.idl:
* html/HTMLLIElement.idl:
* html/HTMLLabelElement.cpp:
(WebCore::HTMLLabelElement::form):
(WebCore::HTMLLabelElement::formForEventHandlerScope):
* html/HTMLLabelElement.h:
* html/HTMLLabelElement.idl:
* html/HTMLLegendElement.idl:
* html/HTMLLinkElement.idl:
* html/HTMLMapElement.idl:
* html/HTMLMarqueeElement.idl:
* html/HTMLMenuElement.idl:
* html/HTMLMetaElement.idl:
* html/HTMLModElement.idl:
* html/HTMLOListElement.idl:
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::formForEventHandlerScope):
* html/HTMLObjectElement.h:
* html/HTMLObjectElement.idl:
* html/HTMLOptGroupElement.idl:
* html/HTMLOptionElement.idl:
* html/HTMLParagraphElement.idl:
* html/HTMLParamElement.idl:
* html/HTMLPreElement.idl:
* html/HTMLQuoteElement.idl:
* html/HTMLScriptElement.idl:
* html/HTMLSelectElement.idl:
* html/HTMLStyleElement.idl:
* html/HTMLTableCaptionElement.idl:
* html/HTMLTableCellElement.idl:
* html/HTMLTableColElement.idl:
* html/HTMLTableElement.idl:
* html/HTMLTableRowElement.idl:
* html/HTMLTableSectionElement.idl:
* html/HTMLTextAreaElement.idl:
* html/HTMLTitleElement.idl:
* html/HTMLUListElement.idl:
* page/DOMWindow.idl:
2007-05-28 Zack Rusin <zrusin@trolltech.com>
 
Reviewed by andersca
......@@ -2780,6 +2780,7 @@
BC51579F0C03BBD3008BB0EE /* DOMHTMLMarqueeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5156E50C03B741008BB0EE /* DOMHTMLMarqueeElement.h */; };
BC5157DD0C03BC22008BB0EE /* DOMHTMLFrameElementPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = BC5156F30C03B7DC008BB0EE /* DOMHTMLFrameElementPrivate.h */; };
BC51580B0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */; };
BC5823F50C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC5823F40C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp */; };
BC588AF00BFA6CF900EE679E /* HTMLParserErrorCodes.h in Headers */ = {isa = PBXBuildFile; fileRef = BC588AEF0BFA6CF900EE679E /* HTMLParserErrorCodes.h */; };
BC588B4B0BFA723C00EE679E /* HTMLParserErrorCodes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC588B4A0BFA723C00EE679E /* HTMLParserErrorCodes.cpp */; };
BC6D44BE0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6D44BD0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp */; };
......@@ -6031,6 +6032,7 @@
BC5156E70C03B741008BB0EE /* DOMHTMLMarqueeElementInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMHTMLMarqueeElementInternal.h; sourceTree = "<group>"; };
BC5156F30C03B7DC008BB0EE /* DOMHTMLFrameElementPrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMHTMLFrameElementPrivate.h; sourceTree = "<group>"; };
BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLDocumentCustom.cpp; sourceTree = "<group>"; };
BC5823F40C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLElementCustom.cpp; sourceTree = "<group>"; };
BC588AEF0BFA6CF900EE679E /* HTMLParserErrorCodes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLParserErrorCodes.h; sourceTree = "<group>"; };
BC588B4A0BFA723C00EE679E /* HTMLParserErrorCodes.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLParserErrorCodes.cpp; sourceTree = "<group>"; };
BC5EC1760A507E3E006007F5 /* view-source.css */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = "view-source.css"; sourceTree = "<group>"; };
......@@ -9184,6 +9186,7 @@
BCF411770BFCC76A00125622 /* JSHTMLAnchorElementCustom.cpp */,
BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */,
BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */,
BC5823F40C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp */,
BC6D44BD0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp */,
A8D065AD0A2446CD005E7203 /* JSHTMLFormElementCustom.cpp */,
BCD41ABA0C060DE800C0E446 /* JSHTMLFrameSetElementCustom.cpp */,
......@@ -12819,6 +12822,7 @@
BC6D44BE0C07EFB60072D2C9 /* JSHTMLEmbedElementCustom.cpp in Sources */,
BC6D44EC0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp in Sources */,
BC4EDEF40C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp in Sources */,
BC5823F50C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -26,13 +26,20 @@
#include "config.h"
#include "JSHTMLAnchorElement.h"
#include "kjs_html.h"
#include "HTMLAnchorElement.h"
namespace WebCore {
// Implicit toString
KJS::UString JSHTMLAnchorElement::toString(KJS::ExecState* exec) const
{
return KJS::UString(static_cast<const HTMLAnchorElement*>(impl())->href());
}
// Explicit toString
KJS::JSValue* JSHTMLAnchorElement::toString(KJS::ExecState* exec, const KJS::List&)
{
return jsString(JSHTMLElement::toString(exec));
return KJS::jsString(toString(exec));
}
} // namespace WebCore
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "JSHTMLElement.h"
#include "Document.h"
#include "HTMLElement.h"
#include "HTMLFormElement.h"
#include "HTMLNames.h"
namespace WebCore {
using namespace KJS;
using namespace HTMLNames;
void JSHTMLElement::pushEventHandlerScope(ExecState* exec, ScopeChain& scope) const
{
HTMLElement* element = static_cast<HTMLElement*>(impl());
// The document is put on first, fall back to searching it only after the element and form.
scope.push(static_cast<JSObject*>(toJS(exec, element->ownerDocument())));
// The form is next, searched before the document, but after the element itself.
// First try to obtain the form from the element itself. We do this to deal with
// the malformed case where <form>s aren't in our parent chain (e.g., when they were inside
// <table> or <tbody>.
HTMLFormElement* form = element->formForEventHandlerScope();
if (form)
scope.push(static_cast<JSObject*>(toJS(exec, form)));
else {
Node* form = element->parentNode();
while (form && !form->hasTagName(formTag))
form = form->parentNode();
if (form)
scope.push(static_cast<JSObject*>(toJS(exec, form)));
}
// The element is on top, searched first.
scope.push(static_cast<JSObject*>(toJS(exec, element)));
}
} // namespace WebCore
......@@ -239,7 +239,7 @@ FOR_EACH_TAG(ADD_TO_HASH_MAP)
CreateHTMLElementWrapperFunction createWrapperFunction = map.get(element->localName().impl());
if (createWrapperFunction)
return createWrapperFunction(exec, element);
return new KJS::JSHTMLElement(exec, element.get());
return new JSHTMLElement(exec, element.get());
}
} // namespace WebCore
......@@ -75,13 +75,13 @@ JSValue* JSHTMLInputElementBaseFunction::callAsFunction(ExecState* exec, JSObjec
return jsUndefined();
}
const ClassInfo JSHTMLInputElementBase::info = { "JSHTMLInputElementBase", &KJS::JSHTMLElement::info, &JSHTMLInputElementBaseTable, 0 };
const ClassInfo JSHTMLInputElementBase::info = { "JSHTMLInputElementBase", &JSHTMLElement::info, &JSHTMLInputElementBaseTable, 0 };
JSHTMLInputElementBase::JSHTMLInputElementBase(ExecState* exec, PassRefPtr<HTMLInputElement> e)
: KJS::JSHTMLElement(exec, e.get())
: JSHTMLElement(exec, e.get())
{
// We don't really need a prototype, just use our parent class's prototype
setPrototype(KJS::JSHTMLElementPrototype::self(exec));
setPrototype(JSHTMLElementPrototype::self(exec));
}
bool JSHTMLInputElementBase::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
......@@ -90,7 +90,7 @@ bool JSHTMLInputElementBase::getOwnPropertySlot(ExecState* exec, const Identifie
// if this element doesn't support selection, we have nothing to do, try our parent
if (!input.canHaveSelection())
return KJS::JSHTMLElement::getOwnPropertySlot(exec, propertyName, slot);
return JSHTMLElement::getOwnPropertySlot(exec, propertyName, slot);
// otherwise, do our own function lookup on our function table
const HashEntry* entry = Lookup::findEntry(&JSHTMLInputElementBaseFunctionTable, propertyName);
......@@ -101,7 +101,7 @@ bool JSHTMLInputElementBase::getOwnPropertySlot(ExecState* exec, const Identifie
ASSERT(!entry);
// finally try value lookup or walk the parent chain
return getStaticValueSlot<JSHTMLInputElementBase, KJS::JSHTMLElement>(exec, &JSHTMLInputElementBaseTable, this, propertyName, slot);
return getStaticValueSlot<JSHTMLInputElementBase, JSHTMLElement>(exec, &JSHTMLInputElementBaseTable, this, propertyName, slot);
}
JSValue* JSHTMLInputElementBase::getValueProperty(ExecState* exec, int token) const
......@@ -120,7 +120,7 @@ JSValue* JSHTMLInputElementBase::getValueProperty(ExecState* exec, int token) co
void JSHTMLInputElementBase::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)
{
lookupPut<JSHTMLInputElementBase, KJS::JSHTMLElement>(exec, propertyName, value, attr, &JSHTMLInputElementBaseTable, this);
lookupPut<JSHTMLInputElementBase, JSHTMLElement>(exec, propertyName, value, attr, &JSHTMLInputElementBaseTable, this);
}
void JSHTMLInputElementBase::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/)
......@@ -138,4 +138,4 @@ void JSHTMLInputElementBase::putValueProperty(ExecState* exec, int token, JSValu
ASSERT_NOT_REACHED();
}
}
} // namespace WebCore
......@@ -20,16 +20,17 @@
#ifndef JSHTMLInputElementBase_h
#define JSHTMLInputElementBase_h
#include "kjs_html.h"
#include "JSHTMLElement.h"
#include "kjs_binding.h"
#include "kjs_html.h"
namespace WebCore {
class HTMLInputElement;
KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE(JSHTMLInputElementBasePrototype, KJS::JSHTMLElementPrototype)
KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE(JSHTMLInputElementBasePrototype, JSHTMLElementPrototype)
class JSHTMLInputElementBase : public KJS::JSHTMLElement {
class JSHTMLInputElementBase : public JSHTMLElement {
public:
JSHTMLInputElementBase(KJS::ExecState*, PassRefPtr<HTMLInputElement>);
virtual bool getOwnPropertySlot(KJS::ExecState*, const KJS::Identifier&, KJS::PropertySlot&);
......@@ -40,6 +41,7 @@ namespace WebCore {
static const KJS::ClassInfo info;
enum { SetSelectionRange, SelectionStart, SelectionEnd };
};
}
#endif
} // namespace WebCore
#endif // JSHTMLInputElementBase_h
......@@ -26,6 +26,7 @@
#include "HTMLOptionElement.h"
#include "HTMLSelectElement.h"
#include "JSHTMLOptionElement.h"
#include "kjs_html.h"
namespace WebCore {
......
......@@ -2,7 +2,7 @@
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
* Copyright (C) 2004, 2005, 2006, 2007 Apple Inc.
* Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -27,17 +27,9 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameView.h"
#include "HTMLAnchorElement.h"
#include "HTMLBodyElement.h"
#include "HTMLDocument.h"
#include "HTMLEmbedElement.h"
#include "HTMLFormElement.h"
#include "HTMLFrameElement.h"
#include "HTMLIFrameElement.h"
#include "HTMLImageElement.h"
#include "HTMLLabelElement.h"
#include "HTMLNames.h"
#include "HTMLObjectElement.h"
#include "HTMLOptionElement.h"
#include "HTMLOptionsCollection.h"
#include "JSHTMLOptionsCollection.h"
......@@ -63,82 +55,6 @@ using namespace EventNames;
namespace KJS {
/*
@begin JSHTMLElementPrototypeTable 0
@end
*/
const ClassInfo JSHTMLElement::info = { "HTMLElement", &JSElement::info, 0, 0 };
KJS_IMPLEMENT_PROTOTYPE_FUNCTION(JSHTMLElementPrototypeFunction)
KJS_IMPLEMENT_PROTOTYPE("HTMLElement", JSHTMLElementPrototype, JSHTMLElementPrototypeFunction)
JSValue* JSHTMLElementPrototypeFunction::callAsFunction(ExecState*, JSObject*, const List&)
{
return 0;
}
JSHTMLElement::JSHTMLElement(ExecState* exec, HTMLElement* e)
: WebCore::JSHTMLElement(exec, e)
{
setPrototype(JSHTMLElementPrototype::self(exec));
}
UString JSHTMLElement::toString(ExecState* exec) const
{
if (impl()->hasTagName(aTag))
return UString(static_cast<const HTMLAnchorElement*>(impl())->href());
return JSElement::toString(exec);
}
static HTMLFormElement* getForm(HTMLElement* element)
{
if (element->isGenericFormElement())
return static_cast<HTMLGenericFormElement*>(element)->form();
if (element->hasTagName(labelTag))
return static_cast<HTMLLabelElement*>(element)->form();
if (element->hasTagName(objectTag))
return static_cast<HTMLObjectElement*>(element)->form();
return 0;
}
void JSHTMLElement::pushEventHandlerScope(ExecState* exec, ScopeChain& scope) const
{
HTMLElement* element = static_cast<HTMLElement*>(impl());
// The document is put on first, fall back to searching it only after the element and form.
scope.push(static_cast<JSObject*>(toJS(exec, element->ownerDocument())));
// The form is next, searched before the document, but after the element itself.
// First try to obtain the form from the element itself. We do this to deal with
// the malformed case where <form>s aren't in our parent chain (e.g., when they were inside
// <table> or <tbody>.
HTMLFormElement* form = getForm(element);
if (form)
scope.push(static_cast<JSObject*>(toJS(exec, form)));
else {
WebCore::Node* form = element->parentNode();
while (form && !form->hasTagName(formTag))
form = form->parentNode();
if (form)
scope.push(static_cast<JSObject*>(toJS(exec, form)));
}
// The element is on top, searched first.
scope.push(static_cast<JSObject*>(toJS(exec, element)));
}
HTMLElement* toHTMLElement(JSValue *val)
{
if (!val || !val->isObject(&JSHTMLElement::info))
return 0;
return static_cast<HTMLElement*>(static_cast<JSHTMLElement*>(val)->impl());
}
// -------------------------------------------------------------------------
/* Source for JSHTMLCollectionPrototypeTable. Use "make hashtables" to regenerate.
@begin JSHTMLCollectionPrototypeTable 3
item JSHTMLCollection::Item DontDelete|Function 1
namedItem JSHTMLCollection::NamedItem DontDelete|Function 1
......@@ -341,6 +257,11 @@ JSValue* toJS(ExecState* exec, HTMLOptionsCollection* c)
return cacheDOMObject<HTMLOptionsCollection, JSHTMLOptionsCollection>(exec, c);
}
// -------------------------------------------------------------------------
// Runtime object support code for JSHTMLAppletElement, JSHTMLEmbedElement and JSHTMLObjectElement.
JSValue* runtimeObjectGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
{
JSHTMLElement* thisObj = static_cast<JSHTMLElement*>(slot.slotBase());
......@@ -359,7 +280,7 @@ JSValue* runtimeObjectPropertyGetter(ExecState* exec, JSObject* originalObject,
return jsUndefined();
}
bool runtimeObjectCustomGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot, JSHTMLElement* originalObj, HTMLElement* thisImp)
bool runtimeObjectCustomGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot, WebCore::JSHTMLElement* originalObj, HTMLElement* thisImp)
{
JSValue* runtimeObject = getRuntimeObject(exec, thisImp);
if (runtimeObject) {
......@@ -406,4 +327,4 @@ JSValue* runtimeObjectCallAsFunction(ExecState* exec, JSObject* thisObj, const L
return jsUndefined();
}
} // namespace
} // namespace KJS
......@@ -37,25 +37,6 @@ namespace KJS {
class JSAbstractEventListener;
// The inheritance chain for JSHTMLElement is a bit different from other
// classes that are "half-autogenerated". Because we return different ClassInfo structs
// depending on the type of element, we inherit JSHTMLElement from WebCore::JSHTMLElement
// instead of the other way around.
KJS_DEFINE_PROTOTYPE_WITH_PROTOTYPE(JSHTMLElementPrototype, WebCore::JSHTMLElementPrototype)
class JSHTMLElement : public WebCore::JSHTMLElement {
public:
JSHTMLElement(ExecState*, WebCore::HTMLElement*);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
virtual UString toString(ExecState*) const;
virtual void pushEventHandlerScope(ExecState*, ScopeChain& scope) const;
};
WebCore::HTMLElement* toHTMLElement(JSValue*); // returns 0 if passed-in value is not a JSHTMLElement object
KJS_DEFINE_PROTOTYPE(JSHTMLCollectionPrototype)
class JSHTMLCollection : public DOMObject {
......@@ -104,7 +85,7 @@ namespace KJS {
JSValue* runtimeObjectGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
JSValue* runtimeObjectPropertyGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
bool runtimeObjectCustomGetOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&, JSHTMLElement*, WebCore::HTMLElement*);
bool runtimeObjectCustomGetOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&, WebCore::JSHTMLElement*, WebCore::HTMLElement*);
bool runtimeObjectCustomPut(ExecState*, const Identifier&, JSValue*, int attr, WebCore::HTMLElement*);
bool runtimeObjectImplementsCall(WebCore::HTMLElement*);
JSValue* runtimeObjectCallAsFunction(ExecState*, JSObject*, const List&, WebCore::HTMLElement*);
......
......@@ -352,6 +352,16 @@ sub GenerateHeader
push(@headerContent, " virtual void mark();\n\n");
}
# Custom toString function
if ($dataNode->extendedAttributes->{"CustomToString"}) {
push(@headerContent, " virtual KJS::UString toString(KJS::ExecState*) const;\n\n");
}
# Custom pushEventHandlerScope function
if ($dataNode->extendedAttributes->{"CustomPushEventHandlerScope"}) {
push(@headerContent, " virtual void pushEventHandlerScope(KJS::ExecState*, KJS::ScopeChain&) const;\n\n");
}
# Custom call functions
if ($dataNode->extendedAttributes->{"CustomCall"}) {
push(@headerContent, " virtual KJS::JSValue* callAsFunction(KJS::ExecState*, KJS::JSObject*, const KJS::List& args);\n");
......
......@@ -20,7 +20,7 @@
module html {
interface [LegacyParent=KJS::JSHTMLElement, GenerateConstructor] HTMLAnchorElement : HTMLElement {
interface [GenerateConstructor, CustomToString] HTMLAnchorElement : HTMLElement {
attribute [ConvertNullToNullString] DOMString accessKey;
attribute [ConvertNullToNullString] DOMString charset;
attribute [ConvertNullToNullString] DOMString coords;
......
......@@ -20,7 +20,7 @@
module html {
interface [LegacyParent=KJS::JSHTMLElement, GenerateConstructor, CustomPutFunction, CustomGetOwnPropertySlot, CustomCall, HasOverridingNameGetter] HTMLAppletElement : HTMLElement {
interface [GenerateConstructor, CustomPutFunction, CustomGetOwnPropertySlot, CustomCall, HasOverridingNameGetter] HTMLAppletElement : HTMLElement {
attribute [ConvertNullToNullString] DOMString align;
attribute [ConvertNullToNullString] DOMString alt;
attribute [ConvertNullToNullString] DOMString archive;
......
......@@ -20,7 +20,7 @@
module html {
interface [LegacyParent=KJS::JSHTMLElement, GenerateConstructor] HTMLAreaElement : HTMLElement {
interface [GenerateConstructor] HTMLAreaElement : HTMLElement {
attribute [ConvertNullToNullString] DOMString accessKey;
attribute [ConvertNullToNullString] DOMString alt;
attribute [ConvertNullToNullString] DOMString coords;
......