Commit c5090ec7 authored by eseidel's avatar eseidel

2006-05-30 Eric Seidel <eric@eseidel.com>

        Reviewed by andersca.

        Small ammount of bindings-related code cleanup.
        No test case possible.

        * bindings/js/JSHTMLFormElementCustom.cpp:
        (WebCore::JSHTMLFormElement::nameGetter):
        * bindings/js/JSXMLSerializer.cpp:
        (WebCore::JSXMLSerializerConstructorImp::JSXMLSerializerConstructorImp):
        (WebCore::JSXMLSerializerConstructorImp::implementsConstruct):
        (WebCore::JSXMLSerializerConstructorImp::construct):
        (WebCore::):
        (WebCore::JSXMLSerializer::JSXMLSerializer):
        (WebCore::JSXMLSerializerProtoFunc::callAsFunction):
        * bindings/js/JSXMLSerializer.h:
        (WebCore::JSXMLSerializer::toBoolean):
        (WebCore::JSXMLSerializer::classInfo):
        (WebCore::JSXMLSerializer::):
        * bindings/js/kjs_window.cpp:
        (KJS::Window::getValueProperty):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14620 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 79a3dc63
2006-05-30 Eric Seidel <eric@eseidel.com>
Reviewed by andersca.
Small ammount of bindings-related code cleanup.
No test case possible.
* bindings/js/JSHTMLFormElementCustom.cpp:
(WebCore::JSHTMLFormElement::nameGetter):
* bindings/js/JSXMLSerializer.cpp:
(WebCore::JSXMLSerializerConstructorImp::JSXMLSerializerConstructorImp):
(WebCore::JSXMLSerializerConstructorImp::implementsConstruct):
(WebCore::JSXMLSerializerConstructorImp::construct):
(WebCore::):
(WebCore::JSXMLSerializer::JSXMLSerializer):
(WebCore::JSXMLSerializerProtoFunc::callAsFunction):
* bindings/js/JSXMLSerializer.h:
(WebCore::JSXMLSerializer::toBoolean):
(WebCore::JSXMLSerializer::classInfo):
(WebCore::JSXMLSerializer::):
* bindings/js/kjs_window.cpp:
(KJS::Window::getValueProperty):
2006-05-27 Anders Carlsson <acarlsson@apple.com>
* bindings/js/JSHTMLElementWrapperFactory.cpp:
......
......@@ -40,7 +40,7 @@ bool JSHTMLFormElement::canGetItemsForName(ExecState* exec, HTMLFormElement* for
return !namedItems->isUndefined();
}
JSValue* JSHTMLFormElement::nameGetter(ExecState* exec, JSObject* originalObject, const Identifier& propertyName, const PropertySlot& slot)
JSValue* JSHTMLFormElement::nameGetter(ExecState* exec, JSObject*, const Identifier& propertyName, const PropertySlot& slot)
{
JSHTMLElement* thisObj = static_cast<JSHTMLElement*>(slot.slotBase());
HTMLFormElement* form = static_cast<HTMLFormElement*>(thisObj->impl());
......
......@@ -27,71 +27,65 @@
#include "kjs_dom.h"
#include "markup.h"
using namespace WebCore;
using namespace KJS;
namespace KJS {
namespace WebCore {
////////////////////// XMLSerializer Object ////////////////////////
/* Source for XMLSerializerProtoTable.
@begin XMLSerializerProtoTable 1
serializeToString XMLSerializer::SerializeToString DontDelete|Function 1
/* Source for JSXMLSerializerProtoTable.
@begin JSXMLSerializerProtoTable 1
serializeToString WebCore::JSXMLSerializer::SerializeToString DontDelete|Function 1
@end
*/
KJS_DEFINE_PROTOTYPE(XMLSerializerProto)
KJS_IMPLEMENT_PROTOFUNC(XMLSerializerProtoFunc)
KJS_IMPLEMENT_PROTOTYPE("XMLSerializer",XMLSerializerProto,XMLSerializerProtoFunc)
XMLSerializerConstructorImp::XMLSerializerConstructorImp(ExecState *exec)
KJS_DEFINE_PROTOTYPE(JSXMLSerializerProto)
KJS_IMPLEMENT_PROTOFUNC(JSXMLSerializerProtoFunc)
KJS_IMPLEMENT_PROTOTYPE("XMLSerializer", JSXMLSerializerProto, JSXMLSerializerProtoFunc)
JSXMLSerializerConstructorImp::JSXMLSerializerConstructorImp(ExecState* exec)
{
setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
putDirect(prototypePropertyName, XMLSerializerProto::self(exec), None);
putDirect(prototypePropertyName, JSXMLSerializerProto::self(exec), None);
}
bool XMLSerializerConstructorImp::implementsConstruct() const
bool JSXMLSerializerConstructorImp::implementsConstruct() const
{
return true;
return true;
}
JSObject *XMLSerializerConstructorImp::construct(ExecState *exec, const List &)
JSObject* JSXMLSerializerConstructorImp::construct(ExecState* exec, const List&)
{
return new XMLSerializer(exec);
return new JSXMLSerializer(exec);
}
const ClassInfo XMLSerializer::info = { "XMLSerializer", 0, &XMLSerializerTable, 0 };
const ClassInfo JSXMLSerializer::info = { "XMLSerializer", 0, &JSXMLSerializerTable, 0 };
/* Source for XMLSerializerTable.
@begin XMLSerializerTable 0
/* Source for JSXMLSerializerTable.
@begin JSXMLSerializerTable 0
@end
*/
XMLSerializer::XMLSerializer(ExecState *exec)
JSXMLSerializer::JSXMLSerializer(ExecState* exec)
{
setPrototype(XMLSerializerProto::self(exec));
setPrototype(JSXMLSerializerProto::self(exec));
}
JSValue *XMLSerializerProtoFunc::callAsFunction(ExecState *exec, JSObject *thisObj, const List &args)
JSValue* JSXMLSerializerProtoFunc::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
{
if (!thisObj->inherits(&XMLSerializer::info))
return throwError(exec, TypeError);
switch (id) {
case XMLSerializer::SerializeToString:
{
if (args.size() != 1) {
return jsUndefined();
}
if (!args[0]->toObject(exec)->inherits(&DOMNode::info)) {
return jsUndefined();
}
WebCore::Node* node = static_cast<WebCore::Node*>(static_cast<DOMNode*>(args[0]->toObject(exec))->impl());
return jsStringOrNull(WebCore::createMarkup(node));
if (!thisObj->inherits(&JSXMLSerializer::info))
return throwError(exec, TypeError);
if (id == JSXMLSerializer::SerializeToString) {
if (args.size() != 1)
return jsUndefined();
if (!args[0]->toObject(exec)->inherits(&DOMNode::info))
return jsUndefined();
Node* node = static_cast<Node*>(static_cast<DOMNode*>(args[0]->toObject(exec))->impl());
return jsStringOrNull(createMarkup(node));
}
}
return jsUndefined();
return jsUndefined();
}
} // end namespace
......@@ -18,32 +18,31 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _XMLSERIALIZER_H_
#define _XMLSERIALIZER_H_
#ifndef JSXMLSerializer_H
#define JSXMLSerializer_H
#include "kjs_binding.h"
namespace KJS {
class JSEventListener;
}
class JSEventListener;
namespace WebCore {
class XMLSerializerConstructorImp : public DOMObject {
class JSXMLSerializerConstructorImp : public KJS::DOMObject {
public:
XMLSerializerConstructorImp(ExecState *);
JSXMLSerializerConstructorImp(KJS::ExecState*);
virtual bool implementsConstruct() const;
virtual JSObject *construct(ExecState *exec, const List &args);
virtual KJS::JSObject* construct(KJS::ExecState*, const KJS::List& args);
};
class XMLSerializer : public DOMObject {
class JSXMLSerializer : public KJS::DOMObject {
public:
XMLSerializer(ExecState *);
virtual bool toBoolean(ExecState *) const { return true; }
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
JSXMLSerializer(KJS::ExecState*);
virtual bool toBoolean(KJS::ExecState*) const { return true; }
virtual const KJS::ClassInfo* classInfo() const { return &info; }
static const KJS::ClassInfo info;
enum { SerializeToString };
private:
friend class XMLSerializerProtoFunc;
};
} // namespace
......
......@@ -776,7 +776,7 @@ JSValue *Window::getValueProperty(ExecState *exec, int token) const
case XMLHttpRequest:
return new JSXMLHttpRequestConstructorImp(exec, m_frame->document());
case XMLSerializer:
return new XMLSerializerConstructorImp(exec);
return new JSXMLSerializerConstructorImp(exec);
case DOMParser_:
return new DOMParserConstructorImp(exec, m_frame->document());
#ifdef KHTML_XSLT
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment