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

« back to all changes in this revision

Viewing changes to src/3rdparty/webkit/WebCore/generated/JSCSSVariablesDeclaration.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 "JSCSSVariablesDeclaration.h"
24
23
 
25
 
#include <wtf/GetPtr.h>
26
 
 
27
 
#include <runtime/PropertyNameArray.h>
28
24
#include "CSSRule.h"
29
25
#include "CSSVariablesDeclaration.h"
30
26
#include "JSCSSRule.h"
31
27
#include "KURL.h"
32
 
 
33
28
#include <runtime/Error.h>
34
29
#include <runtime/JSNumberCell.h>
35
30
#include <runtime/JSString.h>
 
31
#include <runtime/PropertyNameArray.h>
 
32
#include <wtf/GetPtr.h>
36
33
 
37
34
using namespace JSC;
38
35
 
39
36
namespace WebCore {
40
37
 
41
 
ASSERT_CLASS_FITS_IN_CELL(JSCSSVariablesDeclaration)
 
38
ASSERT_CLASS_FITS_IN_CELL(JSCSSVariablesDeclaration);
42
39
 
43
40
/* Hash table */
44
41
 
51
48
    { 0, 0, 0, 0 }
52
49
};
53
50
 
54
 
static const HashTable JSCSSVariablesDeclarationTable =
 
51
static JSC_CONST_HASHTABLE HashTable JSCSSVariablesDeclarationTable =
55
52
#if ENABLE(PERFECT_HASH_SIZE)
56
53
    { 63, JSCSSVariablesDeclarationTableValues, 0 };
57
54
#else
65
62
    { 0, 0, 0, 0 }
66
63
};
67
64
 
68
 
static const HashTable JSCSSVariablesDeclarationConstructorTable =
 
65
static JSC_CONST_HASHTABLE HashTable JSCSSVariablesDeclarationConstructorTable =
69
66
#if ENABLE(PERFECT_HASH_SIZE)
70
67
    { 0, JSCSSVariablesDeclarationConstructorTableValues, 0 };
71
68
#else
72
69
    { 1, 0, JSCSSVariablesDeclarationConstructorTableValues, 0 };
73
70
#endif
74
71
 
75
 
class JSCSSVariablesDeclarationConstructor : public DOMObject {
 
72
class JSCSSVariablesDeclarationConstructor : public DOMConstructorObject {
76
73
public:
77
 
    JSCSSVariablesDeclarationConstructor(ExecState* exec)
78
 
        : DOMObject(JSCSSVariablesDeclarationConstructor::createStructure(exec->lexicalGlobalObject()->objectPrototype()))
 
74
    JSCSSVariablesDeclarationConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
 
75
        : DOMConstructorObject(JSCSSVariablesDeclarationConstructor::createStructure(globalObject->objectPrototype()), globalObject)
79
76
    {
80
 
        putDirect(exec->propertyNames().prototype, JSCSSVariablesDeclarationPrototype::self(exec, exec->lexicalGlobalObject()), None);
 
77
        putDirect(exec->propertyNames().prototype, JSCSSVariablesDeclarationPrototype::self(exec, globalObject), None);
81
78
    }
82
79
    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
 
80
    virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
83
81
    virtual const ClassInfo* classInfo() const { return &s_info; }
84
82
    static const ClassInfo s_info;
85
83
 
86
 
    static PassRefPtr<Structure> createStructure(JSValuePtr proto) 
 
84
    static PassRefPtr<Structure> createStructure(JSValue proto) 
87
85
    { 
88
86
        return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance)); 
89
87
    }
96
94
    return getStaticValueSlot<JSCSSVariablesDeclarationConstructor, DOMObject>(exec, &JSCSSVariablesDeclarationConstructorTable, this, propertyName, slot);
97
95
}
98
96
 
 
97
bool JSCSSVariablesDeclarationConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
 
98
{
 
99
    return getStaticValueDescriptor<JSCSSVariablesDeclarationConstructor, DOMObject>(exec, &JSCSSVariablesDeclarationConstructorTable, this, propertyName, descriptor);
 
100
}
 
101
 
99
102
/* Hash table for prototype */
100
103
 
101
104
static const HashTableValue JSCSSVariablesDeclarationPrototypeTableValues[5] =
107
110
    { 0, 0, 0, 0 }
108
111
};
109
112
 
110
 
static const HashTable JSCSSVariablesDeclarationPrototypeTable =
 
113
static JSC_CONST_HASHTABLE HashTable JSCSSVariablesDeclarationPrototypeTable =
111
114
#if ENABLE(PERFECT_HASH_SIZE)
112
115
    { 15, JSCSSVariablesDeclarationPrototypeTableValues, 0 };
113
116
#else
126
129
    return getStaticFunctionSlot<JSObject>(exec, &JSCSSVariablesDeclarationPrototypeTable, this, propertyName, slot);
127
130
}
128
131
 
 
132
bool JSCSSVariablesDeclarationPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
 
133
{
 
134
    return getStaticFunctionDescriptor<JSObject>(exec, &JSCSSVariablesDeclarationPrototypeTable, this, propertyName, descriptor);
 
135
}
 
136
 
129
137
const ClassInfo JSCSSVariablesDeclaration::s_info = { "CSSVariablesDeclaration", 0, &JSCSSVariablesDeclarationTable, 0 };
130
138
 
131
 
JSCSSVariablesDeclaration::JSCSSVariablesDeclaration(PassRefPtr<Structure> structure, PassRefPtr<CSSVariablesDeclaration> impl)
132
 
    : DOMObject(structure)
 
139
JSCSSVariablesDeclaration::JSCSSVariablesDeclaration(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<CSSVariablesDeclaration> impl)
 
140
    : DOMObjectWithGlobalPointer(structure, globalObject)
133
141
    , m_impl(impl)
134
142
{
135
143
}
136
144
 
137
145
JSCSSVariablesDeclaration::~JSCSSVariablesDeclaration()
138
146
{
139
 
    forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get());
140
 
 
 
147
    forgetDOMObject(*Heap::heap(this)->globalData(), impl());
141
148
}
142
149
 
143
150
JSObject* JSCSSVariablesDeclaration::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
161
168
    return getStaticValueSlot<JSCSSVariablesDeclaration, Base>(exec, &JSCSSVariablesDeclarationTable, this, propertyName, slot);
162
169
}
163
170
 
 
171
bool JSCSSVariablesDeclaration::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
 
172
{
 
173
    const HashEntry* entry = JSCSSVariablesDeclarationTable.entry(exec, propertyName);
 
174
    if (entry) {
 
175
        PropertySlot slot;
 
176
        slot.setCustom(this, entry->propertyGetter());
 
177
        descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes());
 
178
        return true;
 
179
    }
 
180
    bool ok;
 
181
    unsigned index = propertyName.toUInt32(&ok, false);
 
182
    if (ok && index < static_cast<CSSVariablesDeclaration*>(impl())->length()) {
 
183
        PropertySlot slot;
 
184
        slot.setCustomIndex(this, index, indexGetter);
 
185
        descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly);
 
186
        return true;
 
187
    }
 
188
    return getStaticValueDescriptor<JSCSSVariablesDeclaration, Base>(exec, &JSCSSVariablesDeclarationTable, this, propertyName, descriptor);
 
189
}
 
190
 
164
191
bool JSCSSVariablesDeclaration::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot)
165
192
{
166
193
    if (propertyName < static_cast<CSSVariablesDeclaration*>(impl())->length()) {
170
197
    return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot);
171
198
}
172
199
 
173
 
JSValuePtr jsCSSVariablesDeclarationCssText(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
200
JSValue jsCSSVariablesDeclarationCssText(ExecState* exec, const Identifier&, const PropertySlot& slot)
174
201
{
175
 
    CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(static_cast<JSCSSVariablesDeclaration*>(asObject(slot.slotBase()))->impl());
 
202
    JSCSSVariablesDeclaration* castedThis = static_cast<JSCSSVariablesDeclaration*>(asObject(slot.slotBase()));
 
203
    UNUSED_PARAM(exec);
 
204
    CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThis->impl());
176
205
    return jsString(exec, imp->cssText());
177
206
}
178
207
 
179
 
JSValuePtr jsCSSVariablesDeclarationLength(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
208
JSValue jsCSSVariablesDeclarationLength(ExecState* exec, const Identifier&, const PropertySlot& slot)
180
209
{
181
 
    CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(static_cast<JSCSSVariablesDeclaration*>(asObject(slot.slotBase()))->impl());
 
210
    JSCSSVariablesDeclaration* castedThis = static_cast<JSCSSVariablesDeclaration*>(asObject(slot.slotBase()));
 
211
    UNUSED_PARAM(exec);
 
212
    CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThis->impl());
182
213
    return jsNumber(exec, imp->length());
183
214
}
184
215
 
185
 
JSValuePtr jsCSSVariablesDeclarationParentRule(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
216
JSValue jsCSSVariablesDeclarationParentRule(ExecState* exec, const Identifier&, const PropertySlot& slot)
186
217
{
187
 
    CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(static_cast<JSCSSVariablesDeclaration*>(asObject(slot.slotBase()))->impl());
188
 
    return toJS(exec, WTF::getPtr(imp->parentRule()));
 
218
    JSCSSVariablesDeclaration* castedThis = static_cast<JSCSSVariablesDeclaration*>(asObject(slot.slotBase()));
 
219
    UNUSED_PARAM(exec);
 
220
    CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThis->impl());
 
221
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentRule()));
189
222
}
190
223
 
191
 
JSValuePtr jsCSSVariablesDeclarationConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
224
JSValue jsCSSVariablesDeclarationConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
192
225
{
193
 
    return static_cast<JSCSSVariablesDeclaration*>(asObject(slot.slotBase()))->getConstructor(exec);
 
226
    JSCSSVariablesDeclaration* domObject = static_cast<JSCSSVariablesDeclaration*>(asObject(slot.slotBase()));
 
227
    return JSCSSVariablesDeclaration::getConstructor(exec, domObject->globalObject());
194
228
}
195
 
void JSCSSVariablesDeclaration::put(ExecState* exec, const Identifier& propertyName, JSValuePtr value, PutPropertySlot& slot)
 
229
void JSCSSVariablesDeclaration::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
196
230
{
197
231
    lookupPut<JSCSSVariablesDeclaration, Base>(exec, propertyName, value, &JSCSSVariablesDeclarationTable, this, slot);
198
232
}
199
233
 
200
 
void setJSCSSVariablesDeclarationCssText(ExecState* exec, JSObject* thisObject, JSValuePtr value)
 
234
void setJSCSSVariablesDeclarationCssText(ExecState* exec, JSObject* thisObject, JSValue value)
201
235
{
202
236
    CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(static_cast<JSCSSVariablesDeclaration*>(thisObject)->impl());
203
 
    imp->setCssText(value->toString(exec));
 
237
    imp->setCssText(value.toString(exec));
204
238
}
205
239
 
206
 
void JSCSSVariablesDeclaration::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
 
240
void JSCSSVariablesDeclaration::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
207
241
{
208
242
    for (unsigned i = 0; i < static_cast<CSSVariablesDeclaration*>(impl())->length(); ++i)
209
243
        propertyNames.add(Identifier::from(exec, i));
210
 
     Base::getPropertyNames(exec, propertyNames);
211
 
}
212
 
 
213
 
JSValuePtr JSCSSVariablesDeclaration::getConstructor(ExecState* exec)
214
 
{
215
 
    return getDOMConstructor<JSCSSVariablesDeclarationConstructor>(exec);
216
 
}
217
 
 
218
 
JSValuePtr jsCSSVariablesDeclarationPrototypeFunctionGetVariableValue(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
219
 
{
220
 
    if (!thisValue->isObject(&JSCSSVariablesDeclaration::s_info))
 
244
     Base::getOwnPropertyNames(exec, propertyNames);
 
245
}
 
246
 
 
247
JSValue JSCSSVariablesDeclaration::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
 
248
{
 
249
    return getDOMConstructor<JSCSSVariablesDeclarationConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
 
250
}
 
251
 
 
252
JSValue JSC_HOST_CALL jsCSSVariablesDeclarationPrototypeFunctionGetVariableValue(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
 
253
{
 
254
    UNUSED_PARAM(args);
 
255
    if (!thisValue.inherits(&JSCSSVariablesDeclaration::s_info))
221
256
        return throwError(exec, TypeError);
222
257
    JSCSSVariablesDeclaration* castedThisObj = static_cast<JSCSSVariablesDeclaration*>(asObject(thisValue));
223
258
    CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThisObj->impl());
224
 
    const UString& variableName = args.at(exec, 0)->toString(exec);
225
 
 
226
 
 
227
 
    JSC::JSValuePtr result = jsString(exec, imp->getVariableValue(variableName));
 
259
    const UString& variableName = args.at(0).toString(exec);
 
260
 
 
261
 
 
262
    JSC::JSValue result = jsString(exec, imp->getVariableValue(variableName));
228
263
    return result;
229
264
}
230
265
 
231
 
JSValuePtr jsCSSVariablesDeclarationPrototypeFunctionRemoveVariable(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
 
266
JSValue JSC_HOST_CALL jsCSSVariablesDeclarationPrototypeFunctionRemoveVariable(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
232
267
{
233
 
    if (!thisValue->isObject(&JSCSSVariablesDeclaration::s_info))
 
268
    UNUSED_PARAM(args);
 
269
    if (!thisValue.inherits(&JSCSSVariablesDeclaration::s_info))
234
270
        return throwError(exec, TypeError);
235
271
    JSCSSVariablesDeclaration* castedThisObj = static_cast<JSCSSVariablesDeclaration*>(asObject(thisValue));
236
272
    CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThisObj->impl());
237
273
    ExceptionCode ec = 0;
238
 
    const UString& variableName = args.at(exec, 0)->toString(exec);
239
 
 
240
 
 
241
 
    JSC::JSValuePtr result = jsString(exec, imp->removeVariable(variableName, ec));
 
274
    const UString& variableName = args.at(0).toString(exec);
 
275
 
 
276
 
 
277
    JSC::JSValue result = jsString(exec, imp->removeVariable(variableName, ec));
242
278
    setDOMException(exec, ec);
243
279
    return result;
244
280
}
245
281
 
246
 
JSValuePtr jsCSSVariablesDeclarationPrototypeFunctionSetVariable(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
 
282
JSValue JSC_HOST_CALL jsCSSVariablesDeclarationPrototypeFunctionSetVariable(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
247
283
{
248
 
    if (!thisValue->isObject(&JSCSSVariablesDeclaration::s_info))
 
284
    UNUSED_PARAM(args);
 
285
    if (!thisValue.inherits(&JSCSSVariablesDeclaration::s_info))
249
286
        return throwError(exec, TypeError);
250
287
    JSCSSVariablesDeclaration* castedThisObj = static_cast<JSCSSVariablesDeclaration*>(asObject(thisValue));
251
288
    CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThisObj->impl());
252
289
    ExceptionCode ec = 0;
253
 
    const UString& variableName = args.at(exec, 0)->toString(exec);
254
 
    const UString& value = args.at(exec, 1)->toString(exec);
 
290
    const UString& variableName = args.at(0).toString(exec);
 
291
    const UString& value = args.at(1).toString(exec);
255
292
 
256
293
    imp->setVariable(variableName, value, ec);
257
294
    setDOMException(exec, ec);
258
295
    return jsUndefined();
259
296
}
260
297
 
261
 
JSValuePtr jsCSSVariablesDeclarationPrototypeFunctionItem(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
 
298
JSValue JSC_HOST_CALL jsCSSVariablesDeclarationPrototypeFunctionItem(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
262
299
{
263
 
    if (!thisValue->isObject(&JSCSSVariablesDeclaration::s_info))
 
300
    UNUSED_PARAM(args);
 
301
    if (!thisValue.inherits(&JSCSSVariablesDeclaration::s_info))
264
302
        return throwError(exec, TypeError);
265
303
    JSCSSVariablesDeclaration* castedThisObj = static_cast<JSCSSVariablesDeclaration*>(asObject(thisValue));
266
304
    CSSVariablesDeclaration* imp = static_cast<CSSVariablesDeclaration*>(castedThisObj->impl());
267
 
    unsigned index = args.at(exec, 0)->toInt32(exec);
268
 
 
269
 
 
270
 
    JSC::JSValuePtr result = jsString(exec, imp->item(index));
 
305
    unsigned index = args.at(0).toInt32(exec);
 
306
 
 
307
 
 
308
    JSC::JSValue result = jsString(exec, imp->item(index));
271
309
    return result;
272
310
}
273
311
 
274
312
 
275
 
JSValuePtr JSCSSVariablesDeclaration::indexGetter(ExecState* exec, const Identifier& propertyName, const PropertySlot& slot)
 
313
JSValue JSCSSVariablesDeclaration::indexGetter(ExecState* exec, const Identifier&, const PropertySlot& slot)
276
314
{
277
315
    JSCSSVariablesDeclaration* thisObj = static_cast<JSCSSVariablesDeclaration*>(asObject(slot.slotBase()));
278
316
    return jsStringOrNull(exec, thisObj->impl()->item(slot.index()));
279
317
}
280
 
JSC::JSValuePtr toJS(JSC::ExecState* exec, CSSVariablesDeclaration* object)
 
318
JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, CSSVariablesDeclaration* object)
281
319
{
282
 
    return getDOMObjectWrapper<JSCSSVariablesDeclaration>(exec, object);
 
320
    return getDOMObjectWrapper<JSCSSVariablesDeclaration>(exec, globalObject, object);
283
321
}
284
 
CSSVariablesDeclaration* toCSSVariablesDeclaration(JSC::JSValuePtr value)
 
322
CSSVariablesDeclaration* toCSSVariablesDeclaration(JSC::JSValue value)
285
323
{
286
 
    return value->isObject(&JSCSSVariablesDeclaration::s_info) ? static_cast<JSCSSVariablesDeclaration*>(asObject(value))->impl() : 0;
 
324
    return value.inherits(&JSCSSVariablesDeclaration::s_info) ? static_cast<JSCSSVariablesDeclaration*>(asObject(value))->impl() : 0;
287
325
}
288
326
 
289
327
}