~ubuntu-branches/ubuntu/karmic/webkit/karmic-proposed

« back to all changes in this revision

Viewing changes to WebCore/bindings/js/JSNodeCustom.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-05-15 18:30:58 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090515183058-50q5exjo9b1kxy9s
Tags: 1.1.7-1
* New upstream release
* debian/libwebkit-1.0-2.symbols:
- updated with the new symbols in 1.1.7
* debian/libwebkit-dev.install, debian/libwebkit-dev.links,
  debian/rules:
- Build, and ship gtk-doc documentation (Closes: #526683)
* debian/copyright:
- updated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
 
69
69
typedef int ExpectionCode;
70
70
 
71
 
JSValuePtr JSNode::insertBefore(ExecState* exec, const ArgList& args)
72
 
{
73
 
    ExceptionCode ec = 0;
74
 
    bool ok = impl()->insertBefore(toNode(args.at(exec, 0)), toNode(args.at(exec, 1)), ec, true);
75
 
    setDOMException(exec, ec);
76
 
    if (ok)
77
 
        return args.at(exec, 0);
78
 
    return jsNull();
79
 
}
80
 
 
81
 
JSValuePtr JSNode::replaceChild(ExecState* exec, const ArgList& args)
82
 
{
83
 
    ExceptionCode ec = 0;
84
 
    bool ok = impl()->replaceChild(toNode(args.at(exec, 0)), toNode(args.at(exec, 1)), ec, true);
85
 
    setDOMException(exec, ec);
86
 
    if (ok)
87
 
        return args.at(exec, 1);
88
 
    return jsNull();
89
 
}
90
 
 
91
 
JSValuePtr JSNode::removeChild(ExecState* exec, const ArgList& args)
92
 
{
93
 
    ExceptionCode ec = 0;
94
 
    bool ok = impl()->removeChild(toNode(args.at(exec, 0)), ec);
95
 
    setDOMException(exec, ec);
96
 
    if (ok)
97
 
        return args.at(exec, 0);
98
 
    return jsNull();
99
 
}
100
 
 
101
 
JSValuePtr JSNode::appendChild(ExecState* exec, const ArgList& args)
102
 
{
103
 
    ExceptionCode ec = 0;
104
 
    bool ok = impl()->appendChild(toNode(args.at(exec, 0)), ec, true);
105
 
    setDOMException(exec, ec);
106
 
    if (ok)
107
 
        return args.at(exec, 0);
108
 
    return jsNull();
109
 
}
110
 
 
111
 
JSValuePtr JSNode::addEventListener(ExecState* exec, const ArgList& args)
 
71
JSValue JSNode::insertBefore(ExecState* exec, const ArgList& args)
 
72
{
 
73
    ExceptionCode ec = 0;
 
74
    bool ok = impl()->insertBefore(toNode(args.at(0)), toNode(args.at(1)), ec, true);
 
75
    setDOMException(exec, ec);
 
76
    if (ok)
 
77
        return args.at(0);
 
78
    return jsNull();
 
79
}
 
80
 
 
81
JSValue JSNode::replaceChild(ExecState* exec, const ArgList& args)
 
82
{
 
83
    ExceptionCode ec = 0;
 
84
    bool ok = impl()->replaceChild(toNode(args.at(0)), toNode(args.at(1)), ec, true);
 
85
    setDOMException(exec, ec);
 
86
    if (ok)
 
87
        return args.at(1);
 
88
    return jsNull();
 
89
}
 
90
 
 
91
JSValue JSNode::removeChild(ExecState* exec, const ArgList& args)
 
92
{
 
93
    ExceptionCode ec = 0;
 
94
    bool ok = impl()->removeChild(toNode(args.at(0)), ec);
 
95
    setDOMException(exec, ec);
 
96
    if (ok)
 
97
        return args.at(0);
 
98
    return jsNull();
 
99
}
 
100
 
 
101
JSValue JSNode::appendChild(ExecState* exec, const ArgList& args)
 
102
{
 
103
    ExceptionCode ec = 0;
 
104
    bool ok = impl()->appendChild(toNode(args.at(0)), ec, true);
 
105
    setDOMException(exec, ec);
 
106
    if (ok)
 
107
        return args.at(0);
 
108
    return jsNull();
 
109
}
 
110
 
 
111
JSValue JSNode::addEventListener(ExecState* exec, const ArgList& args)
112
112
{
113
113
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
114
114
    if (!globalObject)
115
115
        return jsUndefined();
116
116
 
117
 
    if (RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(exec, 1)))
118
 
        impl()->addEventListener(args.at(exec, 0).toString(exec), listener.release(), args.at(exec, 2).toBoolean(exec));
 
117
    if (RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(1)))
 
118
        impl()->addEventListener(args.at(0).toString(exec), listener.release(), args.at(2).toBoolean(exec));
119
119
 
120
120
    return jsUndefined();
121
121
}
122
122
 
123
 
JSValuePtr JSNode::removeEventListener(ExecState* exec, const ArgList& args)
 
123
JSValue JSNode::removeEventListener(ExecState* exec, const ArgList& args)
124
124
{
125
125
    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext());
126
126
    if (!globalObject)
127
127
        return jsUndefined();
128
128
 
129
 
    if (JSEventListener* listener = globalObject->findJSEventListener(args.at(exec, 1)))
130
 
        impl()->removeEventListener(args.at(exec, 0).toString(exec), listener, args.at(exec, 2).toBoolean(exec));
 
129
    if (JSEventListener* listener = globalObject->findJSEventListener(args.at(1)))
 
130
        impl()->removeEventListener(args.at(0).toString(exec), listener, args.at(2).toBoolean(exec));
131
131
 
132
132
    return jsUndefined();
133
133
}
192
192
    ASSERT(marked());
193
193
}
194
194
 
195
 
static ALWAYS_INLINE JSValuePtr createWrapper(ExecState* exec, Node* node)
 
195
static ALWAYS_INLINE JSValue createWrapper(ExecState* exec, Node* node)
196
196
{
197
197
    ASSERT(node);
198
198
    ASSERT(!getCachedDOMNodeWrapper(node->document(), node));
249
249
    return wrapper;    
250
250
}
251
251
    
252
 
JSValuePtr toJSNewlyCreated(ExecState* exec, Node* node)
 
252
JSValue toJSNewlyCreated(ExecState* exec, Node* node)
253
253
{
254
254
    if (!node)
255
255
        return jsNull();
257
257
    return createWrapper(exec, node);
258
258
}
259
259
    
260
 
JSValuePtr toJS(ExecState* exec, Node* node)
 
260
JSValue toJS(ExecState* exec, Node* node)
261
261
{
262
262
    if (!node)
263
263
        return jsNull();