|
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 "JSCSSValue.h" |
|
23 |
|
24 #include "CSSValue.h" |
|
25 #include "KURL.h" |
|
26 #include <runtime/JSNumberCell.h> |
|
27 #include <wtf/GetPtr.h> |
|
28 |
|
29 using namespace JSC; |
|
30 |
|
31 namespace WebCore { |
|
32 |
|
33 ASSERT_CLASS_FITS_IN_CELL(JSCSSValue); |
|
34 |
|
35 /* Hash table */ |
|
36 #if ENABLE(JIT) |
|
37 #define THUNK_GENERATOR(generator) , generator |
|
38 #else |
|
39 #define THUNK_GENERATOR(generator) |
|
40 #endif |
|
41 |
|
42 static const HashTableValue JSCSSValueTableValues[4] = |
|
43 { |
|
44 { "cssText", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSValueCssText), (intptr_t)setJSCSSValueCssText THUNK_GENERATOR(0) }, |
|
45 { "cssValueType", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSValueCssValueType), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
46 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSValueConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
47 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
48 }; |
|
49 |
|
50 #undef THUNK_GENERATOR |
|
51 static JSC_CONST_HASHTABLE HashTable JSCSSValueTable = { 8, 7, JSCSSValueTableValues, 0 }; |
|
52 /* Hash table for constructor */ |
|
53 #if ENABLE(JIT) |
|
54 #define THUNK_GENERATOR(generator) , generator |
|
55 #else |
|
56 #define THUNK_GENERATOR(generator) |
|
57 #endif |
|
58 |
|
59 static const HashTableValue JSCSSValueConstructorTableValues[5] = |
|
60 { |
|
61 { "CSS_INHERIT", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSValueCSS_INHERIT), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
62 { "CSS_PRIMITIVE_VALUE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSValueCSS_PRIMITIVE_VALUE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
63 { "CSS_VALUE_LIST", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSValueCSS_VALUE_LIST), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
64 { "CSS_CUSTOM", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSValueCSS_CUSTOM), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
65 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
66 }; |
|
67 |
|
68 #undef THUNK_GENERATOR |
|
69 static JSC_CONST_HASHTABLE HashTable JSCSSValueConstructorTable = { 8, 7, JSCSSValueConstructorTableValues, 0 }; |
|
70 |
|
71 COMPILE_ASSERT(0 == CSSValue::CSS_INHERIT, CSSValueEnumCSS_INHERITIsWrongUseDontCheckEnums); |
|
72 COMPILE_ASSERT(1 == CSSValue::CSS_PRIMITIVE_VALUE, CSSValueEnumCSS_PRIMITIVE_VALUEIsWrongUseDontCheckEnums); |
|
73 COMPILE_ASSERT(2 == CSSValue::CSS_VALUE_LIST, CSSValueEnumCSS_VALUE_LISTIsWrongUseDontCheckEnums); |
|
74 COMPILE_ASSERT(3 == CSSValue::CSS_CUSTOM, CSSValueEnumCSS_CUSTOMIsWrongUseDontCheckEnums); |
|
75 |
|
76 class JSCSSValueConstructor : public DOMConstructorObject { |
|
77 public: |
|
78 JSCSSValueConstructor(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 JSCSSValueConstructor::s_info = { "CSSValueConstructor", 0, &JSCSSValueConstructorTable, 0 }; |
|
93 |
|
94 JSCSSValueConstructor::JSCSSValueConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
95 : DOMConstructorObject(JSCSSValueConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
96 { |
|
97 putDirect(exec->propertyNames().prototype, JSCSSValuePrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
98 } |
|
99 |
|
100 bool JSCSSValueConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
101 { |
|
102 return getStaticValueSlot<JSCSSValueConstructor, DOMObject>(exec, &JSCSSValueConstructorTable, this, propertyName, slot); |
|
103 } |
|
104 |
|
105 bool JSCSSValueConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
106 { |
|
107 return getStaticValueDescriptor<JSCSSValueConstructor, DOMObject>(exec, &JSCSSValueConstructorTable, 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 JSCSSValuePrototypeTableValues[5] = |
|
118 { |
|
119 { "CSS_INHERIT", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSValueCSS_INHERIT), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
120 { "CSS_PRIMITIVE_VALUE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSValueCSS_PRIMITIVE_VALUE), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
121 { "CSS_VALUE_LIST", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSValueCSS_VALUE_LIST), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
122 { "CSS_CUSTOM", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSValueCSS_CUSTOM), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
123 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
124 }; |
|
125 |
|
126 #undef THUNK_GENERATOR |
|
127 static JSC_CONST_HASHTABLE HashTable JSCSSValuePrototypeTable = { 8, 7, JSCSSValuePrototypeTableValues, 0 }; |
|
128 const ClassInfo JSCSSValuePrototype::s_info = { "CSSValuePrototype", 0, &JSCSSValuePrototypeTable, 0 }; |
|
129 |
|
130 JSObject* JSCSSValuePrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
131 { |
|
132 return getDOMPrototype<JSCSSValue>(exec, globalObject); |
|
133 } |
|
134 |
|
135 bool JSCSSValuePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
136 { |
|
137 return getStaticValueSlot<JSCSSValuePrototype, JSObject>(exec, &JSCSSValuePrototypeTable, this, propertyName, slot); |
|
138 } |
|
139 |
|
140 bool JSCSSValuePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
141 { |
|
142 return getStaticValueDescriptor<JSCSSValuePrototype, JSObject>(exec, &JSCSSValuePrototypeTable, this, propertyName, descriptor); |
|
143 } |
|
144 |
|
145 const ClassInfo JSCSSValue::s_info = { "CSSValue", 0, &JSCSSValueTable, 0 }; |
|
146 |
|
147 JSCSSValue::JSCSSValue(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<CSSValue> impl) |
|
148 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
149 , m_impl(impl) |
|
150 { |
|
151 } |
|
152 |
|
153 JSCSSValue::~JSCSSValue() |
|
154 { |
|
155 forgetDOMObject(this, impl()); |
|
156 } |
|
157 |
|
158 JSObject* JSCSSValue::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
159 { |
|
160 return new (exec) JSCSSValuePrototype(globalObject, JSCSSValuePrototype::createStructure(globalObject->objectPrototype())); |
|
161 } |
|
162 |
|
163 bool JSCSSValue::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
164 { |
|
165 return getStaticValueSlot<JSCSSValue, Base>(exec, &JSCSSValueTable, this, propertyName, slot); |
|
166 } |
|
167 |
|
168 bool JSCSSValue::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
169 { |
|
170 return getStaticValueDescriptor<JSCSSValue, Base>(exec, &JSCSSValueTable, this, propertyName, descriptor); |
|
171 } |
|
172 |
|
173 JSValue jsCSSValueCssText(ExecState* exec, JSValue slotBase, const Identifier&) |
|
174 { |
|
175 JSCSSValue* castedThis = static_cast<JSCSSValue*>(asObject(slotBase)); |
|
176 UNUSED_PARAM(exec); |
|
177 CSSValue* imp = static_cast<CSSValue*>(castedThis->impl()); |
|
178 JSValue result = jsStringOrNull(exec, imp->cssText()); |
|
179 return result; |
|
180 } |
|
181 |
|
182 JSValue jsCSSValueCssValueType(ExecState* exec, JSValue slotBase, const Identifier&) |
|
183 { |
|
184 JSCSSValue* castedThis = static_cast<JSCSSValue*>(asObject(slotBase)); |
|
185 UNUSED_PARAM(exec); |
|
186 CSSValue* imp = static_cast<CSSValue*>(castedThis->impl()); |
|
187 JSValue result = jsNumber(exec, imp->cssValueType()); |
|
188 return result; |
|
189 } |
|
190 |
|
191 JSValue jsCSSValueConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
192 { |
|
193 JSCSSValue* domObject = static_cast<JSCSSValue*>(asObject(slotBase)); |
|
194 return JSCSSValue::getConstructor(exec, domObject->globalObject()); |
|
195 } |
|
196 void JSCSSValue::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
|
197 { |
|
198 lookupPut<JSCSSValue, Base>(exec, propertyName, value, &JSCSSValueTable, this, slot); |
|
199 } |
|
200 |
|
201 void setJSCSSValueCssText(ExecState* exec, JSObject* thisObject, JSValue value) |
|
202 { |
|
203 JSCSSValue* castedThis = static_cast<JSCSSValue*>(thisObject); |
|
204 CSSValue* imp = static_cast<CSSValue*>(castedThis->impl()); |
|
205 ExceptionCode ec = 0; |
|
206 imp->setCssText(valueToStringWithNullCheck(exec, value), ec); |
|
207 setDOMException(exec, ec); |
|
208 } |
|
209 |
|
210 JSValue JSCSSValue::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
211 { |
|
212 return getDOMConstructor<JSCSSValueConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
213 } |
|
214 |
|
215 // Constant getters |
|
216 |
|
217 JSValue jsCSSValueCSS_INHERIT(ExecState* exec, JSValue, const Identifier&) |
|
218 { |
|
219 return jsNumber(exec, static_cast<int>(0)); |
|
220 } |
|
221 |
|
222 JSValue jsCSSValueCSS_PRIMITIVE_VALUE(ExecState* exec, JSValue, const Identifier&) |
|
223 { |
|
224 return jsNumber(exec, static_cast<int>(1)); |
|
225 } |
|
226 |
|
227 JSValue jsCSSValueCSS_VALUE_LIST(ExecState* exec, JSValue, const Identifier&) |
|
228 { |
|
229 return jsNumber(exec, static_cast<int>(2)); |
|
230 } |
|
231 |
|
232 JSValue jsCSSValueCSS_CUSTOM(ExecState* exec, JSValue, const Identifier&) |
|
233 { |
|
234 return jsNumber(exec, static_cast<int>(3)); |
|
235 } |
|
236 |
|
237 CSSValue* toCSSValue(JSC::JSValue value) |
|
238 { |
|
239 return value.inherits(&JSCSSValue::s_info) ? static_cast<JSCSSValue*>(asObject(value))->impl() : 0; |
|
240 } |
|
241 |
|
242 } |