Commit c0e8e2e6 authored by weinig's avatar weinig
Browse files

LayoutTests:

        Reviewed by Anders.

        Update test for http://bugs.webkit.org/show_bug.cgi?id=14028
        Finish autogenerating the JS bindings for Node

        * fast/dom/prototype-chain-expected.txt: DOMNodePrototype is no longer in the prototype chain.

WebCore:

        Reviewed by Anders.

        Patch for  http://bugs.webkit.org/show_bug.cgi?id=14028
        Finish autogenerating the JS bindings for Node

        * DerivedSources.make:
        * WebCore.pro:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSHTMLElementWrapperFactory.cpp:
        (WebCore::createJSHTMLWrapper):
        * bindings/js/JSHTMLElementWrapperFactory.h:
        * bindings/js/JSHTMLOptionElementConstructor.cpp:
        * bindings/js/JSNamedNodeMapCustom.cpp:
        * bindings/js/JSNodeCustom.cpp:
        (WebCore::JSNode::insertBefore):
        (WebCore::JSNode::replaceChild):
        (WebCore::JSNode::removeChild):
        (WebCore::JSNode::appendChild):
        (WebCore::JSNode::mark):
        (WebCore::toJS):
        * bindings/js/JSSVGElementWrapperFactory.cpp:
        (WebCore::createJSSVGWrapper):
        * bindings/js/JSSVGElementWrapperFactory.h:
        * bindings/js/JSXSLTProcessor.cpp:
        (KJS::XSLTProcessorPrototypeFunction::callAsFunction):
        * bindings/js/kjs_binding.cpp:
        (KJS::ScriptInterpreter::getDOMNodeForDocument):
        (KJS::ScriptInterpreter::putDOMNodeForDocument):
        (KJS::ScriptInterpreter::markDOMNodesForDocument):
        (KJS::ScriptInterpreter::updateDOMNodeDocument):
        * bindings/js/kjs_binding.h:
        * bindings/js/kjs_dom.cpp:
        (WebCore::toAttr):
        * bindings/js/kjs_dom.h:
        * bindings/js/kjs_domnode.h: Removed.
        * bindings/objc/DOMUtility.mm:
        (KJS::createDOMWrapper):
        * bindings/scripts/CodeGeneratorJS.pm:
        * dom/Node.h:
        (WebCore::Node::parentElement):
        * dom/Node.idl:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@22048 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 04970ea0
2007-06-07 Sam Weinig <sam@webkit.org>
Reviewed by Anders.
Update test for http://bugs.webkit.org/show_bug.cgi?id=14028
Finish autogenerating the JS bindings for Node
* fast/dom/prototype-chain-expected.txt: DOMNodePrototype is no longer in the prototype chain.
2007-06-06 Sam Weinig <sam@webkit.org>
 
Reviewed by Hyatt.
......@@ -2,12 +2,10 @@ This page prints out the prototype chains of select DOM objects. Older versions
NOTE: This test will start failing if you change the layout of a related prototype chain in WebCore. That does not necessarily mean that you have done something wrong; you may just need to check in new results.
----- [object HTMLDocument] (6 prototypes) -----
----- [object HTMLDocument] (5 prototypes) -----
[object Object]
[object DOMNodePrototype]
[object NodePrototype]
[object EventTargetNodePrototype]
......@@ -16,12 +14,10 @@ NOTE: This test will start failing if you change the layout of a related prototy
[object HTMLDocumentPrototype]
----- [object HTMLDivElement] (7 prototypes) -----
----- [object HTMLDivElement] (6 prototypes) -----
[object Object]
[object DOMNodePrototype]
[object NodePrototype]
[object EventTargetNodePrototype]
......@@ -32,12 +28,10 @@ NOTE: This test will start failing if you change the layout of a related prototy
[object HTMLDivElementPrototype]
----- [object HTMLFormElement] (7 prototypes) -----
----- [object HTMLFormElement] (6 prototypes) -----
[object Object]
[object DOMNodePrototype]
[object NodePrototype]
[object EventTargetNodePrototype]
......
2007-06-07 Sam Weinig <sam@webkit.org>
Reviewed by Anders.
Patch for http://bugs.webkit.org/show_bug.cgi?id=14028
Finish autogenerating the JS bindings for Node
* DerivedSources.make:
* WebCore.pro:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSHTMLElementWrapperFactory.cpp:
(WebCore::createJSHTMLWrapper):
* bindings/js/JSHTMLElementWrapperFactory.h:
* bindings/js/JSHTMLOptionElementConstructor.cpp:
* bindings/js/JSNamedNodeMapCustom.cpp:
* bindings/js/JSNodeCustom.cpp:
(WebCore::JSNode::insertBefore):
(WebCore::JSNode::replaceChild):
(WebCore::JSNode::removeChild):
(WebCore::JSNode::appendChild):
(WebCore::JSNode::mark):
(WebCore::toJS):
* bindings/js/JSSVGElementWrapperFactory.cpp:
(WebCore::createJSSVGWrapper):
* bindings/js/JSSVGElementWrapperFactory.h:
* bindings/js/JSXSLTProcessor.cpp:
(KJS::XSLTProcessorPrototypeFunction::callAsFunction):
* bindings/js/kjs_binding.cpp:
(KJS::ScriptInterpreter::getDOMNodeForDocument):
(KJS::ScriptInterpreter::putDOMNodeForDocument):
(KJS::ScriptInterpreter::markDOMNodesForDocument):
(KJS::ScriptInterpreter::updateDOMNodeDocument):
* bindings/js/kjs_binding.h:
* bindings/js/kjs_dom.cpp:
(WebCore::toAttr):
* bindings/js/kjs_dom.h:
* bindings/js/kjs_domnode.h: Removed.
* bindings/objc/DOMUtility.mm:
(KJS::createDOMWrapper):
* bindings/scripts/CodeGeneratorJS.pm:
* dom/Node.h:
(WebCore::Node::parentElement):
* dom/Node.idl:
2007-06-07 Sam Weinig <sam@webkit.org>
 
Another Gdk and Qt build fix.
......@@ -549,7 +549,6 @@ all : \
XMLNames.cpp \
XPathGrammar.cpp \
kjs_css.lut.h \
kjs_dom.lut.h \
kjs_events.lut.h \
kjs_html.lut.h \
kjs_navigator.lut.h \
......
......@@ -141,7 +141,6 @@ LUT_FILES += \
bindings/js/JSXMLHttpRequest.cpp \
bindings/js/JSXSLTProcessor.cpp \
bindings/js/kjs_css.cpp \
bindings/js/kjs_dom.cpp \
bindings/js/kjs_events.cpp \
bindings/js/kjs_html.cpp \
bindings/js/kjs_navigator.cpp \
......
......@@ -63,7 +63,6 @@
14CF78A609F58CD800EB3665 /* JSCSSValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 14CF78A509F58CD800EB3665 /* JSCSSValue.h */; };
14CF7B3309F6ECD700EB3665 /* JSCSSRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14CF7B3109F6ECD700EB3665 /* JSCSSRule.cpp */; };
14CF7B3409F6ECD700EB3665 /* JSCSSRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 14CF7B3209F6ECD700EB3665 /* JSCSSRule.h */; };
14D0C82509FF0EF5006B36D9 /* kjs_domnode.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D0C82409FF0EF5006B36D9 /* kjs_domnode.h */; };
14D823520AF92A790004F057 /* Chrome.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D823500AF92A790004F057 /* Chrome.h */; settings = {ATTRIBUTES = (Private, ); }; };
14D8238B0AF92DF60004F057 /* Chrome.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14D8238A0AF92DF60004F057 /* Chrome.cpp */; };
14D824080AF93AEB0004F057 /* ChromeClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D824060AF93AEB0004F057 /* ChromeClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -372,7 +371,6 @@
656581EE09D1508D000E61D7 /* JSXMLHttpRequest.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581D709D1508D000E61D7 /* JSXMLHttpRequest.lut.h */; };
656581F009D1508D000E61D7 /* JSXSLTProcessor.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581D909D1508D000E61D7 /* JSXSLTProcessor.lut.h */; };
656581F109D1508D000E61D7 /* kjs_css.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581DA09D1508D000E61D7 /* kjs_css.lut.h */; };
656581F209D1508D000E61D7 /* kjs_dom.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581DB09D1508D000E61D7 /* kjs_dom.lut.h */; };
656581F309D1508D000E61D7 /* kjs_events.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581DC09D1508D000E61D7 /* kjs_events.lut.h */; };
656581F409D1508D000E61D7 /* kjs_html.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581DD09D1508D000E61D7 /* kjs_html.lut.h */; };
656581F509D1508D000E61D7 /* kjs_navigator.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = 656581DE09D1508D000E61D7 /* kjs_navigator.lut.h */; };
......@@ -3240,7 +3238,6 @@
14CF7B3109F6ECD700EB3665 /* JSCSSRule.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSRule.cpp; sourceTree = "<group>"; };
14CF7B3209F6ECD700EB3665 /* JSCSSRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSCSSRule.h; sourceTree = "<group>"; };
14CF7C2009F7110600EB3665 /* KeyboardEvent.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = KeyboardEvent.idl; sourceTree = "<group>"; };
14D0C82409FF0EF5006B36D9 /* kjs_domnode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_domnode.h; sourceTree = "<group>"; };
14D823500AF92A790004F057 /* Chrome.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Chrome.h; sourceTree = "<group>"; };
14D8238A0AF92DF60004F057 /* Chrome.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Chrome.cpp; sourceTree = "<group>"; };
14D824060AF93AEB0004F057 /* ChromeClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChromeClient.h; sourceTree = "<group>"; };
......@@ -3597,7 +3594,6 @@
656581D709D1508D000E61D7 /* JSXMLHttpRequest.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSXMLHttpRequest.lut.h; sourceTree = "<group>"; };
656581D909D1508D000E61D7 /* JSXSLTProcessor.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSXSLTProcessor.lut.h; sourceTree = "<group>"; };
656581DA09D1508D000E61D7 /* kjs_css.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_css.lut.h; sourceTree = "<group>"; };
656581DB09D1508D000E61D7 /* kjs_dom.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_dom.lut.h; sourceTree = "<group>"; };
656581DC09D1508D000E61D7 /* kjs_events.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_events.lut.h; sourceTree = "<group>"; };
656581DD09D1508D000E61D7 /* kjs_html.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_html.lut.h; sourceTree = "<group>"; };
656581DE09D1508D000E61D7 /* kjs_navigator.lut.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_navigator.lut.h; sourceTree = "<group>"; };
......@@ -7032,7 +7028,6 @@
BCD9C2C40C17B6EC005C90A2 /* JSDOMExceptionConstructor.lut.h */,
BCD9C2C50C17B6EC005C90A2 /* JSEventTargetNode.lut.h */,
656581DA09D1508D000E61D7 /* kjs_css.lut.h */,
656581DB09D1508D000E61D7 /* kjs_dom.lut.h */,
656581DC09D1508D000E61D7 /* kjs_events.lut.h */,
656581DD09D1508D000E61D7 /* kjs_html.lut.h */,
656581DE09D1508D000E61D7 /* kjs_navigator.lut.h */,
......@@ -9224,7 +9219,6 @@
93B70D4A09EB0C7C009D8468 /* kjs_css.h */,
93B70D4B09EB0C7C009D8468 /* kjs_dom.cpp */,
93B70D4C09EB0C7C009D8468 /* kjs_dom.h */,
14D0C82409FF0EF5006B36D9 /* kjs_domnode.h */,
93B70D4D09EB0C7C009D8468 /* kjs_events.cpp */,
93B70D4E09EB0C7C009D8468 /* kjs_events.h */,
93B70D4F09EB0C7C009D8468 /* kjs_html.cpp */,
......@@ -10396,7 +10390,6 @@
656581EE09D1508D000E61D7 /* JSXMLHttpRequest.lut.h in Headers */,
656581F009D1508D000E61D7 /* JSXSLTProcessor.lut.h in Headers */,
656581F109D1508D000E61D7 /* kjs_css.lut.h in Headers */,
656581F209D1508D000E61D7 /* kjs_dom.lut.h in Headers */,
656581F309D1508D000E61D7 /* kjs_events.lut.h in Headers */,
656581F409D1508D000E61D7 /* kjs_html.lut.h in Headers */,
656581F509D1508D000E61D7 /* kjs_navigator.lut.h in Headers */,
......@@ -10464,7 +10457,6 @@
93EB169709F880C00091F8FF /* WebCoreSystemInterface.h in Headers */,
BC066F6F09FEB2FA00C589A7 /* WebCoreTextRenderer.h in Headers */,
14DC0D3809FED073007B0235 /* JSNode.h in Headers */,
14D0C82509FF0EF5006B36D9 /* kjs_domnode.h in Headers */,
142011B70A003133008303F9 /* JSCSSStyleDeclaration.h in Headers */,
BCC71A130A0FF94D0014EE6E /* GlyphBuffer.h in Headers */,
1A7629D60A07425100989F5B /* XPathGrammar.h in Headers */,
......@@ -145,7 +145,7 @@ namespace WebCore {
using namespace HTMLNames;
typedef DOMNode* (*CreateHTMLElementWrapperFunction)(ExecState*, PassRefPtr<HTMLElement>);
typedef JSNode* (*CreateHTMLElementWrapperFunction)(ExecState*, PassRefPtr<HTMLElement>);
#define FOR_EACH_TAG(macro) \
macro(a, Anchor) \
......@@ -207,14 +207,14 @@ typedef DOMNode* (*CreateHTMLElementWrapperFunction)(ExecState*, PassRefPtr<HTML
// end of macro
#define CREATE_WRAPPER_FUNCTION(tag, name) \
static DOMNode* create##name##Wrapper(ExecState* exec, PassRefPtr<HTMLElement> element) \
static JSNode* create##name##Wrapper(ExecState* exec, PassRefPtr<HTMLElement> element) \
{ \
return new JSHTML##name##Element(exec, static_cast<HTML##name##Element*>(element.get())); \
}
FOR_EACH_TAG(CREATE_WRAPPER_FUNCTION)
#undef CREATE_WRAPPER_FUNCTION
DOMNode* createJSHTMLWrapper(ExecState* exec, PassRefPtr<HTMLElement> element)
JSNode* createJSHTMLWrapper(ExecState* exec, PassRefPtr<HTMLElement> element)
{
static HashMap<AtomicStringImpl*, CreateHTMLElementWrapperFunction> map;
if (map.isEmpty()) {
......
/*
* Copyright (C) 2006 Apple Computer, Inc.
* Copyright (C) 2006, 2007 Apple Inc. All ri
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -22,14 +22,15 @@
#include <wtf/Forward.h>
namespace KJS {
class DOMNode;
class ExecState;
}
namespace WebCore {
class JSNode;
class HTMLElement;
KJS::DOMNode* createJSHTMLWrapper(KJS::ExecState*, PassRefPtr<HTMLElement>);
JSNode* createJSHTMLWrapper(KJS::ExecState*, PassRefPtr<HTMLElement>);
}
......
......@@ -24,7 +24,6 @@
#include "HTMLOptionElement.h"
#include "JSHTMLOptionElement.h"
#include "Text.h"
#include "kjs_dom.h"
namespace WebCore {
......
......@@ -27,8 +27,9 @@
#include "JSNamedNodeMap.h"
#include "NamedNodeMap.h"
#include "kjs_dom.h"
#include "PlatformString.h"
#include "kjs_binding.h"
#include "kjs_dom.h"
namespace WebCore {
......
......@@ -62,6 +62,97 @@
namespace WebCore {
typedef int ExpectionCode;
KJS::JSValue* JSNode::insertBefore(KJS::ExecState* exec, const KJS::List& args)
{
ExceptionCode ec = 0;
bool ok = impl()->insertBefore(toNode(args[0]), toNode(args[1]), ec);
KJS::setDOMException(exec, ec);
if (ok)
return args[0];
return KJS::jsNull();
}
KJS::JSValue* JSNode::replaceChild(KJS::ExecState* exec, const KJS::List& args)
{
ExceptionCode ec = 0;
bool ok = impl()->replaceChild(toNode(args[0]), toNode(args[1]), ec);
KJS::setDOMException(exec, ec);
if (ok)
return args[1];
return KJS::jsNull();
}
KJS::JSValue* JSNode::removeChild(KJS::ExecState* exec, const KJS::List& args)
{
ExceptionCode ec = 0;
bool ok = impl()->removeChild(toNode(args[0]), ec);
KJS::setDOMException(exec, ec);
if (ok)
return args[0];
return KJS::jsNull();
}
KJS::JSValue* JSNode::appendChild(KJS::ExecState* exec, const KJS::List& args)
{
ExceptionCode ec = 0;
bool ok = impl()->appendChild(toNode(args[0]), ec);
KJS::setDOMException(exec, ec);
if (ok)
return args[0];
return KJS::jsNull();
}
void JSNode::mark()
{
ASSERT(!marked());
Node* node = m_impl.get();
// Nodes in the document are kept alive by ScriptInterpreter::mark,
// so we have no special responsibilities and can just call the base class here.
if (node->inDocument()) {
DOMObject::mark();
return;
}
// This is a node outside the document, so find the root of the tree it is in,
// and start marking from there.
Node* root = node;
for (Node* current = m_impl.get(); current; current = current->parentNode())
root = current;
// If we're already marking this tree, then we can simply mark this wrapper
// by calling the base class; our caller is iterating the tree.
if (root->m_inSubtreeMark) {
DOMObject::mark();
return;
}
// Mark the whole tree; use the global set of roots to avoid reentering.
root->m_inSubtreeMark = true;
for (Node* nodeToMark = root; nodeToMark; nodeToMark = nodeToMark->traverseNextNode()) {
JSNode* wrapper = KJS::ScriptInterpreter::getDOMNodeForDocument(m_impl->document(), nodeToMark);
if (wrapper) {
if (!wrapper->marked())
wrapper->mark();
} else if (nodeToMark == node) {
// This is the case where the map from the document to wrappers has
// been cleared out, but a wrapper is being marked. For now, we'll
// let the rest of the tree of wrappers get collected, because we have
// no good way of finding them. Later we should test behavior of other
// browsers and see if we need to preserve other wrappers in this case.
if (!marked())
mark();
}
}
root->m_inSubtreeMark = false;
// Double check that we actually ended up marked. This assert caught problems in the past.
ASSERT(marked());
}
KJS::JSValue* toJS(KJS::ExecState* exec, PassRefPtr<Node> n)
{
Node* node = n.get();
......@@ -70,7 +161,7 @@ KJS::JSValue* toJS(KJS::ExecState* exec, PassRefPtr<Node> n)
KJS::ScriptInterpreter* interp = static_cast<KJS::ScriptInterpreter*>(exec->dynamicInterpreter());
Document* doc = node->document();
KJS::DOMNode* ret = interp->getDOMNodeForDocument(doc, node);
JSNode* ret = interp->getDOMNodeForDocument(doc, node);
if (ret)
return ret;
......
/*
* Copyright (C) 2006 Apple Computer, Inc.
* Copyright (C) 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
......@@ -154,7 +154,7 @@ namespace WebCore {
using namespace SVGNames;
typedef DOMNode* (*CreateSVGElementWrapperFunction)(ExecState*, PassRefPtr<SVGElement>);
typedef JSNode* (*CreateSVGElementWrapperFunction)(ExecState*, PassRefPtr<SVGElement>);
#if ENABLE(SVG_EXPERIMENTAL_FEATURES)
#define FOR_EACH_TAG(macro) \
......@@ -261,14 +261,14 @@ typedef DOMNode* (*CreateSVGElementWrapperFunction)(ExecState*, PassRefPtr<SVGEl
#endif
#define CREATE_WRAPPER_FUNCTION(tag, name) \
static DOMNode* create##name##Wrapper(ExecState* exec, PassRefPtr<SVGElement> element) \
static JSNode* create##name##Wrapper(ExecState* exec, PassRefPtr<SVGElement> element) \
{ \
return new JSSVG##name##Element(exec, static_cast<SVG##name##Element*>(element.get())); \
}
FOR_EACH_TAG(CREATE_WRAPPER_FUNCTION)
#undef CREATE_WRAPPER_FUNCTION
DOMNode* createJSSVGWrapper(ExecState* exec, PassRefPtr<SVGElement> element)
JSNode* createJSSVGWrapper(ExecState* exec, PassRefPtr<SVGElement> element)
{
static HashMap<WebCore::AtomicStringImpl*, CreateSVGElementWrapperFunction> map;
if (map.isEmpty()) {
......
/*
* Copyright (C) 2006 Apple Computer, Inc.
* Copyright (C) 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
......@@ -24,15 +24,18 @@
#include <wtf/Forward.h>
namespace KJS {
class DOMNode;
class ExecState;
}
namespace WebCore {
class JSNode;
class SVGElement;
KJS::DOMNode* createJSSVGWrapper(KJS::ExecState*, PassRefPtr<SVGElement>);
JSNode* createJSSVGWrapper(KJS::ExecState*, PassRefPtr<SVGElement>);
}
#endif // ENABLE(SVG)
#endif
#endif // JSSVGElementWrapperFactory_h
......@@ -78,8 +78,8 @@ JSValue *XSLTProcessorPrototypeFunction::callAsFunction(ExecState *exec, JSObjec
case JSXSLTProcessor::ImportStylesheet:
{
JSValue *nodeVal = args[0];
if (nodeVal->isObject(&DOMNode::info)) {
DOMNode *node = static_cast<DOMNode *>(nodeVal);
if (nodeVal->isObject(&JSNode::info)) {
JSNode* node = static_cast<JSNode*>(nodeVal);
processor.importStylesheet(node->impl());
return jsUndefined();
}
......@@ -90,8 +90,8 @@ JSValue *XSLTProcessorPrototypeFunction::callAsFunction(ExecState *exec, JSObjec
{
JSValue *nodeVal = args[0];
JSValue *docVal = args[1];
if (nodeVal->isObject(&DOMNode::info) && docVal->isObject(&JSDocument::info)) {
Node* node = static_cast<DOMNode *>(nodeVal)->impl();
if (nodeVal->isObject(&JSNode::info) && docVal->isObject(&JSDocument::info)) {
Node* node = static_cast<JSNode*>(nodeVal)->impl();
Document* doc = static_cast<Document*>(static_cast<JSDocument *>(docVal)->impl());
return toJS(exec, processor.transformToFragment(node, doc).get());
}
......@@ -101,8 +101,8 @@ JSValue *XSLTProcessorPrototypeFunction::callAsFunction(ExecState *exec, JSObjec
case JSXSLTProcessor::TransformToDocument:
{
JSValue *nodeVal = args[0];
if (nodeVal->isObject(&DOMNode::info)) {
DOMNode *node = static_cast<DOMNode *>(nodeVal);
if (nodeVal->isObject(&JSNode::info)) {
JSNode* node = static_cast<JSNode*>(nodeVal);
RefPtr<Document> resultDocument = processor.transformToDocument(node->impl());
if (resultDocument)
return toJS(exec, resultDocument.get());
......
/*
* This file is part of the KDE libraries
* Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
* Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
* Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
* Copyright (C) 2007 Samuel Weinig <sam@webkit.org>
*
* This library is free software; you can redistribute it and/or
......@@ -31,13 +31,14 @@
#include "Event.h"
#include "EventNames.h"
#include "Frame.h"
#include "JSNode.h"
#include "Page.h"
#include "PlatformString.h"
#include "Range.h"
#include "RangeException.h"
#include "xmlhttprequest.h"
#include "kjs_dom.h"
#include "kjs_window.h"
#include "xmlhttprequest.h"
#include <kjs/collector.h>
#include <wtf/HashMap.h>
......@@ -55,7 +56,7 @@ using namespace EventNames;
namespace KJS {
typedef HashMap<void*, DOMObject*> DOMObjectMap;
typedef HashMap<Node*, DOMNode*> NodeMap;
typedef HashMap<Node*, JSNode*> NodeMap;
typedef HashMap<Document*, NodeMap*> NodePerDocMap;
// For debugging, keep a set of wrappers currently registered, and check that
......@@ -154,10 +155,10 @@ void ScriptInterpreter::forgetDOMObject(void* objectHandle)
domObjects().remove(objectHandle);
}
DOMNode* ScriptInterpreter::getDOMNodeForDocument(Document* document, Node* node)
JSNode* ScriptInterpreter::getDOMNodeForDocument(Document* document, Node* node)
{
if (!document)
return static_cast<DOMNode*>(domObjects().get(node));
return static_cast<JSNode*>(domObjects().get(node));
NodeMap* documentDict = domNodesPerDocument().get(document);
if (documentDict)
return documentDict->get(node);
......@@ -176,7 +177,7 @@ void ScriptInterpreter::forgetDOMNodeForDocument(Document* document, Node* node)
documentDict->remove(node);
}
void ScriptInterpreter::putDOMNodeForDocument(Document* document, Node* node, DOMNode* wrapper)
void ScriptInterpreter::putDOMNodeForDocument(Document* document, Node* node, JSNode* wrapper)
{
ADD_WRAPPER(wrapper);
if (!document) {
......@@ -209,7 +210,7 @@ void ScriptInterpreter::markDOMNodesForDocument(Document* doc)
NodeMap* nodeDict = dictIt->second;
NodeMap::iterator nodeEnd = nodeDict->end();
for (NodeMap::iterator nodeIt = nodeDict->begin(); nodeIt != nodeEnd; ++nodeIt) {
DOMNode* node = nodeIt->second;
JSNode* node = nodeIt->second;
// don't mark wrappers for nodes that are no longer in the
// document - they should not be saved if the node is not
// otherwise reachable from JS.
......@@ -230,7 +231,7 @@ ExecState* ScriptInterpreter::globalExec()
void ScriptInterpreter::updateDOMNodeDocument(Node* node, Document* oldDoc, Document* newDoc)
{
ASSERT(oldDoc != newDoc);
DOMNode* wrapper = getDOMNodeForDocument(oldDoc, node);
JSNode* wrapper = getDOMNodeForDocument(oldDoc, node);
if (wrapper) {
REMOVE_WRAPPER(wrapper);
putDOMNodeForDocument(newDoc, node, wrapper);
......
......@@ -38,6 +38,7 @@ namespace WebCore {
class Frame;
class Node;
class String;
class JSNode;
typedef int ExceptionCode;
}
......@@ -60,8 +61,6 @@ namespace KJS {
#endif
};
class DOMNode;
/**
* We inherit from Interpreter, to save a pointer to the HTML part
* that the interpreter runs for.
......@@ -75,8 +74,8 @@ namespace KJS {
static void putDOMObject(void* objectHandle, DOMObject*);
static void forgetDOMObject(void* objectHandle);
static DOMNode *getDOMNodeForDocument(WebCore::Document*, WebCore::Node*);
static void putDOMNodeForDocument(WebCore::Document*, WebCore::Node*, DOMNode *nodeWrapper);
static WebCore::JSNode* getDOMNodeForDocument(WebCore::Document*, WebCore::Node*);
static void putDOMNodeForDocument(WebCore::Document*, WebCore::Node*, WebCore::JSNode* nodeWrapper);
static void forgetDOMNodeForDocument(WebCore::Document*, WebCore::Node*);
static void forgetAllDOMNodesForDocument(WebCore::Document*);
static void updateDOMNodeDocument(WebCore::Node*, WebCore::Document* oldDoc, WebCore::Document* newDoc);
......@@ -151,7 +150,7 @@ namespace KJS {
WebCore::String valueToStringWithUndefinedOrNullCheck(ExecState*, JSValue*); // null String if the value is null or undefined
template <typename T> inline JSValue* toJS(ExecState* exec, PassRefPtr<T> ptr) { return toJS(exec, ptr.get()); }
} // namespace
#endif
......@@ -21,299 +21,29 @@
#include "config.h"
#include "kjs_dom.h"
#include "CDATASection.h"
#include "Comment.h"
#include "DOMImplementation.h"
#include "DocumentFragment.h"
#include "DocumentType.h"
#include "Element.h"
#include "Entity.h"
#include "EntityReference.h"
#include "Event.h"
#include "EventNames.h"
#include "Document.h"
#include "EventTarget.h"
#include "ExceptionCode.h"
#include "Frame.h"
#include "HTMLDocument.h"
#include "HTMLNames.h"
#include "HTMLPlugInElement.h"
#include "JSAttr.h"
#include "JSCDATASection.h"
#include "JSComment.h"
#include "JSDOMImplementation.h"
#include "JSDocumentFragment.h"
#include "JSDocumentType.h"
#include "JSElement.h"
#include "JSEntity.h"
#include "JSEntityReference.h"
#include "JSHTMLDocument.h"
#include "JSHTMLElementWrapperFactory.h"
#include "JSNamedNodeMap.h"
#include "JSNode.h"
#include "JSNodeList.h"
#include "JSNotation.h"
#include "JSProcessingInstruction.h"
#include "JSRange.h"
#include "JSText.h"
#include "NamedNodeMap.h"
#include "NodeList.h"
#include "Notation.h"
#include "ProcessingInstruction.h"
#include "Range.h"
#include "RenderView.h"
#include "kjs_css.h"
#include "kjs_events.h"
#include "kjs_window.h"