|
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 "JSCSSStyleDeclaration.h" |
|
23 |
|
24 #include "AtomicString.h" |
|
25 #include "CSSRule.h" |
|
26 #include "CSSStyleDeclaration.h" |
|
27 #include "CSSValue.h" |
|
28 #include "JSCSSRule.h" |
|
29 #include "JSCSSStyleDeclarationCustom.h" |
|
30 #include "JSCSSValue.h" |
|
31 #include "KURL.h" |
|
32 #include <runtime/Error.h> |
|
33 #include <runtime/JSNumberCell.h> |
|
34 #include <runtime/JSString.h> |
|
35 #include <runtime/PropertyNameArray.h> |
|
36 #include <wtf/GetPtr.h> |
|
37 |
|
38 using namespace JSC; |
|
39 |
|
40 namespace WebCore { |
|
41 |
|
42 ASSERT_CLASS_FITS_IN_CELL(JSCSSStyleDeclaration); |
|
43 |
|
44 /* Hash table */ |
|
45 #if ENABLE(JIT) |
|
46 #define THUNK_GENERATOR(generator) , generator |
|
47 #else |
|
48 #define THUNK_GENERATOR(generator) |
|
49 #endif |
|
50 |
|
51 static const HashTableValue JSCSSStyleDeclarationTableValues[5] = |
|
52 { |
|
53 { "cssText", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSStyleDeclarationCssText), (intptr_t)setJSCSSStyleDeclarationCssText THUNK_GENERATOR(0) }, |
|
54 { "length", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSStyleDeclarationLength), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
55 { "parentRule", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSStyleDeclarationParentRule), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
56 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSStyleDeclarationConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
57 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
58 }; |
|
59 |
|
60 #undef THUNK_GENERATOR |
|
61 static JSC_CONST_HASHTABLE HashTable JSCSSStyleDeclarationTable = { 10, 7, JSCSSStyleDeclarationTableValues, 0 }; |
|
62 /* Hash table for constructor */ |
|
63 #if ENABLE(JIT) |
|
64 #define THUNK_GENERATOR(generator) , generator |
|
65 #else |
|
66 #define THUNK_GENERATOR(generator) |
|
67 #endif |
|
68 |
|
69 static const HashTableValue JSCSSStyleDeclarationConstructorTableValues[1] = |
|
70 { |
|
71 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
72 }; |
|
73 |
|
74 #undef THUNK_GENERATOR |
|
75 static JSC_CONST_HASHTABLE HashTable JSCSSStyleDeclarationConstructorTable = { 1, 0, JSCSSStyleDeclarationConstructorTableValues, 0 }; |
|
76 class JSCSSStyleDeclarationConstructor : public DOMConstructorObject { |
|
77 public: |
|
78 JSCSSStyleDeclarationConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
79 |
|
80 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
81 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
82 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
83 static const JSC::ClassInfo s_info; |
|
84 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
85 { |
|
86 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
87 } |
|
88 protected: |
|
89 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
90 }; |
|
91 |
|
92 const ClassInfo JSCSSStyleDeclarationConstructor::s_info = { "CSSStyleDeclarationConstructor", 0, &JSCSSStyleDeclarationConstructorTable, 0 }; |
|
93 |
|
94 JSCSSStyleDeclarationConstructor::JSCSSStyleDeclarationConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
95 : DOMConstructorObject(JSCSSStyleDeclarationConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
96 { |
|
97 putDirect(exec->propertyNames().prototype, JSCSSStyleDeclarationPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
98 } |
|
99 |
|
100 bool JSCSSStyleDeclarationConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
101 { |
|
102 return getStaticValueSlot<JSCSSStyleDeclarationConstructor, DOMObject>(exec, &JSCSSStyleDeclarationConstructorTable, this, propertyName, slot); |
|
103 } |
|
104 |
|
105 bool JSCSSStyleDeclarationConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
106 { |
|
107 return getStaticValueDescriptor<JSCSSStyleDeclarationConstructor, DOMObject>(exec, &JSCSSStyleDeclarationConstructorTable, this, propertyName, descriptor); |
|
108 } |
|
109 |
|
110 /* Hash table for prototype */ |
|
111 #if ENABLE(JIT) |
|
112 #define THUNK_GENERATOR(generator) , generator |
|
113 #else |
|
114 #define THUNK_GENERATOR(generator) |
|
115 #endif |
|
116 |
|
117 static const HashTableValue JSCSSStyleDeclarationPrototypeTableValues[9] = |
|
118 { |
|
119 { "getPropertyValue", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsCSSStyleDeclarationPrototypeFunctionGetPropertyValue), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
120 { "getPropertyCSSValue", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsCSSStyleDeclarationPrototypeFunctionGetPropertyCSSValue), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
121 { "removeProperty", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsCSSStyleDeclarationPrototypeFunctionRemoveProperty), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
122 { "getPropertyPriority", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsCSSStyleDeclarationPrototypeFunctionGetPropertyPriority), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
123 { "setProperty", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsCSSStyleDeclarationPrototypeFunctionSetProperty), (intptr_t)3 THUNK_GENERATOR(0) }, |
|
124 { "item", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsCSSStyleDeclarationPrototypeFunctionItem), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
125 { "getPropertyShorthand", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsCSSStyleDeclarationPrototypeFunctionGetPropertyShorthand), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
126 { "isPropertyImplicit", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsCSSStyleDeclarationPrototypeFunctionIsPropertyImplicit), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
127 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
128 }; |
|
129 |
|
130 #undef THUNK_GENERATOR |
|
131 static JSC_CONST_HASHTABLE HashTable JSCSSStyleDeclarationPrototypeTable = { 17, 15, JSCSSStyleDeclarationPrototypeTableValues, 0 }; |
|
132 const ClassInfo JSCSSStyleDeclarationPrototype::s_info = { "CSSStyleDeclarationPrototype", 0, &JSCSSStyleDeclarationPrototypeTable, 0 }; |
|
133 |
|
134 JSObject* JSCSSStyleDeclarationPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
135 { |
|
136 return getDOMPrototype<JSCSSStyleDeclaration>(exec, globalObject); |
|
137 } |
|
138 |
|
139 bool JSCSSStyleDeclarationPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
140 { |
|
141 return getStaticFunctionSlot<JSObject>(exec, &JSCSSStyleDeclarationPrototypeTable, this, propertyName, slot); |
|
142 } |
|
143 |
|
144 bool JSCSSStyleDeclarationPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
145 { |
|
146 return getStaticFunctionDescriptor<JSObject>(exec, &JSCSSStyleDeclarationPrototypeTable, this, propertyName, descriptor); |
|
147 } |
|
148 |
|
149 const ClassInfo JSCSSStyleDeclaration::s_info = { "CSSStyleDeclaration", 0, &JSCSSStyleDeclarationTable, 0 }; |
|
150 |
|
151 JSCSSStyleDeclaration::JSCSSStyleDeclaration(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<CSSStyleDeclaration> impl) |
|
152 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
153 , m_impl(impl) |
|
154 { |
|
155 } |
|
156 |
|
157 JSCSSStyleDeclaration::~JSCSSStyleDeclaration() |
|
158 { |
|
159 forgetDOMObject(this, impl()); |
|
160 } |
|
161 |
|
162 JSObject* JSCSSStyleDeclaration::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
163 { |
|
164 return new (exec) JSCSSStyleDeclarationPrototype(globalObject, JSCSSStyleDeclarationPrototype::createStructure(globalObject->objectPrototype())); |
|
165 } |
|
166 |
|
167 bool JSCSSStyleDeclaration::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
168 { |
|
169 const HashEntry* entry = JSCSSStyleDeclarationTable.entry(exec, propertyName); |
|
170 if (entry) { |
|
171 slot.setCustom(this, entry->propertyGetter()); |
|
172 return true; |
|
173 } |
|
174 bool ok; |
|
175 unsigned index = propertyName.toUInt32(&ok, false); |
|
176 if (ok) { |
|
177 slot.setCustomIndex(this, index, indexGetter); |
|
178 return true; |
|
179 } |
|
180 if (canGetItemsForName(exec, static_cast<CSSStyleDeclaration*>(impl()), propertyName)) { |
|
181 slot.setCustom(this, nameGetter); |
|
182 return true; |
|
183 } |
|
184 return getStaticValueSlot<JSCSSStyleDeclaration, Base>(exec, &JSCSSStyleDeclarationTable, this, propertyName, slot); |
|
185 } |
|
186 |
|
187 bool JSCSSStyleDeclaration::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
188 { |
|
189 const HashEntry* entry = JSCSSStyleDeclarationTable.entry(exec, propertyName); |
|
190 if (entry) { |
|
191 PropertySlot slot; |
|
192 slot.setCustom(this, entry->propertyGetter()); |
|
193 descriptor.setDescriptor(slot.getValue(exec, propertyName), entry->attributes()); |
|
194 return true; |
|
195 } |
|
196 bool ok; |
|
197 unsigned index = propertyName.toUInt32(&ok, false); |
|
198 if (ok && index < static_cast<CSSStyleDeclaration*>(impl())->length()) { |
|
199 PropertySlot slot; |
|
200 slot.setCustomIndex(this, index, indexGetter); |
|
201 descriptor.setDescriptor(slot.getValue(exec, propertyName), DontDelete | ReadOnly); |
|
202 return true; |
|
203 } |
|
204 if (canGetItemsForName(exec, static_cast<CSSStyleDeclaration*>(impl()), propertyName)) { |
|
205 PropertySlot slot; |
|
206 slot.setCustom(this, nameGetter); |
|
207 descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum); |
|
208 return true; |
|
209 } |
|
210 return getStaticValueDescriptor<JSCSSStyleDeclaration, Base>(exec, &JSCSSStyleDeclarationTable, this, propertyName, descriptor); |
|
211 } |
|
212 |
|
213 bool JSCSSStyleDeclaration::getOwnPropertySlot(ExecState* exec, unsigned propertyName, PropertySlot& slot) |
|
214 { |
|
215 if (propertyName < static_cast<CSSStyleDeclaration*>(impl())->length()) { |
|
216 slot.setCustomIndex(this, propertyName, indexGetter); |
|
217 return true; |
|
218 } |
|
219 return getOwnPropertySlot(exec, Identifier::from(exec, propertyName), slot); |
|
220 } |
|
221 |
|
222 JSValue jsCSSStyleDeclarationCssText(ExecState* exec, JSValue slotBase, const Identifier&) |
|
223 { |
|
224 JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(slotBase)); |
|
225 UNUSED_PARAM(exec); |
|
226 CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl()); |
|
227 JSValue result = jsStringOrNull(exec, imp->cssText()); |
|
228 return result; |
|
229 } |
|
230 |
|
231 JSValue jsCSSStyleDeclarationLength(ExecState* exec, JSValue slotBase, const Identifier&) |
|
232 { |
|
233 JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(slotBase)); |
|
234 UNUSED_PARAM(exec); |
|
235 CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl()); |
|
236 JSValue result = jsNumber(exec, imp->length()); |
|
237 return result; |
|
238 } |
|
239 |
|
240 JSValue jsCSSStyleDeclarationParentRule(ExecState* exec, JSValue slotBase, const Identifier&) |
|
241 { |
|
242 JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(slotBase)); |
|
243 UNUSED_PARAM(exec); |
|
244 CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl()); |
|
245 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentRule())); |
|
246 return result; |
|
247 } |
|
248 |
|
249 JSValue jsCSSStyleDeclarationConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
250 { |
|
251 JSCSSStyleDeclaration* domObject = static_cast<JSCSSStyleDeclaration*>(asObject(slotBase)); |
|
252 return JSCSSStyleDeclaration::getConstructor(exec, domObject->globalObject()); |
|
253 } |
|
254 void JSCSSStyleDeclaration::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
|
255 { |
|
256 if (putDelegate(exec, propertyName, value, slot)) |
|
257 return; |
|
258 lookupPut<JSCSSStyleDeclaration, Base>(exec, propertyName, value, &JSCSSStyleDeclarationTable, this, slot); |
|
259 } |
|
260 |
|
261 void setJSCSSStyleDeclarationCssText(ExecState* exec, JSObject* thisObject, JSValue value) |
|
262 { |
|
263 JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(thisObject); |
|
264 CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl()); |
|
265 ExceptionCode ec = 0; |
|
266 imp->setCssText(valueToStringWithNullCheck(exec, value), ec); |
|
267 setDOMException(exec, ec); |
|
268 } |
|
269 |
|
270 void JSCSSStyleDeclaration::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) |
|
271 { |
|
272 for (unsigned i = 0; i < static_cast<CSSStyleDeclaration*>(impl())->length(); ++i) |
|
273 propertyNames.add(Identifier::from(exec, i)); |
|
274 Base::getOwnPropertyNames(exec, propertyNames, mode); |
|
275 } |
|
276 |
|
277 JSValue JSCSSStyleDeclaration::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
278 { |
|
279 return getDOMConstructor<JSCSSStyleDeclarationConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
280 } |
|
281 |
|
282 EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionGetPropertyValue(ExecState* exec) |
|
283 { |
|
284 JSValue thisValue = exec->hostThisValue(); |
|
285 if (!thisValue.inherits(&JSCSSStyleDeclaration::s_info)) |
|
286 return throwVMTypeError(exec); |
|
287 JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(thisValue)); |
|
288 CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl()); |
|
289 const String& propertyName = ustringToString(exec->argument(0).toString(exec)); |
|
290 |
|
291 |
|
292 JSC::JSValue result = jsStringOrNull(exec, imp->getPropertyValue(propertyName)); |
|
293 return JSValue::encode(result); |
|
294 } |
|
295 |
|
296 EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionGetPropertyCSSValue(ExecState* exec) |
|
297 { |
|
298 JSValue thisValue = exec->hostThisValue(); |
|
299 if (!thisValue.inherits(&JSCSSStyleDeclaration::s_info)) |
|
300 return throwVMTypeError(exec); |
|
301 JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(thisValue)); |
|
302 CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl()); |
|
303 const String& propertyName = ustringToString(exec->argument(0).toString(exec)); |
|
304 |
|
305 |
|
306 JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->getPropertyCSSValue(propertyName))); |
|
307 return JSValue::encode(result); |
|
308 } |
|
309 |
|
310 EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionRemoveProperty(ExecState* exec) |
|
311 { |
|
312 JSValue thisValue = exec->hostThisValue(); |
|
313 if (!thisValue.inherits(&JSCSSStyleDeclaration::s_info)) |
|
314 return throwVMTypeError(exec); |
|
315 JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(thisValue)); |
|
316 CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl()); |
|
317 ExceptionCode ec = 0; |
|
318 const String& propertyName = ustringToString(exec->argument(0).toString(exec)); |
|
319 |
|
320 |
|
321 JSC::JSValue result = jsStringOrNull(exec, imp->removeProperty(propertyName, ec)); |
|
322 setDOMException(exec, ec); |
|
323 return JSValue::encode(result); |
|
324 } |
|
325 |
|
326 EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionGetPropertyPriority(ExecState* exec) |
|
327 { |
|
328 JSValue thisValue = exec->hostThisValue(); |
|
329 if (!thisValue.inherits(&JSCSSStyleDeclaration::s_info)) |
|
330 return throwVMTypeError(exec); |
|
331 JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(thisValue)); |
|
332 CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl()); |
|
333 const String& propertyName = ustringToString(exec->argument(0).toString(exec)); |
|
334 |
|
335 |
|
336 JSC::JSValue result = jsStringOrNull(exec, imp->getPropertyPriority(propertyName)); |
|
337 return JSValue::encode(result); |
|
338 } |
|
339 |
|
340 EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionSetProperty(ExecState* exec) |
|
341 { |
|
342 JSValue thisValue = exec->hostThisValue(); |
|
343 if (!thisValue.inherits(&JSCSSStyleDeclaration::s_info)) |
|
344 return throwVMTypeError(exec); |
|
345 JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(thisValue)); |
|
346 CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl()); |
|
347 ExceptionCode ec = 0; |
|
348 const String& propertyName = ustringToString(exec->argument(0).toString(exec)); |
|
349 const String& value = valueToStringWithNullCheck(exec, exec->argument(1)); |
|
350 const String& priority = ustringToString(exec->argument(2).toString(exec)); |
|
351 |
|
352 imp->setProperty(propertyName, value, priority, ec); |
|
353 setDOMException(exec, ec); |
|
354 return JSValue::encode(jsUndefined()); |
|
355 } |
|
356 |
|
357 EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionItem(ExecState* exec) |
|
358 { |
|
359 JSValue thisValue = exec->hostThisValue(); |
|
360 if (!thisValue.inherits(&JSCSSStyleDeclaration::s_info)) |
|
361 return throwVMTypeError(exec); |
|
362 JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(thisValue)); |
|
363 CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl()); |
|
364 unsigned index = exec->argument(0).toInt32(exec); |
|
365 |
|
366 |
|
367 JSC::JSValue result = jsString(exec, imp->item(index)); |
|
368 return JSValue::encode(result); |
|
369 } |
|
370 |
|
371 EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionGetPropertyShorthand(ExecState* exec) |
|
372 { |
|
373 JSValue thisValue = exec->hostThisValue(); |
|
374 if (!thisValue.inherits(&JSCSSStyleDeclaration::s_info)) |
|
375 return throwVMTypeError(exec); |
|
376 JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(thisValue)); |
|
377 CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl()); |
|
378 const String& propertyName = ustringToString(exec->argument(0).toString(exec)); |
|
379 |
|
380 |
|
381 JSC::JSValue result = jsStringOrNull(exec, imp->getPropertyShorthand(propertyName)); |
|
382 return JSValue::encode(result); |
|
383 } |
|
384 |
|
385 EncodedJSValue JSC_HOST_CALL jsCSSStyleDeclarationPrototypeFunctionIsPropertyImplicit(ExecState* exec) |
|
386 { |
|
387 JSValue thisValue = exec->hostThisValue(); |
|
388 if (!thisValue.inherits(&JSCSSStyleDeclaration::s_info)) |
|
389 return throwVMTypeError(exec); |
|
390 JSCSSStyleDeclaration* castedThis = static_cast<JSCSSStyleDeclaration*>(asObject(thisValue)); |
|
391 CSSStyleDeclaration* imp = static_cast<CSSStyleDeclaration*>(castedThis->impl()); |
|
392 const String& propertyName = ustringToString(exec->argument(0).toString(exec)); |
|
393 |
|
394 |
|
395 JSC::JSValue result = jsBoolean(imp->isPropertyImplicit(propertyName)); |
|
396 return JSValue::encode(result); |
|
397 } |
|
398 |
|
399 |
|
400 JSValue JSCSSStyleDeclaration::indexGetter(ExecState* exec, JSValue slotBase, unsigned index) |
|
401 { |
|
402 JSCSSStyleDeclaration* thisObj = static_cast<JSCSSStyleDeclaration*>(asObject(slotBase)); |
|
403 return jsStringOrNull(exec, thisObj->impl()->item(index)); |
|
404 } |
|
405 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, CSSStyleDeclaration* object) |
|
406 { |
|
407 return getDOMObjectWrapper<JSCSSStyleDeclaration>(exec, globalObject, object); |
|
408 } |
|
409 CSSStyleDeclaration* toCSSStyleDeclaration(JSC::JSValue value) |
|
410 { |
|
411 return value.inherits(&JSCSSStyleDeclaration::s_info) ? static_cast<JSCSSStyleDeclaration*>(asObject(value))->impl() : 0; |
|
412 } |
|
413 |
|
414 } |