~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/webkit/WebCore/generated/JSHTMLSelectElement.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
*/
20
20
 
21
21
#include "config.h"
22
 
 
23
22
#include "JSHTMLSelectElement.h"
24
23
 
25
 
#include <wtf/GetPtr.h>
26
 
 
27
 
#include <runtime/PropertyNameArray.h>
28
24
#include "ExceptionCode.h"
29
25
#include "HTMLFormElement.h"
30
26
#include "HTMLOptionsCollection.h"
33
29
#include "JSHTMLFormElement.h"
34
30
#include "JSHTMLOptionsCollection.h"
35
31
#include "JSNode.h"
 
32
#include "JSValidityState.h"
36
33
#include "KURL.h"
37
34
#include "Node.h"
38
 
 
 
35
#include "ValidityState.h"
39
36
#include <runtime/Error.h>
40
37
#include <runtime/JSNumberCell.h>
41
38
#include <runtime/JSString.h>
 
39
#include <runtime/PropertyNameArray.h>
 
40
#include <wtf/GetPtr.h>
42
41
 
43
42
using namespace JSC;
44
43
 
45
44
namespace WebCore {
46
45
 
47
 
ASSERT_CLASS_FITS_IN_CELL(JSHTMLSelectElement)
 
46
ASSERT_CLASS_FITS_IN_CELL(JSHTMLSelectElement);
48
47
 
49
48
/* Hash table */
50
49
 
51
 
static const HashTableValue JSHTMLSelectElementTableValues[14] =
 
50
static const HashTableValue JSHTMLSelectElementTableValues[15] =
52
51
{
53
52
    { "type", DontDelete|ReadOnly, (intptr_t)jsHTMLSelectElementType, (intptr_t)0 },
54
53
    { "selectedIndex", DontDelete, (intptr_t)jsHTMLSelectElementSelectedIndex, (intptr_t)setJSHTMLSelectElementSelectedIndex },
55
54
    { "value", DontDelete, (intptr_t)jsHTMLSelectElementValue, (intptr_t)setJSHTMLSelectElementValue },
56
55
    { "length", DontDelete, (intptr_t)jsHTMLSelectElementLength, (intptr_t)setJSHTMLSelectElementLength },
57
56
    { "form", DontDelete|ReadOnly, (intptr_t)jsHTMLSelectElementForm, (intptr_t)0 },
 
57
    { "validity", DontDelete|ReadOnly, (intptr_t)jsHTMLSelectElementValidity, (intptr_t)0 },
58
58
    { "willValidate", DontDelete|ReadOnly, (intptr_t)jsHTMLSelectElementWillValidate, (intptr_t)0 },
59
59
    { "options", DontDelete|ReadOnly, (intptr_t)jsHTMLSelectElementOptions, (intptr_t)0 },
60
60
    { "disabled", DontDelete, (intptr_t)jsHTMLSelectElementDisabled, (intptr_t)setJSHTMLSelectElementDisabled },
66
66
    { 0, 0, 0, 0 }
67
67
};
68
68
 
69
 
static const HashTable JSHTMLSelectElementTable =
 
69
static JSC_CONST_HASHTABLE HashTable JSHTMLSelectElementTable =
70
70
#if ENABLE(PERFECT_HASH_SIZE)
71
71
    { 127, JSHTMLSelectElementTableValues, 0 };
72
72
#else
73
 
    { 34, 31, JSHTMLSelectElementTableValues, 0 };
 
73
    { 35, 31, JSHTMLSelectElementTableValues, 0 };
74
74
#endif
75
75
 
76
76
/* Hash table for constructor */
80
80
    { 0, 0, 0, 0 }
81
81
};
82
82
 
83
 
static const HashTable JSHTMLSelectElementConstructorTable =
 
83
static JSC_CONST_HASHTABLE HashTable JSHTMLSelectElementConstructorTable =
84
84
#if ENABLE(PERFECT_HASH_SIZE)
85
85
    { 0, JSHTMLSelectElementConstructorTableValues, 0 };
86
86
#else
87
87
    { 1, 0, JSHTMLSelectElementConstructorTableValues, 0 };
88
88
#endif
89
89
 
90
 
class JSHTMLSelectElementConstructor : public DOMObject {
 
90
class JSHTMLSelectElementConstructor : public DOMConstructorObject {
91
91
public:
92
 
    JSHTMLSelectElementConstructor(ExecState* exec)
93
 
        : DOMObject(JSHTMLSelectElementConstructor::createStructure(exec->lexicalGlobalObject()->objectPrototype()))
 
92
    JSHTMLSelectElementConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
 
93
        : DOMConstructorObject(JSHTMLSelectElementConstructor::createStructure(globalObject->objectPrototype()), globalObject)
94
94
    {
95
 
        putDirect(exec->propertyNames().prototype, JSHTMLSelectElementPrototype::self(exec, exec->lexicalGlobalObject()), None);
 
95
        putDirect(exec->propertyNames().prototype, JSHTMLSelectElementPrototype::self(exec, globalObject), None);
96
96
    }
97
97
    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
 
98
    virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
98
99
    virtual const ClassInfo* classInfo() const { return &s_info; }
99
100
    static const ClassInfo s_info;
100
101
 
101
 
    static PassRefPtr<Structure> createStructure(JSValuePtr proto) 
 
102
    static PassRefPtr<Structure> createStructure(JSValue proto) 
102
103
    { 
103
104
        return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance)); 
104
105
    }
111
112
    return getStaticValueSlot<JSHTMLSelectElementConstructor, DOMObject>(exec, &JSHTMLSelectElementConstructorTable, this, propertyName, slot);
112
113
}
113
114
 
 
115
bool JSHTMLSelectElementConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
 
116
{
 
117
    return getStaticValueDescriptor<JSHTMLSelectElementConstructor, DOMObject>(exec, &JSHTMLSelectElementConstructorTable, this, propertyName, descriptor);
 
118
}
 
119
 
114
120
/* Hash table for prototype */
115
121
 
116
 
static const HashTableValue JSHTMLSelectElementPrototypeTableValues[5] =
 
122
static const HashTableValue JSHTMLSelectElementPrototypeTableValues[7] =
117
123
{
 
124
    { "checkValidity", DontDelete|Function, (intptr_t)jsHTMLSelectElementPrototypeFunctionCheckValidity, (intptr_t)0 },
 
125
    { "setCustomValidity", DontDelete|Function, (intptr_t)jsHTMLSelectElementPrototypeFunctionSetCustomValidity, (intptr_t)1 },
118
126
    { "add", DontDelete|Function, (intptr_t)jsHTMLSelectElementPrototypeFunctionAdd, (intptr_t)2 },
119
127
    { "remove", DontDelete|Function, (intptr_t)jsHTMLSelectElementPrototypeFunctionRemove, (intptr_t)0 },
120
128
    { "item", DontDelete|Function, (intptr_t)jsHTMLSelectElementPrototypeFunctionItem, (intptr_t)1 },
122
130
    { 0, 0, 0, 0 }
123
131
};
124
132
 
125
 
static const HashTable JSHTMLSelectElementPrototypeTable =
 
133
static JSC_CONST_HASHTABLE HashTable JSHTMLSelectElementPrototypeTable =
126
134
#if ENABLE(PERFECT_HASH_SIZE)
127
135
    { 15, JSHTMLSelectElementPrototypeTableValues, 0 };
128
136
#else
129
 
    { 9, 7, JSHTMLSelectElementPrototypeTableValues, 0 };
 
137
    { 16, 15, JSHTMLSelectElementPrototypeTableValues, 0 };
130
138
#endif
131
139
 
132
140
const ClassInfo JSHTMLSelectElementPrototype::s_info = { "HTMLSelectElementPrototype", 0, &JSHTMLSelectElementPrototypeTable, 0 };
141
149
    return getStaticFunctionSlot<JSObject>(exec, &JSHTMLSelectElementPrototypeTable, this, propertyName, slot);
142
150
}
143
151
 
 
152
bool JSHTMLSelectElementPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
 
153
{
 
154
    return getStaticFunctionDescriptor<JSObject>(exec, &JSHTMLSelectElementPrototypeTable, this, propertyName, descriptor);
 
155
}
 
156
 
144
157
const ClassInfo JSHTMLSelectElement::s_info = { "HTMLSelectElement", &JSHTMLElement::s_info, &JSHTMLSelectElementTable, 0 };
145
158
 
146
 
JSHTMLSelectElement::JSHTMLSelectElement(PassRefPtr<Structure> structure, PassRefPtr<HTMLSelectElement> impl)
147
 
    : JSHTMLElement(structure, impl)
 
159
JSHTMLSelectElement::JSHTMLSelectElement(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<HTMLSelectElement> impl)
 
160
    : JSHTMLElement(structure, globalObject, impl)
148
161
{
149
162
}
150
163
 
169
182
    return getStaticValueSlot<JSHTMLSelectElement, Base>(exec, &JSHTMLSelectElementTable, this, propertyName, slot);
170
183
}
171
184
 
 
185
bool JSHTMLSelectElement::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
 
186
{
 
187
    const HashEntry* entry = JSHTMLSelectElementTable.entry(exec, propertyName);
 
188
    if (entry) {
 
189
        PropertySlot slot;
 
190
        slot.setCustom(this, entry->propertyGetter());
 
191
        descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
 
192
        return true;
 
193
    }
 
194
    bool ok;
 
195
    unsigned index = propertyName.toUInt32(&ok, false);
 
196
    if (ok && index < static_cast<HTMLSelectElement*>(impl())->length()) {
 
197
        PropertySlot slot;
 
198
        slot.setCustomIndex(this, index, indexGetter);
 
199
        descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete);
 
200
        return true;
 
201
    }
 
202
    return getStaticValueDescriptor<JSHTMLSelectElement, Base>(exec, &JSHTMLSelectElementTable, this, propertyName, descriptor);
 
203
}
 
204
 
172
205
bool JSHTMLSelectElement::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
173
206
{
174
207
    if (propertyName < static_cast<HTMLSelectElement*>(impl())->length()) {
178
211
    return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
179
212
}
180
213
 
181
 
JSValuePtr jsHTMLSelectElementType(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
214
JSValue jsHTMLSelectElementType(ExecState* exec, const Identifier&, const PropertySlot& slot)
182
215
{
183
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()))->impl());
 
216
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
 
217
    UNUSED_PARAM(exec);
 
218
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
184
219
    return jsString(exec, imp->type());
185
220
}
186
221
 
187
 
JSValuePtr jsHTMLSelectElementSelectedIndex(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
222
JSValue jsHTMLSelectElementSelectedIndex(ExecState* exec, const Identifier&, const PropertySlot& slot)
188
223
{
189
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()))->impl());
 
224
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
 
225
    UNUSED_PARAM(exec);
 
226
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
190
227
    return jsNumber(exec, imp->selectedIndex());
191
228
}
192
229
 
193
 
JSValuePtr jsHTMLSelectElementValue(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
230
JSValue jsHTMLSelectElementValue(ExecState* exec, const Identifier&, const PropertySlot& slot)
194
231
{
195
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()))->impl());
 
232
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
 
233
    UNUSED_PARAM(exec);
 
234
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
196
235
    return jsString(exec, imp->value());
197
236
}
198
237
 
199
 
JSValuePtr jsHTMLSelectElementLength(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
238
JSValue jsHTMLSelectElementLength(ExecState* exec, const Identifier&, const PropertySlot& slot)
200
239
{
201
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()))->impl());
 
240
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
 
241
    UNUSED_PARAM(exec);
 
242
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
202
243
    return jsNumber(exec, imp->length());
203
244
}
204
245
 
205
 
JSValuePtr jsHTMLSelectElementForm(ExecState* exec, const Identifier&, const PropertySlot& slot)
206
 
{
207
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()))->impl());
208
 
    return toJS(exec, WTF::getPtr(imp->form()));
209
 
}
210
 
 
211
 
JSValuePtr jsHTMLSelectElementWillValidate(ExecState* exec, const Identifier&, const PropertySlot& slot)
212
 
{
213
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()))->impl());
 
246
JSValue jsHTMLSelectElementForm(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
247
{
 
248
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
 
249
    UNUSED_PARAM(exec);
 
250
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
 
251
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->form()));
 
252
}
 
253
 
 
254
JSValue jsHTMLSelectElementValidity(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
255
{
 
256
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
 
257
    UNUSED_PARAM(exec);
 
258
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
 
259
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->validity()));
 
260
}
 
261
 
 
262
JSValue jsHTMLSelectElementWillValidate(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
263
{
 
264
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
 
265
    UNUSED_PARAM(exec);
 
266
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
214
267
    return jsBoolean(imp->willValidate());
215
268
}
216
269
 
217
 
JSValuePtr jsHTMLSelectElementOptions(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
270
JSValue jsHTMLSelectElementOptions(ExecState* exec, const Identifier&, const PropertySlot& slot)
218
271
{
219
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()))->impl());
220
 
    return toJS(exec, WTF::getPtr(imp->options()));
 
272
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
 
273
    UNUSED_PARAM(exec);
 
274
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
 
275
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->options()));
221
276
}
222
277
 
223
 
JSValuePtr jsHTMLSelectElementDisabled(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
278
JSValue jsHTMLSelectElementDisabled(ExecState* exec, const Identifier&, const PropertySlot& slot)
224
279
{
225
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()))->impl());
 
280
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
 
281
    UNUSED_PARAM(exec);
 
282
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
226
283
    return jsBoolean(imp->disabled());
227
284
}
228
285
 
229
 
JSValuePtr jsHTMLSelectElementAutofocus(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
286
JSValue jsHTMLSelectElementAutofocus(ExecState* exec, const Identifier&, const PropertySlot& slot)
230
287
{
231
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()))->impl());
 
288
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
 
289
    UNUSED_PARAM(exec);
 
290
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
232
291
    return jsBoolean(imp->autofocus());
233
292
}
234
293
 
235
 
JSValuePtr jsHTMLSelectElementMultiple(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
294
JSValue jsHTMLSelectElementMultiple(ExecState* exec, const Identifier&, const PropertySlot& slot)
236
295
{
237
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()))->impl());
 
296
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
 
297
    UNUSED_PARAM(exec);
 
298
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
238
299
    return jsBoolean(imp->multiple());
239
300
}
240
301
 
241
 
JSValuePtr jsHTMLSelectElementName(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
302
JSValue jsHTMLSelectElementName(ExecState* exec, const Identifier&, const PropertySlot& slot)
242
303
{
243
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()))->impl());
 
304
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
 
305
    UNUSED_PARAM(exec);
 
306
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
244
307
    return jsString(exec, imp->name());
245
308
}
246
309
 
247
 
JSValuePtr jsHTMLSelectElementSize(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
310
JSValue jsHTMLSelectElementSize(ExecState* exec, const Identifier&, const PropertySlot& slot)
248
311
{
249
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()))->impl());
 
312
    JSHTMLSelectElement* castedThis = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
 
313
    UNUSED_PARAM(exec);
 
314
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThis->impl());
250
315
    return jsNumber(exec, imp->size());
251
316
}
252
317
 
253
 
JSValuePtr jsHTMLSelectElementConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
318
JSValue jsHTMLSelectElementConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
254
319
{
255
 
    return static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()))->getConstructor(exec);
 
320
    JSHTMLSelectElement* domObject = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
 
321
    return JSHTMLSelectElement::getConstructor(exec, domObject->globalObject());
256
322
}
257
 
void JSHTMLSelectElement::put(ExecState* exec, const Identifier& propertyName, JSValuePtr value, PutPropertySlot& slot)
 
323
void JSHTMLSelectElement::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
258
324
{
259
325
    bool ok;
260
326
    unsigned index = propertyName.toUInt32(&ok, false);
265
331
    lookupPut<JSHTMLSelectElement, Base>(exec, propertyName, value, &JSHTMLSelectElementTable, this, slot);
266
332
}
267
333
 
268
 
void JSHTMLSelectElement::put(ExecState* exec, unsigned propertyName, JSValuePtr value)
 
334
void JSHTMLSelectElement::put(ExecState* exec, unsigned propertyName, JSValue value)
269
335
{
270
336
    indexSetter(exec, propertyName, value);
271
337
    return;
272
338
}
273
339
 
274
 
void setJSHTMLSelectElementSelectedIndex(ExecState* exec, JSObject* thisObject, JSValuePtr value)
 
340
void setJSHTMLSelectElementSelectedIndex(ExecState* exec, JSObject* thisObject, JSValue value)
275
341
{
276
342
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(thisObject)->impl());
277
 
    imp->setSelectedIndex(value->toInt32(exec));
 
343
    imp->setSelectedIndex(value.toInt32(exec));
278
344
}
279
345
 
280
 
void setJSHTMLSelectElementValue(ExecState* exec, JSObject* thisObject, JSValuePtr value)
 
346
void setJSHTMLSelectElementValue(ExecState* exec, JSObject* thisObject, JSValue value)
281
347
{
282
348
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(thisObject)->impl());
283
349
    imp->setValue(valueToStringWithNullCheck(exec, value));
284
350
}
285
351
 
286
 
void setJSHTMLSelectElementLength(ExecState* exec, JSObject* thisObject, JSValuePtr value)
 
352
void setJSHTMLSelectElementLength(ExecState* exec, JSObject* thisObject, JSValue value)
287
353
{
288
354
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(thisObject)->impl());
289
355
    ExceptionCode ec = 0;
290
 
    imp->setLength(value->toInt32(exec), ec);
 
356
    imp->setLength(value.toInt32(exec), ec);
291
357
    setDOMException(exec, ec);
292
358
}
293
359
 
294
 
void setJSHTMLSelectElementDisabled(ExecState* exec, JSObject* thisObject, JSValuePtr value)
295
 
{
296
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(thisObject)->impl());
297
 
    imp->setDisabled(value->toBoolean(exec));
298
 
}
299
 
 
300
 
void setJSHTMLSelectElementAutofocus(ExecState* exec, JSObject* thisObject, JSValuePtr value)
301
 
{
302
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(thisObject)->impl());
303
 
    imp->setAutofocus(value->toBoolean(exec));
304
 
}
305
 
 
306
 
void setJSHTMLSelectElementMultiple(ExecState* exec, JSObject* thisObject, JSValuePtr value)
307
 
{
308
 
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(thisObject)->impl());
309
 
    imp->setMultiple(value->toBoolean(exec));
310
 
}
311
 
 
312
 
void setJSHTMLSelectElementName(ExecState* exec, JSObject* thisObject, JSValuePtr value)
 
360
void setJSHTMLSelectElementDisabled(ExecState* exec, JSObject* thisObject, JSValue value)
 
361
{
 
362
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(thisObject)->impl());
 
363
    imp->setDisabled(value.toBoolean(exec));
 
364
}
 
365
 
 
366
void setJSHTMLSelectElementAutofocus(ExecState* exec, JSObject* thisObject, JSValue value)
 
367
{
 
368
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(thisObject)->impl());
 
369
    imp->setAutofocus(value.toBoolean(exec));
 
370
}
 
371
 
 
372
void setJSHTMLSelectElementMultiple(ExecState* exec, JSObject* thisObject, JSValue value)
 
373
{
 
374
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(thisObject)->impl());
 
375
    imp->setMultiple(value.toBoolean(exec));
 
376
}
 
377
 
 
378
void setJSHTMLSelectElementName(ExecState* exec, JSObject* thisObject, JSValue value)
313
379
{
314
380
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(thisObject)->impl());
315
381
    imp->setName(valueToStringWithNullCheck(exec, value));
316
382
}
317
383
 
318
 
void setJSHTMLSelectElementSize(ExecState* exec, JSObject* thisObject, JSValuePtr value)
 
384
void setJSHTMLSelectElementSize(ExecState* exec, JSObject* thisObject, JSValue value)
319
385
{
320
386
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(static_cast<JSHTMLSelectElement*>(thisObject)->impl());
321
 
    imp->setSize(value->toInt32(exec));
 
387
    imp->setSize(value.toInt32(exec));
322
388
}
323
389
 
324
 
void JSHTMLSelectElement::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
 
390
void JSHTMLSelectElement::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
325
391
{
326
392
    for (unsigned i = 0; i < static_cast<HTMLSelectElement*>(impl())->length(); ++i)
327
393
        propertyNames.add(Identifier::from(exec, i));
328
 
     Base::getPropertyNames(exec, propertyNames);
329
 
}
330
 
 
331
 
JSValuePtr JSHTMLSelectElement::getConstructor(ExecState* exec)
332
 
{
333
 
    return getDOMConstructor<JSHTMLSelectElementConstructor>(exec);
334
 
}
335
 
 
336
 
JSValuePtr jsHTMLSelectElementPrototypeFunctionAdd(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
337
 
{
338
 
    if (!thisValue->isObject(&JSHTMLSelectElement::s_info))
 
394
     Base::getOwnPropertyNames(exec, propertyNames);
 
395
}
 
396
 
 
397
JSValue JSHTMLSelectElement::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
 
398
{
 
399
    return getDOMConstructor<JSHTMLSelectElementConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
 
400
}
 
401
 
 
402
JSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionCheckValidity(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
 
403
{
 
404
    UNUSED_PARAM(args);
 
405
    if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
 
406
        return throwError(exec, TypeError);
 
407
    JSHTMLSelectElement* castedThisObj = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
 
408
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThisObj->impl());
 
409
 
 
410
 
 
411
    JSC::JSValue result = jsBoolean(imp->checkValidity());
 
412
    return result;
 
413
}
 
414
 
 
415
JSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionSetCustomValidity(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
 
416
{
 
417
    UNUSED_PARAM(args);
 
418
    if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
 
419
        return throwError(exec, TypeError);
 
420
    JSHTMLSelectElement* castedThisObj = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
 
421
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThisObj->impl());
 
422
    const UString& error = valueToStringWithUndefinedOrNullCheck(exec, args.at(0));
 
423
 
 
424
    imp->setCustomValidity(error);
 
425
    return jsUndefined();
 
426
}
 
427
 
 
428
JSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionAdd(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
 
429
{
 
430
    UNUSED_PARAM(args);
 
431
    if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
339
432
        return throwError(exec, TypeError);
340
433
    JSHTMLSelectElement* castedThisObj = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
341
434
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThisObj->impl());
342
435
    ExceptionCode ec = 0;
343
 
    HTMLElement* element = toHTMLElement(args.at(exec, 0));
344
 
    HTMLElement* before = toHTMLElement(args.at(exec, 1));
 
436
    HTMLElement* element = toHTMLElement(args.at(0));
 
437
    HTMLElement* before = toHTMLElement(args.at(1));
345
438
 
346
439
    imp->add(element, before, ec);
347
440
    setDOMException(exec, ec);
348
441
    return jsUndefined();
349
442
}
350
443
 
351
 
JSValuePtr jsHTMLSelectElementPrototypeFunctionRemove(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
 
444
JSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionRemove(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
352
445
{
353
 
    if (!thisValue->isObject(&JSHTMLSelectElement::s_info))
 
446
    UNUSED_PARAM(args);
 
447
    if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
354
448
        return throwError(exec, TypeError);
355
449
    JSHTMLSelectElement* castedThisObj = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
356
450
    return castedThisObj->remove(exec, args);
357
451
}
358
452
 
359
 
JSValuePtr jsHTMLSelectElementPrototypeFunctionItem(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
 
453
JSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionItem(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
360
454
{
361
 
    if (!thisValue->isObject(&JSHTMLSelectElement::s_info))
 
455
    UNUSED_PARAM(args);
 
456
    if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
362
457
        return throwError(exec, TypeError);
363
458
    JSHTMLSelectElement* castedThisObj = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
364
459
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThisObj->impl());
365
 
    int index = args.at(exec, 0)->toInt32(exec);
 
460
    int index = args.at(0).toInt32(exec);
366
461
    if (index < 0) {
367
462
        setDOMException(exec, INDEX_SIZE_ERR);
368
463
        return jsUndefined();
369
464
    }
370
465
 
371
466
 
372
 
    JSC::JSValuePtr result = toJS(exec, WTF::getPtr(imp->item(index)));
 
467
    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->item(index)));
373
468
    return result;
374
469
}
375
470
 
376
 
JSValuePtr jsHTMLSelectElementPrototypeFunctionNamedItem(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
 
471
JSValue JSC_HOST_CALL jsHTMLSelectElementPrototypeFunctionNamedItem(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
377
472
{
378
 
    if (!thisValue->isObject(&JSHTMLSelectElement::s_info))
 
473
    UNUSED_PARAM(args);
 
474
    if (!thisValue.inherits(&JSHTMLSelectElement::s_info))
379
475
        return throwError(exec, TypeError);
380
476
    JSHTMLSelectElement* castedThisObj = static_cast<JSHTMLSelectElement*>(asObject(thisValue));
381
477
    HTMLSelectElement* imp = static_cast<HTMLSelectElement*>(castedThisObj->impl());
382
 
    const UString& name = args.at(exec, 0)->toString(exec);
383
 
 
384
 
 
385
 
    JSC::JSValuePtr result = toJS(exec, WTF::getPtr(imp->namedItem(name)));
 
478
    const UString& name = args.at(0).toString(exec);
 
479
 
 
480
 
 
481
    JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->namedItem(name)));
386
482
    return result;
387
483
}
388
484
 
389
485
 
390
 
JSValuePtr JSHTMLSelectElement::indexGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 
486
JSValue JSHTMLSelectElement::indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
391
487
{
392
488
    JSHTMLSelectElement* thisObj = static_cast<JSHTMLSelectElement*>(asObject(slot.slotBase()));
393
 
    return toJS(exec, static_cast<HTMLSelectElement*>(thisObj->impl())->item(slot.index()));
 
489
    return toJS(exec, thisObj->globalObject(), static_cast<HTMLSelectElement*>(thisObj->impl())->item(slot.index()));
394
490
}
395
491
 
396
492
}