1 /*
2     This file is part of the WebKit open source project.
3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4 
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Library General Public
7     License as published by the Free Software Foundation; either
8     version 2 of the License, or (at your option) any later version.
9 
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13     Library General Public License for more details.
14 
15     You should have received a copy of the GNU Library General Public License
16     along with this library; see the file COPYING.LIB.  If not, write to
17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18     Boston, MA 02110-1301, USA.
19 */
20 
21 #include "config.h"
22 #include "JSElement.h"
23 
24 #include "Attr.h"
25 #include "CSSMutableStyleDeclaration.h"
26 #include "CSSStyleDeclaration.h"
27 #include "ClientRect.h"
28 #include "ClientRectList.h"
29 #include "DOMStringMap.h"
30 #include "Element.h"
31 #include "EventListener.h"
32 #include "ExceptionCode.h"
33 #include "JSAttr.h"
34 #include "JSCSSStyleDeclaration.h"
35 #include "JSClientRect.h"
36 #include "JSClientRectList.h"
37 #include "JSDOMBinding.h"
38 #include "JSDOMStringMap.h"
39 #include "JSElement.h"
40 #include "JSEventListener.h"
41 #include "JSNodeList.h"
42 #include "KURL.h"
43 #include "NameNodeList.h"
44 #include "NodeList.h"
45 #include <runtime/Error.h>
46 #include <runtime/JSString.h>
47 #include <wtf/GetPtr.h>
48 
49 using namespace JSC;
50 
51 namespace WebCore {
52 
53 ASSERT_CLASS_FITS_IN_CELL(JSElement);
54 
55 /* Hash table */
56 #if ENABLE(JIT)
57 #define THUNK_GENERATOR(generator) , generator
58 #else
59 #define THUNK_GENERATOR(generator)
60 #endif
61 
62 static const HashTableValue JSElementTableValues[67] =
63 {
64     { "tagName", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementTagName), (intptr_t)0 THUNK_GENERATOR(0) },
65     { "style", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementStyle), (intptr_t)0 THUNK_GENERATOR(0) },
66     { "offsetLeft", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOffsetLeft), (intptr_t)0 THUNK_GENERATOR(0) },
67     { "offsetTop", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOffsetTop), (intptr_t)0 THUNK_GENERATOR(0) },
68     { "offsetWidth", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOffsetWidth), (intptr_t)0 THUNK_GENERATOR(0) },
69     { "offsetHeight", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOffsetHeight), (intptr_t)0 THUNK_GENERATOR(0) },
70     { "offsetParent", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOffsetParent), (intptr_t)0 THUNK_GENERATOR(0) },
71     { "clientLeft", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementClientLeft), (intptr_t)0 THUNK_GENERATOR(0) },
72     { "clientTop", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementClientTop), (intptr_t)0 THUNK_GENERATOR(0) },
73     { "clientWidth", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementClientWidth), (intptr_t)0 THUNK_GENERATOR(0) },
74     { "clientHeight", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementClientHeight), (intptr_t)0 THUNK_GENERATOR(0) },
75     { "scrollLeft", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementScrollLeft), (intptr_t)setJSElementScrollLeft THUNK_GENERATOR(0) },
76     { "scrollTop", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementScrollTop), (intptr_t)setJSElementScrollTop THUNK_GENERATOR(0) },
77     { "scrollWidth", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementScrollWidth), (intptr_t)0 THUNK_GENERATOR(0) },
78     { "scrollHeight", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementScrollHeight), (intptr_t)0 THUNK_GENERATOR(0) },
79     { "dataset", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementDataset), (intptr_t)0 THUNK_GENERATOR(0) },
80     { "firstElementChild", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementFirstElementChild), (intptr_t)0 THUNK_GENERATOR(0) },
81     { "lastElementChild", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementLastElementChild), (intptr_t)0 THUNK_GENERATOR(0) },
82     { "previousElementSibling", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementPreviousElementSibling), (intptr_t)0 THUNK_GENERATOR(0) },
83     { "nextElementSibling", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementNextElementSibling), (intptr_t)0 THUNK_GENERATOR(0) },
84     { "childElementCount", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementChildElementCount), (intptr_t)0 THUNK_GENERATOR(0) },
85     { "onabort", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnabort), (intptr_t)setJSElementOnabort THUNK_GENERATOR(0) },
86     { "onblur", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnblur), (intptr_t)setJSElementOnblur THUNK_GENERATOR(0) },
87     { "onchange", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnchange), (intptr_t)setJSElementOnchange THUNK_GENERATOR(0) },
88     { "onclick", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnclick), (intptr_t)setJSElementOnclick THUNK_GENERATOR(0) },
89     { "oncontextmenu", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOncontextmenu), (intptr_t)setJSElementOncontextmenu THUNK_GENERATOR(0) },
90     { "ondblclick", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOndblclick), (intptr_t)setJSElementOndblclick THUNK_GENERATOR(0) },
91     { "ondrag", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOndrag), (intptr_t)setJSElementOndrag THUNK_GENERATOR(0) },
92     { "ondragend", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOndragend), (intptr_t)setJSElementOndragend THUNK_GENERATOR(0) },
93     { "ondragenter", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOndragenter), (intptr_t)setJSElementOndragenter THUNK_GENERATOR(0) },
94     { "ondragleave", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOndragleave), (intptr_t)setJSElementOndragleave THUNK_GENERATOR(0) },
95     { "ondragover", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOndragover), (intptr_t)setJSElementOndragover THUNK_GENERATOR(0) },
96     { "ondragstart", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOndragstart), (intptr_t)setJSElementOndragstart THUNK_GENERATOR(0) },
97     { "ondrop", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOndrop), (intptr_t)setJSElementOndrop THUNK_GENERATOR(0) },
98     { "onerror", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnerror), (intptr_t)setJSElementOnerror THUNK_GENERATOR(0) },
99     { "onfocus", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnfocus), (intptr_t)setJSElementOnfocus THUNK_GENERATOR(0) },
100     { "oninput", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOninput), (intptr_t)setJSElementOninput THUNK_GENERATOR(0) },
101     { "oninvalid", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOninvalid), (intptr_t)setJSElementOninvalid THUNK_GENERATOR(0) },
102     { "onkeydown", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnkeydown), (intptr_t)setJSElementOnkeydown THUNK_GENERATOR(0) },
103     { "onkeypress", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnkeypress), (intptr_t)setJSElementOnkeypress THUNK_GENERATOR(0) },
104     { "onkeyup", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnkeyup), (intptr_t)setJSElementOnkeyup THUNK_GENERATOR(0) },
105     { "onload", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnload), (intptr_t)setJSElementOnload THUNK_GENERATOR(0) },
106     { "onmousedown", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnmousedown), (intptr_t)setJSElementOnmousedown THUNK_GENERATOR(0) },
107     { "onmousemove", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnmousemove), (intptr_t)setJSElementOnmousemove THUNK_GENERATOR(0) },
108     { "onmouseout", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnmouseout), (intptr_t)setJSElementOnmouseout THUNK_GENERATOR(0) },
109     { "onmouseover", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnmouseover), (intptr_t)setJSElementOnmouseover THUNK_GENERATOR(0) },
110     { "onmouseup", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnmouseup), (intptr_t)setJSElementOnmouseup THUNK_GENERATOR(0) },
111     { "onmousewheel", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnmousewheel), (intptr_t)setJSElementOnmousewheel THUNK_GENERATOR(0) },
112     { "onscroll", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnscroll), (intptr_t)setJSElementOnscroll THUNK_GENERATOR(0) },
113     { "onselect", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnselect), (intptr_t)setJSElementOnselect THUNK_GENERATOR(0) },
114     { "onsubmit", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnsubmit), (intptr_t)setJSElementOnsubmit THUNK_GENERATOR(0) },
115     { "onbeforecut", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnbeforecut), (intptr_t)setJSElementOnbeforecut THUNK_GENERATOR(0) },
116     { "oncut", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOncut), (intptr_t)setJSElementOncut THUNK_GENERATOR(0) },
117     { "onbeforecopy", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnbeforecopy), (intptr_t)setJSElementOnbeforecopy THUNK_GENERATOR(0) },
118     { "oncopy", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOncopy), (intptr_t)setJSElementOncopy THUNK_GENERATOR(0) },
119     { "onbeforepaste", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnbeforepaste), (intptr_t)setJSElementOnbeforepaste THUNK_GENERATOR(0) },
120     { "onpaste", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnpaste), (intptr_t)setJSElementOnpaste THUNK_GENERATOR(0) },
121     { "onreset", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnreset), (intptr_t)setJSElementOnreset THUNK_GENERATOR(0) },
122     { "onsearch", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnsearch), (intptr_t)setJSElementOnsearch THUNK_GENERATOR(0) },
123     { "onselectstart", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnselectstart), (intptr_t)setJSElementOnselectstart THUNK_GENERATOR(0) },
124 #if ENABLE(TOUCH_EVENTS)
125     { "ontouchstart", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOntouchstart), (intptr_t)setJSElementOntouchstart THUNK_GENERATOR(0) },
126 #endif
127 #if ENABLE(TOUCH_EVENTS)
128     { "ontouchmove", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOntouchmove), (intptr_t)setJSElementOntouchmove THUNK_GENERATOR(0) },
129 #endif
130 #if ENABLE(TOUCH_EVENTS)
131     { "ontouchend", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOntouchend), (intptr_t)setJSElementOntouchend THUNK_GENERATOR(0) },
132 #endif
133 #if ENABLE(TOUCH_EVENTS)
134     { "ontouchcancel", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOntouchcancel), (intptr_t)setJSElementOntouchcancel THUNK_GENERATOR(0) },
135 #endif
136 #if ENABLE(FULLSCREEN_API)
137     { "onwebkitfullscreenchange", DontDelete | DontEnum, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementOnwebkitfullscreenchange), (intptr_t)setJSElementOnwebkitfullscreenchange THUNK_GENERATOR(0) },
138 #endif
139     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsElementConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
140     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
141 };
142 
143 #undef THUNK_GENERATOR
144 static JSC_CONST_HASHTABLE HashTable JSElementTable = { 264, 255, JSElementTableValues, 0 };
145 /* Hash table for constructor */
146 #if ENABLE(JIT)
147 #define THUNK_GENERATOR(generator) , generator
148 #else
149 #define THUNK_GENERATOR(generator)
150 #endif
151 
152 static const HashTableValue JSElementConstructorTableValues[1] =
153 {
154     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
155 };
156 
157 #undef THUNK_GENERATOR
158 static JSC_CONST_HASHTABLE HashTable JSElementConstructorTable = { 1, 0, JSElementConstructorTableValues, 0 };
159 class JSElementConstructor : public DOMConstructorObject {
160 public:
161     JSElementConstructor(JSC::ExecState*, JSC::Structure*, JSDOMGlobalObject*);
162 
163     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
164     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
165     static const JSC::ClassInfo s_info;
createStructure(JSC::JSGlobalData & globalData,JSC::JSValue prototype)166     static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
167     {
168         return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
169     }
170 protected:
171     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
172 };
173 
174 const ClassInfo JSElementConstructor::s_info = { "ElementConstructor", &DOMConstructorObject::s_info, &JSElementConstructorTable, 0 };
175 
JSElementConstructor(ExecState * exec,Structure * structure,JSDOMGlobalObject * globalObject)176 JSElementConstructor::JSElementConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject)
177     : DOMConstructorObject(structure, globalObject)
178 {
179     ASSERT(inherits(&s_info));
180     putDirect(exec->globalData(), exec->propertyNames().prototype, JSElementPrototype::self(exec, globalObject), DontDelete | ReadOnly);
181 }
182 
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)183 bool JSElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
184 {
185     return getStaticValueSlot<JSElementConstructor, JSDOMWrapper>(exec, &JSElementConstructorTable, this, propertyName, slot);
186 }
187 
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)188 bool JSElementConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
189 {
190     return getStaticValueDescriptor<JSElementConstructor, JSDOMWrapper>(exec, &JSElementConstructorTable, this, propertyName, descriptor);
191 }
192 
193 /* Hash table for prototype */
194 #if ENABLE(JIT)
195 #define THUNK_GENERATOR(generator) , generator
196 #else
197 #define THUNK_GENERATOR(generator)
198 #endif
199 
200 static const HashTableValue JSElementPrototypeTableValues[29] =
201 {
202     { "getAttribute", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionGetAttribute), (intptr_t)1 THUNK_GENERATOR(0) },
203     { "setAttribute", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionSetAttribute), (intptr_t)2 THUNK_GENERATOR(0) },
204     { "removeAttribute", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionRemoveAttribute), (intptr_t)1 THUNK_GENERATOR(0) },
205     { "getAttributeNode", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionGetAttributeNode), (intptr_t)1 THUNK_GENERATOR(0) },
206     { "setAttributeNode", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionSetAttributeNode), (intptr_t)1 THUNK_GENERATOR(0) },
207     { "removeAttributeNode", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionRemoveAttributeNode), (intptr_t)1 THUNK_GENERATOR(0) },
208     { "getElementsByTagName", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionGetElementsByTagName), (intptr_t)1 THUNK_GENERATOR(0) },
209     { "getAttributeNS", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionGetAttributeNS), (intptr_t)2 THUNK_GENERATOR(0) },
210     { "setAttributeNS", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionSetAttributeNS), (intptr_t)3 THUNK_GENERATOR(0) },
211     { "removeAttributeNS", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionRemoveAttributeNS), (intptr_t)2 THUNK_GENERATOR(0) },
212     { "getElementsByTagNameNS", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionGetElementsByTagNameNS), (intptr_t)2 THUNK_GENERATOR(0) },
213     { "getAttributeNodeNS", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionGetAttributeNodeNS), (intptr_t)2 THUNK_GENERATOR(0) },
214     { "setAttributeNodeNS", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionSetAttributeNodeNS), (intptr_t)1 THUNK_GENERATOR(0) },
215     { "hasAttribute", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionHasAttribute), (intptr_t)1 THUNK_GENERATOR(0) },
216     { "hasAttributeNS", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionHasAttributeNS), (intptr_t)2 THUNK_GENERATOR(0) },
217     { "focus", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionFocus), (intptr_t)0 THUNK_GENERATOR(0) },
218     { "blur", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionBlur), (intptr_t)0 THUNK_GENERATOR(0) },
219     { "scrollIntoView", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionScrollIntoView), (intptr_t)1 THUNK_GENERATOR(0) },
220     { "contains", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionContains), (intptr_t)1 THUNK_GENERATOR(0) },
221     { "scrollIntoViewIfNeeded", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionScrollIntoViewIfNeeded), (intptr_t)1 THUNK_GENERATOR(0) },
222     { "scrollByLines", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionScrollByLines), (intptr_t)1 THUNK_GENERATOR(0) },
223     { "scrollByPages", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionScrollByPages), (intptr_t)1 THUNK_GENERATOR(0) },
224     { "getElementsByClassName", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionGetElementsByClassName), (intptr_t)1 THUNK_GENERATOR(0) },
225     { "querySelector", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionQuerySelector), (intptr_t)1 THUNK_GENERATOR(0) },
226     { "querySelectorAll", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionQuerySelectorAll), (intptr_t)1 THUNK_GENERATOR(0) },
227     { "webkitMatchesSelector", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionWebkitMatchesSelector), (intptr_t)1 THUNK_GENERATOR(0) },
228     { "getClientRects", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionGetClientRects), (intptr_t)0 THUNK_GENERATOR(0) },
229     { "getBoundingClientRect", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsElementPrototypeFunctionGetBoundingClientRect), (intptr_t)0 THUNK_GENERATOR(0) },
230     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
231 };
232 
233 #undef THUNK_GENERATOR
234 static JSC_CONST_HASHTABLE HashTable JSElementPrototypeTable = { 69, 63, JSElementPrototypeTableValues, 0 };
235 const ClassInfo JSElementPrototype::s_info = { "ElementPrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSElementPrototypeTable, 0 };
236 
self(ExecState * exec,JSGlobalObject * globalObject)237 JSObject* JSElementPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
238 {
239     return getDOMPrototype<JSElement>(exec, globalObject);
240 }
241 
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)242 bool JSElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
243 {
244     return getStaticFunctionSlot<JSObject>(exec, &JSElementPrototypeTable, this, propertyName, slot);
245 }
246 
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)247 bool JSElementPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
248 {
249     return getStaticFunctionDescriptor<JSObject>(exec, &JSElementPrototypeTable, this, propertyName, descriptor);
250 }
251 
252 const ClassInfo JSElement::s_info = { "Element", &JSNode::s_info, &JSElementTable, 0 };
253 
JSElement(Structure * structure,JSDOMGlobalObject * globalObject,PassRefPtr<Element> impl)254 JSElement::JSElement(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<Element> impl)
255     : JSNode(structure, globalObject, impl)
256 {
257     ASSERT(inherits(&s_info));
258 }
259 
createPrototype(ExecState * exec,JSGlobalObject * globalObject)260 JSObject* JSElement::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
261 {
262     return new (exec) JSElementPrototype(exec->globalData(), globalObject, JSElementPrototype::createStructure(exec->globalData(), JSNodePrototype::self(exec, globalObject)));
263 }
264 
jsElementTagName(ExecState * exec,JSValue slotBase,const Identifier &)265 JSValue jsElementTagName(ExecState* exec, JSValue slotBase, const Identifier&)
266 {
267     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
268     UNUSED_PARAM(exec);
269     Element* imp = static_cast<Element*>(castedThis->impl());
270     JSValue result = jsStringOrNull(exec, imp->tagName());
271     return result;
272 }
273 
274 
jsElementStyle(ExecState * exec,JSValue slotBase,const Identifier &)275 JSValue jsElementStyle(ExecState* exec, JSValue slotBase, const Identifier&)
276 {
277     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
278     UNUSED_PARAM(exec);
279     Element* imp = static_cast<Element*>(castedThis->impl());
280     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->style()));
281     return result;
282 }
283 
284 
jsElementOffsetLeft(ExecState * exec,JSValue slotBase,const Identifier &)285 JSValue jsElementOffsetLeft(ExecState* exec, JSValue slotBase, const Identifier&)
286 {
287     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
288     UNUSED_PARAM(exec);
289     Element* imp = static_cast<Element*>(castedThis->impl());
290     JSValue result = jsNumber(imp->offsetLeft());
291     return result;
292 }
293 
294 
jsElementOffsetTop(ExecState * exec,JSValue slotBase,const Identifier &)295 JSValue jsElementOffsetTop(ExecState* exec, JSValue slotBase, const Identifier&)
296 {
297     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
298     UNUSED_PARAM(exec);
299     Element* imp = static_cast<Element*>(castedThis->impl());
300     JSValue result = jsNumber(imp->offsetTop());
301     return result;
302 }
303 
304 
jsElementOffsetWidth(ExecState * exec,JSValue slotBase,const Identifier &)305 JSValue jsElementOffsetWidth(ExecState* exec, JSValue slotBase, const Identifier&)
306 {
307     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
308     UNUSED_PARAM(exec);
309     Element* imp = static_cast<Element*>(castedThis->impl());
310     JSValue result = jsNumber(imp->offsetWidth());
311     return result;
312 }
313 
314 
jsElementOffsetHeight(ExecState * exec,JSValue slotBase,const Identifier &)315 JSValue jsElementOffsetHeight(ExecState* exec, JSValue slotBase, const Identifier&)
316 {
317     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
318     UNUSED_PARAM(exec);
319     Element* imp = static_cast<Element*>(castedThis->impl());
320     JSValue result = jsNumber(imp->offsetHeight());
321     return result;
322 }
323 
324 
jsElementOffsetParent(ExecState * exec,JSValue slotBase,const Identifier &)325 JSValue jsElementOffsetParent(ExecState* exec, JSValue slotBase, const Identifier&)
326 {
327     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
328     UNUSED_PARAM(exec);
329     Element* imp = static_cast<Element*>(castedThis->impl());
330     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->offsetParent()));
331     return result;
332 }
333 
334 
jsElementClientLeft(ExecState * exec,JSValue slotBase,const Identifier &)335 JSValue jsElementClientLeft(ExecState* exec, JSValue slotBase, const Identifier&)
336 {
337     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
338     UNUSED_PARAM(exec);
339     Element* imp = static_cast<Element*>(castedThis->impl());
340     JSValue result = jsNumber(imp->clientLeft());
341     return result;
342 }
343 
344 
jsElementClientTop(ExecState * exec,JSValue slotBase,const Identifier &)345 JSValue jsElementClientTop(ExecState* exec, JSValue slotBase, const Identifier&)
346 {
347     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
348     UNUSED_PARAM(exec);
349     Element* imp = static_cast<Element*>(castedThis->impl());
350     JSValue result = jsNumber(imp->clientTop());
351     return result;
352 }
353 
354 
jsElementClientWidth(ExecState * exec,JSValue slotBase,const Identifier &)355 JSValue jsElementClientWidth(ExecState* exec, JSValue slotBase, const Identifier&)
356 {
357     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
358     UNUSED_PARAM(exec);
359     Element* imp = static_cast<Element*>(castedThis->impl());
360     JSValue result = jsNumber(imp->clientWidth());
361     return result;
362 }
363 
364 
jsElementClientHeight(ExecState * exec,JSValue slotBase,const Identifier &)365 JSValue jsElementClientHeight(ExecState* exec, JSValue slotBase, const Identifier&)
366 {
367     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
368     UNUSED_PARAM(exec);
369     Element* imp = static_cast<Element*>(castedThis->impl());
370     JSValue result = jsNumber(imp->clientHeight());
371     return result;
372 }
373 
374 
jsElementScrollLeft(ExecState * exec,JSValue slotBase,const Identifier &)375 JSValue jsElementScrollLeft(ExecState* exec, JSValue slotBase, const Identifier&)
376 {
377     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
378     UNUSED_PARAM(exec);
379     Element* imp = static_cast<Element*>(castedThis->impl());
380     JSValue result = jsNumber(imp->scrollLeft());
381     return result;
382 }
383 
384 
jsElementScrollTop(ExecState * exec,JSValue slotBase,const Identifier &)385 JSValue jsElementScrollTop(ExecState* exec, JSValue slotBase, const Identifier&)
386 {
387     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
388     UNUSED_PARAM(exec);
389     Element* imp = static_cast<Element*>(castedThis->impl());
390     JSValue result = jsNumber(imp->scrollTop());
391     return result;
392 }
393 
394 
jsElementScrollWidth(ExecState * exec,JSValue slotBase,const Identifier &)395 JSValue jsElementScrollWidth(ExecState* exec, JSValue slotBase, const Identifier&)
396 {
397     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
398     UNUSED_PARAM(exec);
399     Element* imp = static_cast<Element*>(castedThis->impl());
400     JSValue result = jsNumber(imp->scrollWidth());
401     return result;
402 }
403 
404 
jsElementScrollHeight(ExecState * exec,JSValue slotBase,const Identifier &)405 JSValue jsElementScrollHeight(ExecState* exec, JSValue slotBase, const Identifier&)
406 {
407     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
408     UNUSED_PARAM(exec);
409     Element* imp = static_cast<Element*>(castedThis->impl());
410     JSValue result = jsNumber(imp->scrollHeight());
411     return result;
412 }
413 
414 
jsElementDataset(ExecState * exec,JSValue slotBase,const Identifier &)415 JSValue jsElementDataset(ExecState* exec, JSValue slotBase, const Identifier&)
416 {
417     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
418     UNUSED_PARAM(exec);
419     Element* imp = static_cast<Element*>(castedThis->impl());
420     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->dataset()));
421     return result;
422 }
423 
424 
jsElementFirstElementChild(ExecState * exec,JSValue slotBase,const Identifier &)425 JSValue jsElementFirstElementChild(ExecState* exec, JSValue slotBase, const Identifier&)
426 {
427     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
428     UNUSED_PARAM(exec);
429     Element* imp = static_cast<Element*>(castedThis->impl());
430     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->firstElementChild()));
431     return result;
432 }
433 
434 
jsElementLastElementChild(ExecState * exec,JSValue slotBase,const Identifier &)435 JSValue jsElementLastElementChild(ExecState* exec, JSValue slotBase, const Identifier&)
436 {
437     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
438     UNUSED_PARAM(exec);
439     Element* imp = static_cast<Element*>(castedThis->impl());
440     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->lastElementChild()));
441     return result;
442 }
443 
444 
jsElementPreviousElementSibling(ExecState * exec,JSValue slotBase,const Identifier &)445 JSValue jsElementPreviousElementSibling(ExecState* exec, JSValue slotBase, const Identifier&)
446 {
447     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
448     UNUSED_PARAM(exec);
449     Element* imp = static_cast<Element*>(castedThis->impl());
450     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->previousElementSibling()));
451     return result;
452 }
453 
454 
jsElementNextElementSibling(ExecState * exec,JSValue slotBase,const Identifier &)455 JSValue jsElementNextElementSibling(ExecState* exec, JSValue slotBase, const Identifier&)
456 {
457     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
458     UNUSED_PARAM(exec);
459     Element* imp = static_cast<Element*>(castedThis->impl());
460     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->nextElementSibling()));
461     return result;
462 }
463 
464 
jsElementChildElementCount(ExecState * exec,JSValue slotBase,const Identifier &)465 JSValue jsElementChildElementCount(ExecState* exec, JSValue slotBase, const Identifier&)
466 {
467     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
468     UNUSED_PARAM(exec);
469     Element* imp = static_cast<Element*>(castedThis->impl());
470     JSValue result = jsNumber(imp->childElementCount());
471     return result;
472 }
473 
474 
jsElementOnabort(ExecState * exec,JSValue slotBase,const Identifier &)475 JSValue jsElementOnabort(ExecState* exec, JSValue slotBase, const Identifier&)
476 {
477     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
478     UNUSED_PARAM(exec);
479     Element* imp = static_cast<Element*>(castedThis->impl());
480     if (EventListener* listener = imp->onabort()) {
481         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
482             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
483                 return jsFunction;
484         }
485     }
486     return jsNull();
487 }
488 
489 
jsElementOnblur(ExecState * exec,JSValue slotBase,const Identifier &)490 JSValue jsElementOnblur(ExecState* exec, JSValue slotBase, const Identifier&)
491 {
492     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
493     UNUSED_PARAM(exec);
494     Element* imp = static_cast<Element*>(castedThis->impl());
495     if (EventListener* listener = imp->onblur()) {
496         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
497             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
498                 return jsFunction;
499         }
500     }
501     return jsNull();
502 }
503 
504 
jsElementOnchange(ExecState * exec,JSValue slotBase,const Identifier &)505 JSValue jsElementOnchange(ExecState* exec, JSValue slotBase, const Identifier&)
506 {
507     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
508     UNUSED_PARAM(exec);
509     Element* imp = static_cast<Element*>(castedThis->impl());
510     if (EventListener* listener = imp->onchange()) {
511         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
512             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
513                 return jsFunction;
514         }
515     }
516     return jsNull();
517 }
518 
519 
jsElementOnclick(ExecState * exec,JSValue slotBase,const Identifier &)520 JSValue jsElementOnclick(ExecState* exec, JSValue slotBase, const Identifier&)
521 {
522     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
523     UNUSED_PARAM(exec);
524     Element* imp = static_cast<Element*>(castedThis->impl());
525     if (EventListener* listener = imp->onclick()) {
526         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
527             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
528                 return jsFunction;
529         }
530     }
531     return jsNull();
532 }
533 
534 
jsElementOncontextmenu(ExecState * exec,JSValue slotBase,const Identifier &)535 JSValue jsElementOncontextmenu(ExecState* exec, JSValue slotBase, const Identifier&)
536 {
537     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
538     UNUSED_PARAM(exec);
539     Element* imp = static_cast<Element*>(castedThis->impl());
540     if (EventListener* listener = imp->oncontextmenu()) {
541         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
542             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
543                 return jsFunction;
544         }
545     }
546     return jsNull();
547 }
548 
549 
jsElementOndblclick(ExecState * exec,JSValue slotBase,const Identifier &)550 JSValue jsElementOndblclick(ExecState* exec, JSValue slotBase, const Identifier&)
551 {
552     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
553     UNUSED_PARAM(exec);
554     Element* imp = static_cast<Element*>(castedThis->impl());
555     if (EventListener* listener = imp->ondblclick()) {
556         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
557             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
558                 return jsFunction;
559         }
560     }
561     return jsNull();
562 }
563 
564 
jsElementOndrag(ExecState * exec,JSValue slotBase,const Identifier &)565 JSValue jsElementOndrag(ExecState* exec, JSValue slotBase, const Identifier&)
566 {
567     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
568     UNUSED_PARAM(exec);
569     Element* imp = static_cast<Element*>(castedThis->impl());
570     if (EventListener* listener = imp->ondrag()) {
571         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
572             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
573                 return jsFunction;
574         }
575     }
576     return jsNull();
577 }
578 
579 
jsElementOndragend(ExecState * exec,JSValue slotBase,const Identifier &)580 JSValue jsElementOndragend(ExecState* exec, JSValue slotBase, const Identifier&)
581 {
582     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
583     UNUSED_PARAM(exec);
584     Element* imp = static_cast<Element*>(castedThis->impl());
585     if (EventListener* listener = imp->ondragend()) {
586         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
587             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
588                 return jsFunction;
589         }
590     }
591     return jsNull();
592 }
593 
594 
jsElementOndragenter(ExecState * exec,JSValue slotBase,const Identifier &)595 JSValue jsElementOndragenter(ExecState* exec, JSValue slotBase, const Identifier&)
596 {
597     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
598     UNUSED_PARAM(exec);
599     Element* imp = static_cast<Element*>(castedThis->impl());
600     if (EventListener* listener = imp->ondragenter()) {
601         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
602             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
603                 return jsFunction;
604         }
605     }
606     return jsNull();
607 }
608 
609 
jsElementOndragleave(ExecState * exec,JSValue slotBase,const Identifier &)610 JSValue jsElementOndragleave(ExecState* exec, JSValue slotBase, const Identifier&)
611 {
612     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
613     UNUSED_PARAM(exec);
614     Element* imp = static_cast<Element*>(castedThis->impl());
615     if (EventListener* listener = imp->ondragleave()) {
616         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
617             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
618                 return jsFunction;
619         }
620     }
621     return jsNull();
622 }
623 
624 
jsElementOndragover(ExecState * exec,JSValue slotBase,const Identifier &)625 JSValue jsElementOndragover(ExecState* exec, JSValue slotBase, const Identifier&)
626 {
627     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
628     UNUSED_PARAM(exec);
629     Element* imp = static_cast<Element*>(castedThis->impl());
630     if (EventListener* listener = imp->ondragover()) {
631         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
632             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
633                 return jsFunction;
634         }
635     }
636     return jsNull();
637 }
638 
639 
jsElementOndragstart(ExecState * exec,JSValue slotBase,const Identifier &)640 JSValue jsElementOndragstart(ExecState* exec, JSValue slotBase, const Identifier&)
641 {
642     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
643     UNUSED_PARAM(exec);
644     Element* imp = static_cast<Element*>(castedThis->impl());
645     if (EventListener* listener = imp->ondragstart()) {
646         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
647             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
648                 return jsFunction;
649         }
650     }
651     return jsNull();
652 }
653 
654 
jsElementOndrop(ExecState * exec,JSValue slotBase,const Identifier &)655 JSValue jsElementOndrop(ExecState* exec, JSValue slotBase, const Identifier&)
656 {
657     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
658     UNUSED_PARAM(exec);
659     Element* imp = static_cast<Element*>(castedThis->impl());
660     if (EventListener* listener = imp->ondrop()) {
661         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
662             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
663                 return jsFunction;
664         }
665     }
666     return jsNull();
667 }
668 
669 
jsElementOnerror(ExecState * exec,JSValue slotBase,const Identifier &)670 JSValue jsElementOnerror(ExecState* exec, JSValue slotBase, const Identifier&)
671 {
672     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
673     UNUSED_PARAM(exec);
674     Element* imp = static_cast<Element*>(castedThis->impl());
675     if (EventListener* listener = imp->onerror()) {
676         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
677             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
678                 return jsFunction;
679         }
680     }
681     return jsNull();
682 }
683 
684 
jsElementOnfocus(ExecState * exec,JSValue slotBase,const Identifier &)685 JSValue jsElementOnfocus(ExecState* exec, JSValue slotBase, const Identifier&)
686 {
687     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
688     UNUSED_PARAM(exec);
689     Element* imp = static_cast<Element*>(castedThis->impl());
690     if (EventListener* listener = imp->onfocus()) {
691         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
692             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
693                 return jsFunction;
694         }
695     }
696     return jsNull();
697 }
698 
699 
jsElementOninput(ExecState * exec,JSValue slotBase,const Identifier &)700 JSValue jsElementOninput(ExecState* exec, JSValue slotBase, const Identifier&)
701 {
702     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
703     UNUSED_PARAM(exec);
704     Element* imp = static_cast<Element*>(castedThis->impl());
705     if (EventListener* listener = imp->oninput()) {
706         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
707             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
708                 return jsFunction;
709         }
710     }
711     return jsNull();
712 }
713 
714 
jsElementOninvalid(ExecState * exec,JSValue slotBase,const Identifier &)715 JSValue jsElementOninvalid(ExecState* exec, JSValue slotBase, const Identifier&)
716 {
717     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
718     UNUSED_PARAM(exec);
719     Element* imp = static_cast<Element*>(castedThis->impl());
720     if (EventListener* listener = imp->oninvalid()) {
721         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
722             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
723                 return jsFunction;
724         }
725     }
726     return jsNull();
727 }
728 
729 
jsElementOnkeydown(ExecState * exec,JSValue slotBase,const Identifier &)730 JSValue jsElementOnkeydown(ExecState* exec, JSValue slotBase, const Identifier&)
731 {
732     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
733     UNUSED_PARAM(exec);
734     Element* imp = static_cast<Element*>(castedThis->impl());
735     if (EventListener* listener = imp->onkeydown()) {
736         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
737             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
738                 return jsFunction;
739         }
740     }
741     return jsNull();
742 }
743 
744 
jsElementOnkeypress(ExecState * exec,JSValue slotBase,const Identifier &)745 JSValue jsElementOnkeypress(ExecState* exec, JSValue slotBase, const Identifier&)
746 {
747     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
748     UNUSED_PARAM(exec);
749     Element* imp = static_cast<Element*>(castedThis->impl());
750     if (EventListener* listener = imp->onkeypress()) {
751         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
752             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
753                 return jsFunction;
754         }
755     }
756     return jsNull();
757 }
758 
759 
jsElementOnkeyup(ExecState * exec,JSValue slotBase,const Identifier &)760 JSValue jsElementOnkeyup(ExecState* exec, JSValue slotBase, const Identifier&)
761 {
762     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
763     UNUSED_PARAM(exec);
764     Element* imp = static_cast<Element*>(castedThis->impl());
765     if (EventListener* listener = imp->onkeyup()) {
766         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
767             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
768                 return jsFunction;
769         }
770     }
771     return jsNull();
772 }
773 
774 
jsElementOnload(ExecState * exec,JSValue slotBase,const Identifier &)775 JSValue jsElementOnload(ExecState* exec, JSValue slotBase, const Identifier&)
776 {
777     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
778     UNUSED_PARAM(exec);
779     Element* imp = static_cast<Element*>(castedThis->impl());
780     if (EventListener* listener = imp->onload()) {
781         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
782             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
783                 return jsFunction;
784         }
785     }
786     return jsNull();
787 }
788 
789 
jsElementOnmousedown(ExecState * exec,JSValue slotBase,const Identifier &)790 JSValue jsElementOnmousedown(ExecState* exec, JSValue slotBase, const Identifier&)
791 {
792     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
793     UNUSED_PARAM(exec);
794     Element* imp = static_cast<Element*>(castedThis->impl());
795     if (EventListener* listener = imp->onmousedown()) {
796         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
797             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
798                 return jsFunction;
799         }
800     }
801     return jsNull();
802 }
803 
804 
jsElementOnmousemove(ExecState * exec,JSValue slotBase,const Identifier &)805 JSValue jsElementOnmousemove(ExecState* exec, JSValue slotBase, const Identifier&)
806 {
807     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
808     UNUSED_PARAM(exec);
809     Element* imp = static_cast<Element*>(castedThis->impl());
810     if (EventListener* listener = imp->onmousemove()) {
811         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
812             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
813                 return jsFunction;
814         }
815     }
816     return jsNull();
817 }
818 
819 
jsElementOnmouseout(ExecState * exec,JSValue slotBase,const Identifier &)820 JSValue jsElementOnmouseout(ExecState* exec, JSValue slotBase, const Identifier&)
821 {
822     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
823     UNUSED_PARAM(exec);
824     Element* imp = static_cast<Element*>(castedThis->impl());
825     if (EventListener* listener = imp->onmouseout()) {
826         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
827             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
828                 return jsFunction;
829         }
830     }
831     return jsNull();
832 }
833 
834 
jsElementOnmouseover(ExecState * exec,JSValue slotBase,const Identifier &)835 JSValue jsElementOnmouseover(ExecState* exec, JSValue slotBase, const Identifier&)
836 {
837     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
838     UNUSED_PARAM(exec);
839     Element* imp = static_cast<Element*>(castedThis->impl());
840     if (EventListener* listener = imp->onmouseover()) {
841         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
842             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
843                 return jsFunction;
844         }
845     }
846     return jsNull();
847 }
848 
849 
jsElementOnmouseup(ExecState * exec,JSValue slotBase,const Identifier &)850 JSValue jsElementOnmouseup(ExecState* exec, JSValue slotBase, const Identifier&)
851 {
852     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
853     UNUSED_PARAM(exec);
854     Element* imp = static_cast<Element*>(castedThis->impl());
855     if (EventListener* listener = imp->onmouseup()) {
856         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
857             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
858                 return jsFunction;
859         }
860     }
861     return jsNull();
862 }
863 
864 
jsElementOnmousewheel(ExecState * exec,JSValue slotBase,const Identifier &)865 JSValue jsElementOnmousewheel(ExecState* exec, JSValue slotBase, const Identifier&)
866 {
867     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
868     UNUSED_PARAM(exec);
869     Element* imp = static_cast<Element*>(castedThis->impl());
870     if (EventListener* listener = imp->onmousewheel()) {
871         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
872             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
873                 return jsFunction;
874         }
875     }
876     return jsNull();
877 }
878 
879 
jsElementOnscroll(ExecState * exec,JSValue slotBase,const Identifier &)880 JSValue jsElementOnscroll(ExecState* exec, JSValue slotBase, const Identifier&)
881 {
882     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
883     UNUSED_PARAM(exec);
884     Element* imp = static_cast<Element*>(castedThis->impl());
885     if (EventListener* listener = imp->onscroll()) {
886         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
887             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
888                 return jsFunction;
889         }
890     }
891     return jsNull();
892 }
893 
894 
jsElementOnselect(ExecState * exec,JSValue slotBase,const Identifier &)895 JSValue jsElementOnselect(ExecState* exec, JSValue slotBase, const Identifier&)
896 {
897     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
898     UNUSED_PARAM(exec);
899     Element* imp = static_cast<Element*>(castedThis->impl());
900     if (EventListener* listener = imp->onselect()) {
901         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
902             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
903                 return jsFunction;
904         }
905     }
906     return jsNull();
907 }
908 
909 
jsElementOnsubmit(ExecState * exec,JSValue slotBase,const Identifier &)910 JSValue jsElementOnsubmit(ExecState* exec, JSValue slotBase, const Identifier&)
911 {
912     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
913     UNUSED_PARAM(exec);
914     Element* imp = static_cast<Element*>(castedThis->impl());
915     if (EventListener* listener = imp->onsubmit()) {
916         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
917             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
918                 return jsFunction;
919         }
920     }
921     return jsNull();
922 }
923 
924 
jsElementOnbeforecut(ExecState * exec,JSValue slotBase,const Identifier &)925 JSValue jsElementOnbeforecut(ExecState* exec, JSValue slotBase, const Identifier&)
926 {
927     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
928     UNUSED_PARAM(exec);
929     Element* imp = static_cast<Element*>(castedThis->impl());
930     if (EventListener* listener = imp->onbeforecut()) {
931         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
932             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
933                 return jsFunction;
934         }
935     }
936     return jsNull();
937 }
938 
939 
jsElementOncut(ExecState * exec,JSValue slotBase,const Identifier &)940 JSValue jsElementOncut(ExecState* exec, JSValue slotBase, const Identifier&)
941 {
942     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
943     UNUSED_PARAM(exec);
944     Element* imp = static_cast<Element*>(castedThis->impl());
945     if (EventListener* listener = imp->oncut()) {
946         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
947             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
948                 return jsFunction;
949         }
950     }
951     return jsNull();
952 }
953 
954 
jsElementOnbeforecopy(ExecState * exec,JSValue slotBase,const Identifier &)955 JSValue jsElementOnbeforecopy(ExecState* exec, JSValue slotBase, const Identifier&)
956 {
957     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
958     UNUSED_PARAM(exec);
959     Element* imp = static_cast<Element*>(castedThis->impl());
960     if (EventListener* listener = imp->onbeforecopy()) {
961         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
962             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
963                 return jsFunction;
964         }
965     }
966     return jsNull();
967 }
968 
969 
jsElementOncopy(ExecState * exec,JSValue slotBase,const Identifier &)970 JSValue jsElementOncopy(ExecState* exec, JSValue slotBase, const Identifier&)
971 {
972     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
973     UNUSED_PARAM(exec);
974     Element* imp = static_cast<Element*>(castedThis->impl());
975     if (EventListener* listener = imp->oncopy()) {
976         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
977             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
978                 return jsFunction;
979         }
980     }
981     return jsNull();
982 }
983 
984 
jsElementOnbeforepaste(ExecState * exec,JSValue slotBase,const Identifier &)985 JSValue jsElementOnbeforepaste(ExecState* exec, JSValue slotBase, const Identifier&)
986 {
987     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
988     UNUSED_PARAM(exec);
989     Element* imp = static_cast<Element*>(castedThis->impl());
990     if (EventListener* listener = imp->onbeforepaste()) {
991         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
992             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
993                 return jsFunction;
994         }
995     }
996     return jsNull();
997 }
998 
999 
jsElementOnpaste(ExecState * exec,JSValue slotBase,const Identifier &)1000 JSValue jsElementOnpaste(ExecState* exec, JSValue slotBase, const Identifier&)
1001 {
1002     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
1003     UNUSED_PARAM(exec);
1004     Element* imp = static_cast<Element*>(castedThis->impl());
1005     if (EventListener* listener = imp->onpaste()) {
1006         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
1007             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
1008                 return jsFunction;
1009         }
1010     }
1011     return jsNull();
1012 }
1013 
1014 
jsElementOnreset(ExecState * exec,JSValue slotBase,const Identifier &)1015 JSValue jsElementOnreset(ExecState* exec, JSValue slotBase, const Identifier&)
1016 {
1017     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
1018     UNUSED_PARAM(exec);
1019     Element* imp = static_cast<Element*>(castedThis->impl());
1020     if (EventListener* listener = imp->onreset()) {
1021         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
1022             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
1023                 return jsFunction;
1024         }
1025     }
1026     return jsNull();
1027 }
1028 
1029 
jsElementOnsearch(ExecState * exec,JSValue slotBase,const Identifier &)1030 JSValue jsElementOnsearch(ExecState* exec, JSValue slotBase, const Identifier&)
1031 {
1032     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
1033     UNUSED_PARAM(exec);
1034     Element* imp = static_cast<Element*>(castedThis->impl());
1035     if (EventListener* listener = imp->onsearch()) {
1036         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
1037             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
1038                 return jsFunction;
1039         }
1040     }
1041     return jsNull();
1042 }
1043 
1044 
jsElementOnselectstart(ExecState * exec,JSValue slotBase,const Identifier &)1045 JSValue jsElementOnselectstart(ExecState* exec, JSValue slotBase, const Identifier&)
1046 {
1047     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
1048     UNUSED_PARAM(exec);
1049     Element* imp = static_cast<Element*>(castedThis->impl());
1050     if (EventListener* listener = imp->onselectstart()) {
1051         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
1052             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
1053                 return jsFunction;
1054         }
1055     }
1056     return jsNull();
1057 }
1058 
1059 
1060 #if ENABLE(TOUCH_EVENTS)
jsElementOntouchstart(ExecState * exec,JSValue slotBase,const Identifier &)1061 JSValue jsElementOntouchstart(ExecState* exec, JSValue slotBase, const Identifier&)
1062 {
1063     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
1064     UNUSED_PARAM(exec);
1065     Element* imp = static_cast<Element*>(castedThis->impl());
1066     if (EventListener* listener = imp->ontouchstart()) {
1067         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
1068             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
1069                 return jsFunction;
1070         }
1071     }
1072     return jsNull();
1073 }
1074 
1075 #endif
1076 
1077 #if ENABLE(TOUCH_EVENTS)
jsElementOntouchmove(ExecState * exec,JSValue slotBase,const Identifier &)1078 JSValue jsElementOntouchmove(ExecState* exec, JSValue slotBase, const Identifier&)
1079 {
1080     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
1081     UNUSED_PARAM(exec);
1082     Element* imp = static_cast<Element*>(castedThis->impl());
1083     if (EventListener* listener = imp->ontouchmove()) {
1084         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
1085             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
1086                 return jsFunction;
1087         }
1088     }
1089     return jsNull();
1090 }
1091 
1092 #endif
1093 
1094 #if ENABLE(TOUCH_EVENTS)
jsElementOntouchend(ExecState * exec,JSValue slotBase,const Identifier &)1095 JSValue jsElementOntouchend(ExecState* exec, JSValue slotBase, const Identifier&)
1096 {
1097     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
1098     UNUSED_PARAM(exec);
1099     Element* imp = static_cast<Element*>(castedThis->impl());
1100     if (EventListener* listener = imp->ontouchend()) {
1101         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
1102             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
1103                 return jsFunction;
1104         }
1105     }
1106     return jsNull();
1107 }
1108 
1109 #endif
1110 
1111 #if ENABLE(TOUCH_EVENTS)
jsElementOntouchcancel(ExecState * exec,JSValue slotBase,const Identifier &)1112 JSValue jsElementOntouchcancel(ExecState* exec, JSValue slotBase, const Identifier&)
1113 {
1114     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
1115     UNUSED_PARAM(exec);
1116     Element* imp = static_cast<Element*>(castedThis->impl());
1117     if (EventListener* listener = imp->ontouchcancel()) {
1118         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
1119             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
1120                 return jsFunction;
1121         }
1122     }
1123     return jsNull();
1124 }
1125 
1126 #endif
1127 
1128 #if ENABLE(FULLSCREEN_API)
jsElementOnwebkitfullscreenchange(ExecState * exec,JSValue slotBase,const Identifier &)1129 JSValue jsElementOnwebkitfullscreenchange(ExecState* exec, JSValue slotBase, const Identifier&)
1130 {
1131     JSElement* castedThis = static_cast<JSElement*>(asObject(slotBase));
1132     UNUSED_PARAM(exec);
1133     Element* imp = static_cast<Element*>(castedThis->impl());
1134     if (EventListener* listener = imp->onwebkitfullscreenchange()) {
1135         if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {
1136             if (JSObject* jsFunction = jsListener->jsFunction(imp->scriptExecutionContext()))
1137                 return jsFunction;
1138         }
1139     }
1140     return jsNull();
1141 }
1142 
1143 #endif
1144 
jsElementConstructor(ExecState * exec,JSValue slotBase,const Identifier &)1145 JSValue jsElementConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
1146 {
1147     JSElement* domObject = static_cast<JSElement*>(asObject(slotBase));
1148     return JSElement::getConstructor(exec, domObject->globalObject());
1149 }
1150 
put(ExecState * exec,const Identifier & propertyName,JSValue value,PutPropertySlot & slot)1151 void JSElement::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
1152 {
1153     lookupPut<JSElement, Base>(exec, propertyName, value, &JSElementTable, this, slot);
1154 }
1155 
setJSElementScrollLeft(ExecState * exec,JSObject * thisObject,JSValue value)1156 void setJSElementScrollLeft(ExecState* exec, JSObject* thisObject, JSValue value)
1157 {
1158     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1159     Element* imp = static_cast<Element*>(castedThis->impl());
1160     imp->setScrollLeft(value.toInt32(exec));
1161 }
1162 
1163 
setJSElementScrollTop(ExecState * exec,JSObject * thisObject,JSValue value)1164 void setJSElementScrollTop(ExecState* exec, JSObject* thisObject, JSValue value)
1165 {
1166     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1167     Element* imp = static_cast<Element*>(castedThis->impl());
1168     imp->setScrollTop(value.toInt32(exec));
1169 }
1170 
1171 
setJSElementOnabort(ExecState * exec,JSObject * thisObject,JSValue value)1172 void setJSElementOnabort(ExecState* exec, JSObject* thisObject, JSValue value)
1173 {
1174     UNUSED_PARAM(exec);
1175     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1176     Element* imp = static_cast<Element*>(castedThis->impl());
1177     imp->setOnabort(createJSAttributeEventListener(exec, value, thisObject));
1178 }
1179 
1180 
setJSElementOnblur(ExecState * exec,JSObject * thisObject,JSValue value)1181 void setJSElementOnblur(ExecState* exec, JSObject* thisObject, JSValue value)
1182 {
1183     UNUSED_PARAM(exec);
1184     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1185     Element* imp = static_cast<Element*>(castedThis->impl());
1186     imp->setOnblur(createJSAttributeEventListener(exec, value, thisObject));
1187 }
1188 
1189 
setJSElementOnchange(ExecState * exec,JSObject * thisObject,JSValue value)1190 void setJSElementOnchange(ExecState* exec, JSObject* thisObject, JSValue value)
1191 {
1192     UNUSED_PARAM(exec);
1193     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1194     Element* imp = static_cast<Element*>(castedThis->impl());
1195     imp->setOnchange(createJSAttributeEventListener(exec, value, thisObject));
1196 }
1197 
1198 
setJSElementOnclick(ExecState * exec,JSObject * thisObject,JSValue value)1199 void setJSElementOnclick(ExecState* exec, JSObject* thisObject, JSValue value)
1200 {
1201     UNUSED_PARAM(exec);
1202     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1203     Element* imp = static_cast<Element*>(castedThis->impl());
1204     imp->setOnclick(createJSAttributeEventListener(exec, value, thisObject));
1205 }
1206 
1207 
setJSElementOncontextmenu(ExecState * exec,JSObject * thisObject,JSValue value)1208 void setJSElementOncontextmenu(ExecState* exec, JSObject* thisObject, JSValue value)
1209 {
1210     UNUSED_PARAM(exec);
1211     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1212     Element* imp = static_cast<Element*>(castedThis->impl());
1213     imp->setOncontextmenu(createJSAttributeEventListener(exec, value, thisObject));
1214 }
1215 
1216 
setJSElementOndblclick(ExecState * exec,JSObject * thisObject,JSValue value)1217 void setJSElementOndblclick(ExecState* exec, JSObject* thisObject, JSValue value)
1218 {
1219     UNUSED_PARAM(exec);
1220     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1221     Element* imp = static_cast<Element*>(castedThis->impl());
1222     imp->setOndblclick(createJSAttributeEventListener(exec, value, thisObject));
1223 }
1224 
1225 
setJSElementOndrag(ExecState * exec,JSObject * thisObject,JSValue value)1226 void setJSElementOndrag(ExecState* exec, JSObject* thisObject, JSValue value)
1227 {
1228     UNUSED_PARAM(exec);
1229     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1230     Element* imp = static_cast<Element*>(castedThis->impl());
1231     imp->setOndrag(createJSAttributeEventListener(exec, value, thisObject));
1232 }
1233 
1234 
setJSElementOndragend(ExecState * exec,JSObject * thisObject,JSValue value)1235 void setJSElementOndragend(ExecState* exec, JSObject* thisObject, JSValue value)
1236 {
1237     UNUSED_PARAM(exec);
1238     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1239     Element* imp = static_cast<Element*>(castedThis->impl());
1240     imp->setOndragend(createJSAttributeEventListener(exec, value, thisObject));
1241 }
1242 
1243 
setJSElementOndragenter(ExecState * exec,JSObject * thisObject,JSValue value)1244 void setJSElementOndragenter(ExecState* exec, JSObject* thisObject, JSValue value)
1245 {
1246     UNUSED_PARAM(exec);
1247     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1248     Element* imp = static_cast<Element*>(castedThis->impl());
1249     imp->setOndragenter(createJSAttributeEventListener(exec, value, thisObject));
1250 }
1251 
1252 
setJSElementOndragleave(ExecState * exec,JSObject * thisObject,JSValue value)1253 void setJSElementOndragleave(ExecState* exec, JSObject* thisObject, JSValue value)
1254 {
1255     UNUSED_PARAM(exec);
1256     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1257     Element* imp = static_cast<Element*>(castedThis->impl());
1258     imp->setOndragleave(createJSAttributeEventListener(exec, value, thisObject));
1259 }
1260 
1261 
setJSElementOndragover(ExecState * exec,JSObject * thisObject,JSValue value)1262 void setJSElementOndragover(ExecState* exec, JSObject* thisObject, JSValue value)
1263 {
1264     UNUSED_PARAM(exec);
1265     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1266     Element* imp = static_cast<Element*>(castedThis->impl());
1267     imp->setOndragover(createJSAttributeEventListener(exec, value, thisObject));
1268 }
1269 
1270 
setJSElementOndragstart(ExecState * exec,JSObject * thisObject,JSValue value)1271 void setJSElementOndragstart(ExecState* exec, JSObject* thisObject, JSValue value)
1272 {
1273     UNUSED_PARAM(exec);
1274     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1275     Element* imp = static_cast<Element*>(castedThis->impl());
1276     imp->setOndragstart(createJSAttributeEventListener(exec, value, thisObject));
1277 }
1278 
1279 
setJSElementOndrop(ExecState * exec,JSObject * thisObject,JSValue value)1280 void setJSElementOndrop(ExecState* exec, JSObject* thisObject, JSValue value)
1281 {
1282     UNUSED_PARAM(exec);
1283     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1284     Element* imp = static_cast<Element*>(castedThis->impl());
1285     imp->setOndrop(createJSAttributeEventListener(exec, value, thisObject));
1286 }
1287 
1288 
setJSElementOnerror(ExecState * exec,JSObject * thisObject,JSValue value)1289 void setJSElementOnerror(ExecState* exec, JSObject* thisObject, JSValue value)
1290 {
1291     UNUSED_PARAM(exec);
1292     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1293     Element* imp = static_cast<Element*>(castedThis->impl());
1294     imp->setOnerror(createJSAttributeEventListener(exec, value, thisObject));
1295 }
1296 
1297 
setJSElementOnfocus(ExecState * exec,JSObject * thisObject,JSValue value)1298 void setJSElementOnfocus(ExecState* exec, JSObject* thisObject, JSValue value)
1299 {
1300     UNUSED_PARAM(exec);
1301     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1302     Element* imp = static_cast<Element*>(castedThis->impl());
1303     imp->setOnfocus(createJSAttributeEventListener(exec, value, thisObject));
1304 }
1305 
1306 
setJSElementOninput(ExecState * exec,JSObject * thisObject,JSValue value)1307 void setJSElementOninput(ExecState* exec, JSObject* thisObject, JSValue value)
1308 {
1309     UNUSED_PARAM(exec);
1310     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1311     Element* imp = static_cast<Element*>(castedThis->impl());
1312     imp->setOninput(createJSAttributeEventListener(exec, value, thisObject));
1313 }
1314 
1315 
setJSElementOninvalid(ExecState * exec,JSObject * thisObject,JSValue value)1316 void setJSElementOninvalid(ExecState* exec, JSObject* thisObject, JSValue value)
1317 {
1318     UNUSED_PARAM(exec);
1319     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1320     Element* imp = static_cast<Element*>(castedThis->impl());
1321     imp->setOninvalid(createJSAttributeEventListener(exec, value, thisObject));
1322 }
1323 
1324 
setJSElementOnkeydown(ExecState * exec,JSObject * thisObject,JSValue value)1325 void setJSElementOnkeydown(ExecState* exec, JSObject* thisObject, JSValue value)
1326 {
1327     UNUSED_PARAM(exec);
1328     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1329     Element* imp = static_cast<Element*>(castedThis->impl());
1330     imp->setOnkeydown(createJSAttributeEventListener(exec, value, thisObject));
1331 }
1332 
1333 
setJSElementOnkeypress(ExecState * exec,JSObject * thisObject,JSValue value)1334 void setJSElementOnkeypress(ExecState* exec, JSObject* thisObject, JSValue value)
1335 {
1336     UNUSED_PARAM(exec);
1337     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1338     Element* imp = static_cast<Element*>(castedThis->impl());
1339     imp->setOnkeypress(createJSAttributeEventListener(exec, value, thisObject));
1340 }
1341 
1342 
setJSElementOnkeyup(ExecState * exec,JSObject * thisObject,JSValue value)1343 void setJSElementOnkeyup(ExecState* exec, JSObject* thisObject, JSValue value)
1344 {
1345     UNUSED_PARAM(exec);
1346     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1347     Element* imp = static_cast<Element*>(castedThis->impl());
1348     imp->setOnkeyup(createJSAttributeEventListener(exec, value, thisObject));
1349 }
1350 
1351 
setJSElementOnload(ExecState * exec,JSObject * thisObject,JSValue value)1352 void setJSElementOnload(ExecState* exec, JSObject* thisObject, JSValue value)
1353 {
1354     UNUSED_PARAM(exec);
1355     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1356     Element* imp = static_cast<Element*>(castedThis->impl());
1357     imp->setOnload(createJSAttributeEventListener(exec, value, thisObject));
1358 }
1359 
1360 
setJSElementOnmousedown(ExecState * exec,JSObject * thisObject,JSValue value)1361 void setJSElementOnmousedown(ExecState* exec, JSObject* thisObject, JSValue value)
1362 {
1363     UNUSED_PARAM(exec);
1364     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1365     Element* imp = static_cast<Element*>(castedThis->impl());
1366     imp->setOnmousedown(createJSAttributeEventListener(exec, value, thisObject));
1367 }
1368 
1369 
setJSElementOnmousemove(ExecState * exec,JSObject * thisObject,JSValue value)1370 void setJSElementOnmousemove(ExecState* exec, JSObject* thisObject, JSValue value)
1371 {
1372     UNUSED_PARAM(exec);
1373     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1374     Element* imp = static_cast<Element*>(castedThis->impl());
1375     imp->setOnmousemove(createJSAttributeEventListener(exec, value, thisObject));
1376 }
1377 
1378 
setJSElementOnmouseout(ExecState * exec,JSObject * thisObject,JSValue value)1379 void setJSElementOnmouseout(ExecState* exec, JSObject* thisObject, JSValue value)
1380 {
1381     UNUSED_PARAM(exec);
1382     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1383     Element* imp = static_cast<Element*>(castedThis->impl());
1384     imp->setOnmouseout(createJSAttributeEventListener(exec, value, thisObject));
1385 }
1386 
1387 
setJSElementOnmouseover(ExecState * exec,JSObject * thisObject,JSValue value)1388 void setJSElementOnmouseover(ExecState* exec, JSObject* thisObject, JSValue value)
1389 {
1390     UNUSED_PARAM(exec);
1391     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1392     Element* imp = static_cast<Element*>(castedThis->impl());
1393     imp->setOnmouseover(createJSAttributeEventListener(exec, value, thisObject));
1394 }
1395 
1396 
setJSElementOnmouseup(ExecState * exec,JSObject * thisObject,JSValue value)1397 void setJSElementOnmouseup(ExecState* exec, JSObject* thisObject, JSValue value)
1398 {
1399     UNUSED_PARAM(exec);
1400     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1401     Element* imp = static_cast<Element*>(castedThis->impl());
1402     imp->setOnmouseup(createJSAttributeEventListener(exec, value, thisObject));
1403 }
1404 
1405 
setJSElementOnmousewheel(ExecState * exec,JSObject * thisObject,JSValue value)1406 void setJSElementOnmousewheel(ExecState* exec, JSObject* thisObject, JSValue value)
1407 {
1408     UNUSED_PARAM(exec);
1409     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1410     Element* imp = static_cast<Element*>(castedThis->impl());
1411     imp->setOnmousewheel(createJSAttributeEventListener(exec, value, thisObject));
1412 }
1413 
1414 
setJSElementOnscroll(ExecState * exec,JSObject * thisObject,JSValue value)1415 void setJSElementOnscroll(ExecState* exec, JSObject* thisObject, JSValue value)
1416 {
1417     UNUSED_PARAM(exec);
1418     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1419     Element* imp = static_cast<Element*>(castedThis->impl());
1420     imp->setOnscroll(createJSAttributeEventListener(exec, value, thisObject));
1421 }
1422 
1423 
setJSElementOnselect(ExecState * exec,JSObject * thisObject,JSValue value)1424 void setJSElementOnselect(ExecState* exec, JSObject* thisObject, JSValue value)
1425 {
1426     UNUSED_PARAM(exec);
1427     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1428     Element* imp = static_cast<Element*>(castedThis->impl());
1429     imp->setOnselect(createJSAttributeEventListener(exec, value, thisObject));
1430 }
1431 
1432 
setJSElementOnsubmit(ExecState * exec,JSObject * thisObject,JSValue value)1433 void setJSElementOnsubmit(ExecState* exec, JSObject* thisObject, JSValue value)
1434 {
1435     UNUSED_PARAM(exec);
1436     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1437     Element* imp = static_cast<Element*>(castedThis->impl());
1438     imp->setOnsubmit(createJSAttributeEventListener(exec, value, thisObject));
1439 }
1440 
1441 
setJSElementOnbeforecut(ExecState * exec,JSObject * thisObject,JSValue value)1442 void setJSElementOnbeforecut(ExecState* exec, JSObject* thisObject, JSValue value)
1443 {
1444     UNUSED_PARAM(exec);
1445     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1446     Element* imp = static_cast<Element*>(castedThis->impl());
1447     imp->setOnbeforecut(createJSAttributeEventListener(exec, value, thisObject));
1448 }
1449 
1450 
setJSElementOncut(ExecState * exec,JSObject * thisObject,JSValue value)1451 void setJSElementOncut(ExecState* exec, JSObject* thisObject, JSValue value)
1452 {
1453     UNUSED_PARAM(exec);
1454     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1455     Element* imp = static_cast<Element*>(castedThis->impl());
1456     imp->setOncut(createJSAttributeEventListener(exec, value, thisObject));
1457 }
1458 
1459 
setJSElementOnbeforecopy(ExecState * exec,JSObject * thisObject,JSValue value)1460 void setJSElementOnbeforecopy(ExecState* exec, JSObject* thisObject, JSValue value)
1461 {
1462     UNUSED_PARAM(exec);
1463     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1464     Element* imp = static_cast<Element*>(castedThis->impl());
1465     imp->setOnbeforecopy(createJSAttributeEventListener(exec, value, thisObject));
1466 }
1467 
1468 
setJSElementOncopy(ExecState * exec,JSObject * thisObject,JSValue value)1469 void setJSElementOncopy(ExecState* exec, JSObject* thisObject, JSValue value)
1470 {
1471     UNUSED_PARAM(exec);
1472     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1473     Element* imp = static_cast<Element*>(castedThis->impl());
1474     imp->setOncopy(createJSAttributeEventListener(exec, value, thisObject));
1475 }
1476 
1477 
setJSElementOnbeforepaste(ExecState * exec,JSObject * thisObject,JSValue value)1478 void setJSElementOnbeforepaste(ExecState* exec, JSObject* thisObject, JSValue value)
1479 {
1480     UNUSED_PARAM(exec);
1481     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1482     Element* imp = static_cast<Element*>(castedThis->impl());
1483     imp->setOnbeforepaste(createJSAttributeEventListener(exec, value, thisObject));
1484 }
1485 
1486 
setJSElementOnpaste(ExecState * exec,JSObject * thisObject,JSValue value)1487 void setJSElementOnpaste(ExecState* exec, JSObject* thisObject, JSValue value)
1488 {
1489     UNUSED_PARAM(exec);
1490     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1491     Element* imp = static_cast<Element*>(castedThis->impl());
1492     imp->setOnpaste(createJSAttributeEventListener(exec, value, thisObject));
1493 }
1494 
1495 
setJSElementOnreset(ExecState * exec,JSObject * thisObject,JSValue value)1496 void setJSElementOnreset(ExecState* exec, JSObject* thisObject, JSValue value)
1497 {
1498     UNUSED_PARAM(exec);
1499     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1500     Element* imp = static_cast<Element*>(castedThis->impl());
1501     imp->setOnreset(createJSAttributeEventListener(exec, value, thisObject));
1502 }
1503 
1504 
setJSElementOnsearch(ExecState * exec,JSObject * thisObject,JSValue value)1505 void setJSElementOnsearch(ExecState* exec, JSObject* thisObject, JSValue value)
1506 {
1507     UNUSED_PARAM(exec);
1508     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1509     Element* imp = static_cast<Element*>(castedThis->impl());
1510     imp->setOnsearch(createJSAttributeEventListener(exec, value, thisObject));
1511 }
1512 
1513 
setJSElementOnselectstart(ExecState * exec,JSObject * thisObject,JSValue value)1514 void setJSElementOnselectstart(ExecState* exec, JSObject* thisObject, JSValue value)
1515 {
1516     UNUSED_PARAM(exec);
1517     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1518     Element* imp = static_cast<Element*>(castedThis->impl());
1519     imp->setOnselectstart(createJSAttributeEventListener(exec, value, thisObject));
1520 }
1521 
1522 
1523 #if ENABLE(TOUCH_EVENTS)
setJSElementOntouchstart(ExecState * exec,JSObject * thisObject,JSValue value)1524 void setJSElementOntouchstart(ExecState* exec, JSObject* thisObject, JSValue value)
1525 {
1526     UNUSED_PARAM(exec);
1527     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1528     Element* imp = static_cast<Element*>(castedThis->impl());
1529     imp->setOntouchstart(createJSAttributeEventListener(exec, value, thisObject));
1530 }
1531 
1532 #endif
1533 
1534 #if ENABLE(TOUCH_EVENTS)
setJSElementOntouchmove(ExecState * exec,JSObject * thisObject,JSValue value)1535 void setJSElementOntouchmove(ExecState* exec, JSObject* thisObject, JSValue value)
1536 {
1537     UNUSED_PARAM(exec);
1538     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1539     Element* imp = static_cast<Element*>(castedThis->impl());
1540     imp->setOntouchmove(createJSAttributeEventListener(exec, value, thisObject));
1541 }
1542 
1543 #endif
1544 
1545 #if ENABLE(TOUCH_EVENTS)
setJSElementOntouchend(ExecState * exec,JSObject * thisObject,JSValue value)1546 void setJSElementOntouchend(ExecState* exec, JSObject* thisObject, JSValue value)
1547 {
1548     UNUSED_PARAM(exec);
1549     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1550     Element* imp = static_cast<Element*>(castedThis->impl());
1551     imp->setOntouchend(createJSAttributeEventListener(exec, value, thisObject));
1552 }
1553 
1554 #endif
1555 
1556 #if ENABLE(TOUCH_EVENTS)
setJSElementOntouchcancel(ExecState * exec,JSObject * thisObject,JSValue value)1557 void setJSElementOntouchcancel(ExecState* exec, JSObject* thisObject, JSValue value)
1558 {
1559     UNUSED_PARAM(exec);
1560     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1561     Element* imp = static_cast<Element*>(castedThis->impl());
1562     imp->setOntouchcancel(createJSAttributeEventListener(exec, value, thisObject));
1563 }
1564 
1565 #endif
1566 
1567 #if ENABLE(FULLSCREEN_API)
setJSElementOnwebkitfullscreenchange(ExecState * exec,JSObject * thisObject,JSValue value)1568 void setJSElementOnwebkitfullscreenchange(ExecState* exec, JSObject* thisObject, JSValue value)
1569 {
1570     UNUSED_PARAM(exec);
1571     JSElement* castedThis = static_cast<JSElement*>(thisObject);
1572     Element* imp = static_cast<Element*>(castedThis->impl());
1573     imp->setOnwebkitfullscreenchange(createJSAttributeEventListener(exec, value, thisObject));
1574 }
1575 
1576 #endif
1577 
getConstructor(ExecState * exec,JSGlobalObject * globalObject)1578 JSValue JSElement::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
1579 {
1580     return getDOMConstructor<JSElementConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
1581 }
1582 
jsElementPrototypeFunctionGetAttribute(ExecState * exec)1583 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionGetAttribute(ExecState* exec)
1584 {
1585     JSValue thisValue = exec->hostThisValue();
1586     if (!thisValue.inherits(&JSElement::s_info))
1587         return throwVMTypeError(exec);
1588     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1589     Element* imp = static_cast<Element*>(castedThis->impl());
1590     const String& name(ustringToString(exec->argument(0).toString(exec)));
1591     if (exec->hadException())
1592         return JSValue::encode(jsUndefined());
1593 
1594 
1595     JSC::JSValue result = jsStringOrNull(exec, imp->getAttribute(name));
1596     return JSValue::encode(result);
1597 }
1598 
jsElementPrototypeFunctionSetAttribute(ExecState * exec)1599 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionSetAttribute(ExecState* exec)
1600 {
1601     JSValue thisValue = exec->hostThisValue();
1602     if (!thisValue.inherits(&JSElement::s_info))
1603         return throwVMTypeError(exec);
1604     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1605     Element* imp = static_cast<Element*>(castedThis->impl());
1606     ExceptionCode ec = 0;
1607     const String& name(ustringToString(exec->argument(0).toString(exec)));
1608     if (exec->hadException())
1609         return JSValue::encode(jsUndefined());
1610     const String& value(ustringToString(exec->argument(1).toString(exec)));
1611     if (exec->hadException())
1612         return JSValue::encode(jsUndefined());
1613 
1614     imp->setAttribute(name, value, ec);
1615     setDOMException(exec, ec);
1616     return JSValue::encode(jsUndefined());
1617 }
1618 
jsElementPrototypeFunctionRemoveAttribute(ExecState * exec)1619 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionRemoveAttribute(ExecState* exec)
1620 {
1621     JSValue thisValue = exec->hostThisValue();
1622     if (!thisValue.inherits(&JSElement::s_info))
1623         return throwVMTypeError(exec);
1624     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1625     Element* imp = static_cast<Element*>(castedThis->impl());
1626     ExceptionCode ec = 0;
1627     const String& name(ustringToString(exec->argument(0).toString(exec)));
1628     if (exec->hadException())
1629         return JSValue::encode(jsUndefined());
1630 
1631     imp->removeAttribute(name, ec);
1632     setDOMException(exec, ec);
1633     return JSValue::encode(jsUndefined());
1634 }
1635 
jsElementPrototypeFunctionGetAttributeNode(ExecState * exec)1636 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionGetAttributeNode(ExecState* exec)
1637 {
1638     JSValue thisValue = exec->hostThisValue();
1639     if (!thisValue.inherits(&JSElement::s_info))
1640         return throwVMTypeError(exec);
1641     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1642     Element* imp = static_cast<Element*>(castedThis->impl());
1643     const String& name(ustringToString(exec->argument(0).toString(exec)));
1644     if (exec->hadException())
1645         return JSValue::encode(jsUndefined());
1646 
1647 
1648     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->getAttributeNode(name)));
1649     return JSValue::encode(result);
1650 }
1651 
jsElementPrototypeFunctionSetAttributeNode(ExecState * exec)1652 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionSetAttributeNode(ExecState* exec)
1653 {
1654     JSValue thisValue = exec->hostThisValue();
1655     if (!thisValue.inherits(&JSElement::s_info))
1656         return throwVMTypeError(exec);
1657     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1658     Element* imp = static_cast<Element*>(castedThis->impl());
1659     ExceptionCode ec = 0;
1660     Attr* newAttr(toAttr(exec->argument(0)));
1661     if (exec->hadException())
1662         return JSValue::encode(jsUndefined());
1663 
1664 
1665     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->setAttributeNode(newAttr, ec)));
1666     setDOMException(exec, ec);
1667     return JSValue::encode(result);
1668 }
1669 
jsElementPrototypeFunctionRemoveAttributeNode(ExecState * exec)1670 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionRemoveAttributeNode(ExecState* exec)
1671 {
1672     JSValue thisValue = exec->hostThisValue();
1673     if (!thisValue.inherits(&JSElement::s_info))
1674         return throwVMTypeError(exec);
1675     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1676     Element* imp = static_cast<Element*>(castedThis->impl());
1677     ExceptionCode ec = 0;
1678     Attr* oldAttr(toAttr(exec->argument(0)));
1679     if (exec->hadException())
1680         return JSValue::encode(jsUndefined());
1681 
1682 
1683     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->removeAttributeNode(oldAttr, ec)));
1684     setDOMException(exec, ec);
1685     return JSValue::encode(result);
1686 }
1687 
jsElementPrototypeFunctionGetElementsByTagName(ExecState * exec)1688 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionGetElementsByTagName(ExecState* exec)
1689 {
1690     JSValue thisValue = exec->hostThisValue();
1691     if (!thisValue.inherits(&JSElement::s_info))
1692         return throwVMTypeError(exec);
1693     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1694     Element* imp = static_cast<Element*>(castedThis->impl());
1695     const String& name(ustringToString(exec->argument(0).toString(exec)));
1696     if (exec->hadException())
1697         return JSValue::encode(jsUndefined());
1698 
1699 
1700     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->getElementsByTagName(name)));
1701     return JSValue::encode(result);
1702 }
1703 
jsElementPrototypeFunctionGetAttributeNS(ExecState * exec)1704 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionGetAttributeNS(ExecState* exec)
1705 {
1706     JSValue thisValue = exec->hostThisValue();
1707     if (!thisValue.inherits(&JSElement::s_info))
1708         return throwVMTypeError(exec);
1709     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1710     Element* imp = static_cast<Element*>(castedThis->impl());
1711     const String& namespaceURI(valueToStringWithNullCheck(exec, exec->argument(0)));
1712     if (exec->hadException())
1713         return JSValue::encode(jsUndefined());
1714     const String& localName(ustringToString(exec->argument(1).toString(exec)));
1715     if (exec->hadException())
1716         return JSValue::encode(jsUndefined());
1717 
1718 
1719     JSC::JSValue result = jsString(exec, imp->getAttributeNS(namespaceURI, localName));
1720     return JSValue::encode(result);
1721 }
1722 
jsElementPrototypeFunctionSetAttributeNS(ExecState * exec)1723 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionSetAttributeNS(ExecState* exec)
1724 {
1725     JSValue thisValue = exec->hostThisValue();
1726     if (!thisValue.inherits(&JSElement::s_info))
1727         return throwVMTypeError(exec);
1728     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1729     Element* imp = static_cast<Element*>(castedThis->impl());
1730     ExceptionCode ec = 0;
1731     const String& namespaceURI(valueToStringWithNullCheck(exec, exec->argument(0)));
1732     if (exec->hadException())
1733         return JSValue::encode(jsUndefined());
1734     const String& qualifiedName(ustringToString(exec->argument(1).toString(exec)));
1735     if (exec->hadException())
1736         return JSValue::encode(jsUndefined());
1737     const String& value(ustringToString(exec->argument(2).toString(exec)));
1738     if (exec->hadException())
1739         return JSValue::encode(jsUndefined());
1740 
1741     imp->setAttributeNS(namespaceURI, qualifiedName, value, ec);
1742     setDOMException(exec, ec);
1743     return JSValue::encode(jsUndefined());
1744 }
1745 
jsElementPrototypeFunctionRemoveAttributeNS(ExecState * exec)1746 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionRemoveAttributeNS(ExecState* exec)
1747 {
1748     JSValue thisValue = exec->hostThisValue();
1749     if (!thisValue.inherits(&JSElement::s_info))
1750         return throwVMTypeError(exec);
1751     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1752     Element* imp = static_cast<Element*>(castedThis->impl());
1753     ExceptionCode ec = 0;
1754     const String& namespaceURI(valueToStringWithNullCheck(exec, exec->argument(0)));
1755     if (exec->hadException())
1756         return JSValue::encode(jsUndefined());
1757     const String& localName(ustringToString(exec->argument(1).toString(exec)));
1758     if (exec->hadException())
1759         return JSValue::encode(jsUndefined());
1760 
1761     imp->removeAttributeNS(namespaceURI, localName, ec);
1762     setDOMException(exec, ec);
1763     return JSValue::encode(jsUndefined());
1764 }
1765 
jsElementPrototypeFunctionGetElementsByTagNameNS(ExecState * exec)1766 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionGetElementsByTagNameNS(ExecState* exec)
1767 {
1768     JSValue thisValue = exec->hostThisValue();
1769     if (!thisValue.inherits(&JSElement::s_info))
1770         return throwVMTypeError(exec);
1771     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1772     Element* imp = static_cast<Element*>(castedThis->impl());
1773     const String& namespaceURI(valueToStringWithNullCheck(exec, exec->argument(0)));
1774     if (exec->hadException())
1775         return JSValue::encode(jsUndefined());
1776     const String& localName(ustringToString(exec->argument(1).toString(exec)));
1777     if (exec->hadException())
1778         return JSValue::encode(jsUndefined());
1779 
1780 
1781     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->getElementsByTagNameNS(namespaceURI, localName)));
1782     return JSValue::encode(result);
1783 }
1784 
jsElementPrototypeFunctionGetAttributeNodeNS(ExecState * exec)1785 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionGetAttributeNodeNS(ExecState* exec)
1786 {
1787     JSValue thisValue = exec->hostThisValue();
1788     if (!thisValue.inherits(&JSElement::s_info))
1789         return throwVMTypeError(exec);
1790     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1791     Element* imp = static_cast<Element*>(castedThis->impl());
1792     const String& namespaceURI(valueToStringWithNullCheck(exec, exec->argument(0)));
1793     if (exec->hadException())
1794         return JSValue::encode(jsUndefined());
1795     const String& localName(ustringToString(exec->argument(1).toString(exec)));
1796     if (exec->hadException())
1797         return JSValue::encode(jsUndefined());
1798 
1799 
1800     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->getAttributeNodeNS(namespaceURI, localName)));
1801     return JSValue::encode(result);
1802 }
1803 
jsElementPrototypeFunctionSetAttributeNodeNS(ExecState * exec)1804 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionSetAttributeNodeNS(ExecState* exec)
1805 {
1806     JSValue thisValue = exec->hostThisValue();
1807     if (!thisValue.inherits(&JSElement::s_info))
1808         return throwVMTypeError(exec);
1809     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1810     Element* imp = static_cast<Element*>(castedThis->impl());
1811     ExceptionCode ec = 0;
1812     Attr* newAttr(toAttr(exec->argument(0)));
1813     if (exec->hadException())
1814         return JSValue::encode(jsUndefined());
1815 
1816 
1817     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->setAttributeNodeNS(newAttr, ec)));
1818     setDOMException(exec, ec);
1819     return JSValue::encode(result);
1820 }
1821 
jsElementPrototypeFunctionHasAttribute(ExecState * exec)1822 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionHasAttribute(ExecState* exec)
1823 {
1824     JSValue thisValue = exec->hostThisValue();
1825     if (!thisValue.inherits(&JSElement::s_info))
1826         return throwVMTypeError(exec);
1827     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1828     Element* imp = static_cast<Element*>(castedThis->impl());
1829     const String& name(ustringToString(exec->argument(0).toString(exec)));
1830     if (exec->hadException())
1831         return JSValue::encode(jsUndefined());
1832 
1833 
1834     JSC::JSValue result = jsBoolean(imp->hasAttribute(name));
1835     return JSValue::encode(result);
1836 }
1837 
jsElementPrototypeFunctionHasAttributeNS(ExecState * exec)1838 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionHasAttributeNS(ExecState* exec)
1839 {
1840     JSValue thisValue = exec->hostThisValue();
1841     if (!thisValue.inherits(&JSElement::s_info))
1842         return throwVMTypeError(exec);
1843     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1844     Element* imp = static_cast<Element*>(castedThis->impl());
1845     const String& namespaceURI(valueToStringWithNullCheck(exec, exec->argument(0)));
1846     if (exec->hadException())
1847         return JSValue::encode(jsUndefined());
1848     const String& localName(ustringToString(exec->argument(1).toString(exec)));
1849     if (exec->hadException())
1850         return JSValue::encode(jsUndefined());
1851 
1852 
1853     JSC::JSValue result = jsBoolean(imp->hasAttributeNS(namespaceURI, localName));
1854     return JSValue::encode(result);
1855 }
1856 
jsElementPrototypeFunctionFocus(ExecState * exec)1857 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionFocus(ExecState* exec)
1858 {
1859     JSValue thisValue = exec->hostThisValue();
1860     if (!thisValue.inherits(&JSElement::s_info))
1861         return throwVMTypeError(exec);
1862     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1863     Element* imp = static_cast<Element*>(castedThis->impl());
1864 
1865     imp->focus();
1866     return JSValue::encode(jsUndefined());
1867 }
1868 
jsElementPrototypeFunctionBlur(ExecState * exec)1869 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionBlur(ExecState* exec)
1870 {
1871     JSValue thisValue = exec->hostThisValue();
1872     if (!thisValue.inherits(&JSElement::s_info))
1873         return throwVMTypeError(exec);
1874     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1875     Element* imp = static_cast<Element*>(castedThis->impl());
1876 
1877     imp->blur();
1878     return JSValue::encode(jsUndefined());
1879 }
1880 
jsElementPrototypeFunctionScrollIntoView(ExecState * exec)1881 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionScrollIntoView(ExecState* exec)
1882 {
1883     JSValue thisValue = exec->hostThisValue();
1884     if (!thisValue.inherits(&JSElement::s_info))
1885         return throwVMTypeError(exec);
1886     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1887     Element* imp = static_cast<Element*>(castedThis->impl());
1888 
1889     int argsCount = exec->argumentCount();
1890     if (argsCount <= 0) {
1891         imp->scrollIntoView();
1892         return JSValue::encode(jsUndefined());
1893     }
1894 
1895     bool alignWithTop(exec->argument(0).toBoolean(exec));
1896     if (exec->hadException())
1897         return JSValue::encode(jsUndefined());
1898 
1899     imp->scrollIntoView(alignWithTop);
1900     return JSValue::encode(jsUndefined());
1901 }
1902 
jsElementPrototypeFunctionContains(ExecState * exec)1903 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionContains(ExecState* exec)
1904 {
1905     JSValue thisValue = exec->hostThisValue();
1906     if (!thisValue.inherits(&JSElement::s_info))
1907         return throwVMTypeError(exec);
1908     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1909     Element* imp = static_cast<Element*>(castedThis->impl());
1910     Element* element(toElement(exec->argument(0)));
1911     if (exec->hadException())
1912         return JSValue::encode(jsUndefined());
1913 
1914 
1915     JSC::JSValue result = jsBoolean(imp->contains(element));
1916     return JSValue::encode(result);
1917 }
1918 
jsElementPrototypeFunctionScrollIntoViewIfNeeded(ExecState * exec)1919 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionScrollIntoViewIfNeeded(ExecState* exec)
1920 {
1921     JSValue thisValue = exec->hostThisValue();
1922     if (!thisValue.inherits(&JSElement::s_info))
1923         return throwVMTypeError(exec);
1924     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1925     Element* imp = static_cast<Element*>(castedThis->impl());
1926 
1927     int argsCount = exec->argumentCount();
1928     if (argsCount <= 0) {
1929         imp->scrollIntoViewIfNeeded();
1930         return JSValue::encode(jsUndefined());
1931     }
1932 
1933     bool centerIfNeeded(exec->argument(0).toBoolean(exec));
1934     if (exec->hadException())
1935         return JSValue::encode(jsUndefined());
1936 
1937     imp->scrollIntoViewIfNeeded(centerIfNeeded);
1938     return JSValue::encode(jsUndefined());
1939 }
1940 
jsElementPrototypeFunctionScrollByLines(ExecState * exec)1941 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionScrollByLines(ExecState* exec)
1942 {
1943     JSValue thisValue = exec->hostThisValue();
1944     if (!thisValue.inherits(&JSElement::s_info))
1945         return throwVMTypeError(exec);
1946     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1947     Element* imp = static_cast<Element*>(castedThis->impl());
1948     int lines(exec->argument(0).toInt32(exec));
1949     if (exec->hadException())
1950         return JSValue::encode(jsUndefined());
1951 
1952     imp->scrollByLines(lines);
1953     return JSValue::encode(jsUndefined());
1954 }
1955 
jsElementPrototypeFunctionScrollByPages(ExecState * exec)1956 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionScrollByPages(ExecState* exec)
1957 {
1958     JSValue thisValue = exec->hostThisValue();
1959     if (!thisValue.inherits(&JSElement::s_info))
1960         return throwVMTypeError(exec);
1961     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1962     Element* imp = static_cast<Element*>(castedThis->impl());
1963     int pages(exec->argument(0).toInt32(exec));
1964     if (exec->hadException())
1965         return JSValue::encode(jsUndefined());
1966 
1967     imp->scrollByPages(pages);
1968     return JSValue::encode(jsUndefined());
1969 }
1970 
jsElementPrototypeFunctionGetElementsByClassName(ExecState * exec)1971 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionGetElementsByClassName(ExecState* exec)
1972 {
1973     JSValue thisValue = exec->hostThisValue();
1974     if (!thisValue.inherits(&JSElement::s_info))
1975         return throwVMTypeError(exec);
1976     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1977     Element* imp = static_cast<Element*>(castedThis->impl());
1978     const String& name(ustringToString(exec->argument(0).toString(exec)));
1979     if (exec->hadException())
1980         return JSValue::encode(jsUndefined());
1981 
1982 
1983     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->getElementsByClassName(name)));
1984     return JSValue::encode(result);
1985 }
1986 
jsElementPrototypeFunctionQuerySelector(ExecState * exec)1987 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionQuerySelector(ExecState* exec)
1988 {
1989     JSValue thisValue = exec->hostThisValue();
1990     if (!thisValue.inherits(&JSElement::s_info))
1991         return throwVMTypeError(exec);
1992     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
1993     Element* imp = static_cast<Element*>(castedThis->impl());
1994     if (exec->argumentCount() < 1)
1995         return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
1996     ExceptionCode ec = 0;
1997     const String& selectors(ustringToString(exec->argument(0).toString(exec)));
1998     if (exec->hadException())
1999         return JSValue::encode(jsUndefined());
2000 
2001 
2002     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->querySelector(selectors, ec)));
2003     setDOMException(exec, ec);
2004     return JSValue::encode(result);
2005 }
2006 
jsElementPrototypeFunctionQuerySelectorAll(ExecState * exec)2007 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionQuerySelectorAll(ExecState* exec)
2008 {
2009     JSValue thisValue = exec->hostThisValue();
2010     if (!thisValue.inherits(&JSElement::s_info))
2011         return throwVMTypeError(exec);
2012     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
2013     Element* imp = static_cast<Element*>(castedThis->impl());
2014     if (exec->argumentCount() < 1)
2015         return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
2016     ExceptionCode ec = 0;
2017     const String& selectors(ustringToString(exec->argument(0).toString(exec)));
2018     if (exec->hadException())
2019         return JSValue::encode(jsUndefined());
2020 
2021 
2022     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->querySelectorAll(selectors, ec)));
2023     setDOMException(exec, ec);
2024     return JSValue::encode(result);
2025 }
2026 
jsElementPrototypeFunctionWebkitMatchesSelector(ExecState * exec)2027 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionWebkitMatchesSelector(ExecState* exec)
2028 {
2029     JSValue thisValue = exec->hostThisValue();
2030     if (!thisValue.inherits(&JSElement::s_info))
2031         return throwVMTypeError(exec);
2032     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
2033     Element* imp = static_cast<Element*>(castedThis->impl());
2034     ExceptionCode ec = 0;
2035     const String& selectors(ustringToString(exec->argument(0).toString(exec)));
2036     if (exec->hadException())
2037         return JSValue::encode(jsUndefined());
2038 
2039 
2040     JSC::JSValue result = jsBoolean(imp->webkitMatchesSelector(selectors, ec));
2041     setDOMException(exec, ec);
2042     return JSValue::encode(result);
2043 }
2044 
jsElementPrototypeFunctionGetClientRects(ExecState * exec)2045 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionGetClientRects(ExecState* exec)
2046 {
2047     JSValue thisValue = exec->hostThisValue();
2048     if (!thisValue.inherits(&JSElement::s_info))
2049         return throwVMTypeError(exec);
2050     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
2051     Element* imp = static_cast<Element*>(castedThis->impl());
2052 
2053 
2054     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->getClientRects()));
2055     return JSValue::encode(result);
2056 }
2057 
jsElementPrototypeFunctionGetBoundingClientRect(ExecState * exec)2058 EncodedJSValue JSC_HOST_CALL jsElementPrototypeFunctionGetBoundingClientRect(ExecState* exec)
2059 {
2060     JSValue thisValue = exec->hostThisValue();
2061     if (!thisValue.inherits(&JSElement::s_info))
2062         return throwVMTypeError(exec);
2063     JSElement* castedThis = static_cast<JSElement*>(asObject(thisValue));
2064     Element* imp = static_cast<Element*>(castedThis->impl());
2065 
2066 
2067     JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->getBoundingClientRect()));
2068     return JSValue::encode(result);
2069 }
2070 
toElement(JSC::JSValue value)2071 Element* toElement(JSC::JSValue value)
2072 {
2073     return value.inherits(&JSElement::s_info) ? static_cast<JSElement*>(asObject(value))->impl() : 0;
2074 }
2075 
2076 }
2077