|
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 |
|
23 #include "JSCSSPrimitiveValue.h" |
|
24 |
|
25 #include <wtf/GetPtr.h> |
|
26 |
|
27 #include "CSSPrimitiveValue.h" |
|
28 #include "Counter.h" |
|
29 #include "JSCounter.h" |
|
30 #include "JSRect.h" |
|
31 #include "PlatformString.h" |
|
32 #include "Rect.h" |
|
33 #include "kjs_css.h" |
|
34 |
|
35 using namespace KJS; |
|
36 |
|
37 namespace WebCore { |
|
38 |
|
39 /* Hash table */ |
|
40 |
|
41 static const HashEntry JSCSSPrimitiveValueTableEntries[] = |
|
42 { |
|
43 { "primitiveType", JSCSSPrimitiveValue::PrimitiveTypeAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
44 { "constructor", JSCSSPrimitiveValue::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 } |
|
45 }; |
|
46 |
|
47 static const HashTable JSCSSPrimitiveValueTable = |
|
48 { |
|
49 2, 2, JSCSSPrimitiveValueTableEntries, 2 |
|
50 }; |
|
51 |
|
52 /* Hash table for constructor */ |
|
53 |
|
54 static const HashEntry JSCSSPrimitiveValueConstructorTableEntries[] = |
|
55 { |
|
56 { "CSS_IN", CSSPrimitiveValue::CSS_IN, DontDelete|ReadOnly, 0, 0 }, |
|
57 { "CSS_EMS", CSSPrimitiveValue::CSS_EMS, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValueConstructorTableEntries[28] }, |
|
58 { "CSS_EXS", CSSPrimitiveValue::CSS_EXS, DontDelete|ReadOnly, 0, 0 }, |
|
59 { "CSS_RAD", CSSPrimitiveValue::CSS_RAD, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValueConstructorTableEntries[34] }, |
|
60 { 0, 0, 0, 0, 0 }, |
|
61 { 0, 0, 0, 0, 0 }, |
|
62 { "CSS_KHZ", CSSPrimitiveValue::CSS_KHZ, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValueConstructorTableEntries[33] }, |
|
63 { "CSS_PX", CSSPrimitiveValue::CSS_PX, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValueConstructorTableEntries[32] }, |
|
64 { "CSS_CM", CSSPrimitiveValue::CSS_CM, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValueConstructorTableEntries[29] }, |
|
65 { "CSS_S", CSSPrimitiveValue::CSS_S, DontDelete|ReadOnly, 0, 0 }, |
|
66 { "CSS_DIMENSION", CSSPrimitiveValue::CSS_DIMENSION, DontDelete|ReadOnly, 0, 0 }, |
|
67 { "CSS_UNKNOWN", CSSPrimitiveValue::CSS_UNKNOWN, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValueConstructorTableEntries[26] }, |
|
68 { "CSS_GRAD", CSSPrimitiveValue::CSS_GRAD, DontDelete|ReadOnly, 0, 0 }, |
|
69 { 0, 0, 0, 0, 0 }, |
|
70 { "CSS_IDENT", CSSPrimitiveValue::CSS_IDENT, DontDelete|ReadOnly, 0, 0 }, |
|
71 { 0, 0, 0, 0, 0 }, |
|
72 { "CSS_URI", CSSPrimitiveValue::CSS_URI, DontDelete|ReadOnly, 0, 0 }, |
|
73 { 0, 0, 0, 0, 0 }, |
|
74 { "CSS_NUMBER", CSSPrimitiveValue::CSS_NUMBER, DontDelete|ReadOnly, 0, 0 }, |
|
75 { 0, 0, 0, 0, 0 }, |
|
76 { 0, 0, 0, 0, 0 }, |
|
77 { 0, 0, 0, 0, 0 }, |
|
78 { "CSS_COUNTER", CSSPrimitiveValue::CSS_COUNTER, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValueConstructorTableEntries[35] }, |
|
79 { "CSS_PERCENTAGE", CSSPrimitiveValue::CSS_PERCENTAGE, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValueConstructorTableEntries[27] }, |
|
80 { 0, 0, 0, 0, 0 }, |
|
81 { 0, 0, 0, 0, 0 }, |
|
82 { "CSS_MM", CSSPrimitiveValue::CSS_MM, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValueConstructorTableEntries[30] }, |
|
83 { "CSS_PT", CSSPrimitiveValue::CSS_PT, DontDelete|ReadOnly, 0, 0 }, |
|
84 { "CSS_PC", CSSPrimitiveValue::CSS_PC, DontDelete|ReadOnly, 0, 0 }, |
|
85 { "CSS_DEG", CSSPrimitiveValue::CSS_DEG, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValueConstructorTableEntries[31] }, |
|
86 { "CSS_MS", CSSPrimitiveValue::CSS_MS, DontDelete|ReadOnly, 0, 0 }, |
|
87 { "CSS_HZ", CSSPrimitiveValue::CSS_HZ, DontDelete|ReadOnly, 0, 0 }, |
|
88 { "CSS_STRING", CSSPrimitiveValue::CSS_STRING, DontDelete|ReadOnly, 0, 0 }, |
|
89 { "CSS_ATTR", CSSPrimitiveValue::CSS_ATTR, DontDelete|ReadOnly, 0, 0 }, |
|
90 { "CSS_RECT", CSSPrimitiveValue::CSS_RECT, DontDelete|ReadOnly, 0, 0 }, |
|
91 { "CSS_RGBCOLOR", CSSPrimitiveValue::CSS_RGBCOLOR, DontDelete|ReadOnly, 0, 0 } |
|
92 }; |
|
93 |
|
94 static const HashTable JSCSSPrimitiveValueConstructorTable = |
|
95 { |
|
96 2, 36, JSCSSPrimitiveValueConstructorTableEntries, 26 |
|
97 }; |
|
98 |
|
99 class JSCSSPrimitiveValueConstructor : public DOMObject { |
|
100 public: |
|
101 JSCSSPrimitiveValueConstructor(ExecState* exec) |
|
102 { |
|
103 setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype()); |
|
104 putDirect(exec->propertyNames().prototype, JSCSSPrimitiveValuePrototype::self(exec), None); |
|
105 } |
|
106 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); |
|
107 JSValue* getValueProperty(ExecState*, int token) const; |
|
108 virtual const ClassInfo* classInfo() const { return &info; } |
|
109 static const ClassInfo info; |
|
110 |
|
111 virtual bool implementsHasInstance() const { return true; } |
|
112 }; |
|
113 |
|
114 const ClassInfo JSCSSPrimitiveValueConstructor::info = { "CSSPrimitiveValueConstructor", 0, &JSCSSPrimitiveValueConstructorTable, 0 }; |
|
115 |
|
116 bool JSCSSPrimitiveValueConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
117 { |
|
118 return getStaticValueSlot<JSCSSPrimitiveValueConstructor, DOMObject>(exec, &JSCSSPrimitiveValueConstructorTable, this, propertyName, slot); |
|
119 } |
|
120 |
|
121 JSValue* JSCSSPrimitiveValueConstructor::getValueProperty(ExecState*, int token) const |
|
122 { |
|
123 // The token is the numeric value of its associated constant |
|
124 return jsNumber(token); |
|
125 } |
|
126 |
|
127 /* Hash table for prototype */ |
|
128 |
|
129 static const HashEntry JSCSSPrimitiveValuePrototypeTableEntries[] = |
|
130 { |
|
131 { "getStringValue", JSCSSPrimitiveValue::GetStringValueFuncNum, DontDelete|Function, 0, 0 }, |
|
132 { "CSS_RECT", CSSPrimitiveValue::CSS_RECT, DontDelete|ReadOnly, 0, 0 }, |
|
133 { "CSS_IDENT", CSSPrimitiveValue::CSS_IDENT, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValuePrototypeTableEntries[42] }, |
|
134 { 0, 0, 0, 0, 0 }, |
|
135 { 0, 0, 0, 0, 0 }, |
|
136 { "getRGBColorValue", JSCSSPrimitiveValue::GetRGBColorValueFuncNum, DontDelete|Function, 0, 0 }, |
|
137 { "CSS_PX", CSSPrimitiveValue::CSS_PX, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValuePrototypeTableEntries[37] }, |
|
138 { 0, 0, 0, 0, 0 }, |
|
139 { "CSS_UNKNOWN", CSSPrimitiveValue::CSS_UNKNOWN, DontDelete|ReadOnly, 0, 0 }, |
|
140 { 0, 0, 0, 0, 0 }, |
|
141 { "CSS_URI", CSSPrimitiveValue::CSS_URI, DontDelete|ReadOnly, 0, 0 }, |
|
142 { 0, 0, 0, 0, 0 }, |
|
143 { "CSS_NUMBER", CSSPrimitiveValue::CSS_NUMBER, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValuePrototypeTableEntries[33] }, |
|
144 { "CSS_MM", CSSPrimitiveValue::CSS_MM, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValuePrototypeTableEntries[38] }, |
|
145 { "CSS_PT", CSSPrimitiveValue::CSS_PT, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValuePrototypeTableEntries[34] }, |
|
146 { "CSS_EMS", CSSPrimitiveValue::CSS_EMS, DontDelete|ReadOnly, 0, 0 }, |
|
147 { 0, 0, 0, 0, 0 }, |
|
148 { "CSS_DEG", CSSPrimitiveValue::CSS_DEG, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValuePrototypeTableEntries[40] }, |
|
149 { "CSS_CM", CSSPrimitiveValue::CSS_CM, DontDelete|ReadOnly, 0, 0 }, |
|
150 { 0, 0, 0, 0, 0 }, |
|
151 { 0, 0, 0, 0, 0 }, |
|
152 { 0, 0, 0, 0, 0 }, |
|
153 { 0, 0, 0, 0, 0 }, |
|
154 { "getFloatValue", JSCSSPrimitiveValue::GetFloatValueFuncNum, DontDelete|Function, 1, 0 }, |
|
155 { "CSS_HZ", CSSPrimitiveValue::CSS_HZ, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValuePrototypeTableEntries[43] }, |
|
156 { 0, 0, 0, 0, 0 }, |
|
157 { 0, 0, 0, 0, 0 }, |
|
158 { "CSS_KHZ", CSSPrimitiveValue::CSS_KHZ, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValuePrototypeTableEntries[41] }, |
|
159 { "CSS_IN", CSSPrimitiveValue::CSS_IN, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValuePrototypeTableEntries[35] }, |
|
160 { "CSS_RGBCOLOR", CSSPrimitiveValue::CSS_RGBCOLOR, DontDelete|ReadOnly, 0, 0 }, |
|
161 { 0, 0, 0, 0, 0 }, |
|
162 { 0, 0, 0, 0, 0 }, |
|
163 { "CSS_EXS", CSSPrimitiveValue::CSS_EXS, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValuePrototypeTableEntries[39] }, |
|
164 { "CSS_PERCENTAGE", CSSPrimitiveValue::CSS_PERCENTAGE, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValuePrototypeTableEntries[36] }, |
|
165 { "CSS_PC", CSSPrimitiveValue::CSS_PC, DontDelete|ReadOnly, 0, 0 }, |
|
166 { "CSS_RAD", CSSPrimitiveValue::CSS_RAD, DontDelete|ReadOnly, 0, 0 }, |
|
167 { "CSS_GRAD", CSSPrimitiveValue::CSS_GRAD, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValuePrototypeTableEntries[45] }, |
|
168 { "CSS_MS", CSSPrimitiveValue::CSS_MS, DontDelete|ReadOnly, 0, 0 }, |
|
169 { "CSS_S", CSSPrimitiveValue::CSS_S, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValuePrototypeTableEntries[44] }, |
|
170 { "CSS_DIMENSION", CSSPrimitiveValue::CSS_DIMENSION, DontDelete|ReadOnly, 0, 0 }, |
|
171 { "CSS_STRING", CSSPrimitiveValue::CSS_STRING, DontDelete|ReadOnly, 0, 0 }, |
|
172 { "CSS_ATTR", CSSPrimitiveValue::CSS_ATTR, DontDelete|ReadOnly, 0, 0 }, |
|
173 { "CSS_COUNTER", CSSPrimitiveValue::CSS_COUNTER, DontDelete|ReadOnly, 0, &JSCSSPrimitiveValuePrototypeTableEntries[46] }, |
|
174 { "setFloatValue", JSCSSPrimitiveValue::SetFloatValueFuncNum, DontDelete|Function, 2, 0 }, |
|
175 { "setStringValue", JSCSSPrimitiveValue::SetStringValueFuncNum, DontDelete|Function, 2, 0 }, |
|
176 { "getCounterValue", JSCSSPrimitiveValue::GetCounterValueFuncNum, DontDelete|Function, 0, 0 }, |
|
177 { "getRectValue", JSCSSPrimitiveValue::GetRectValueFuncNum, DontDelete|Function, 0, 0 } |
|
178 }; |
|
179 |
|
180 static const HashTable JSCSSPrimitiveValuePrototypeTable = |
|
181 { |
|
182 2, 47, JSCSSPrimitiveValuePrototypeTableEntries, 33 |
|
183 }; |
|
184 |
|
185 const ClassInfo JSCSSPrimitiveValuePrototype::info = { "CSSPrimitiveValuePrototype", 0, &JSCSSPrimitiveValuePrototypeTable, 0 }; |
|
186 |
|
187 JSObject* JSCSSPrimitiveValuePrototype::self(ExecState* exec) |
|
188 { |
|
189 return KJS::cacheGlobalObject<JSCSSPrimitiveValuePrototype>(exec, "[[JSCSSPrimitiveValue.prototype]]"); |
|
190 } |
|
191 |
|
192 bool JSCSSPrimitiveValuePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
193 { |
|
194 return getStaticPropertySlot<JSCSSPrimitiveValuePrototypeFunction, JSCSSPrimitiveValuePrototype, JSObject>(exec, &JSCSSPrimitiveValuePrototypeTable, this, propertyName, slot); |
|
195 } |
|
196 |
|
197 JSValue* JSCSSPrimitiveValuePrototype::getValueProperty(ExecState*, int token) const |
|
198 { |
|
199 // The token is the numeric value of its associated constant |
|
200 return jsNumber(token); |
|
201 } |
|
202 |
|
203 const ClassInfo JSCSSPrimitiveValue::info = { "CSSPrimitiveValue", &JSCSSValue::info, &JSCSSPrimitiveValueTable, 0 }; |
|
204 |
|
205 JSCSSPrimitiveValue::JSCSSPrimitiveValue(ExecState* exec, CSSPrimitiveValue* impl) |
|
206 : JSCSSValue(exec, impl) |
|
207 { |
|
208 setPrototype(JSCSSPrimitiveValuePrototype::self(exec)); |
|
209 } |
|
210 |
|
211 bool JSCSSPrimitiveValue::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
212 { |
|
213 return getStaticValueSlot<JSCSSPrimitiveValue, JSCSSValue>(exec, &JSCSSPrimitiveValueTable, this, propertyName, slot); |
|
214 } |
|
215 |
|
216 JSValue* JSCSSPrimitiveValue::getValueProperty(ExecState* exec, int token) const |
|
217 { |
|
218 switch (token) { |
|
219 case PrimitiveTypeAttrNum: { |
|
220 CSSPrimitiveValue* imp = static_cast<CSSPrimitiveValue*>(impl()); |
|
221 |
|
222 return jsNumber(imp->primitiveType()); |
|
223 } |
|
224 case ConstructorAttrNum: |
|
225 return getConstructor(exec); |
|
226 } |
|
227 return 0; |
|
228 } |
|
229 |
|
230 JSValue* JSCSSPrimitiveValue::getConstructor(ExecState* exec) |
|
231 { |
|
232 return KJS::cacheGlobalObject<JSCSSPrimitiveValueConstructor>(exec, "[[CSSPrimitiveValue.constructor]]"); |
|
233 } |
|
234 JSValue* JSCSSPrimitiveValuePrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) |
|
235 { |
|
236 if (!thisObj->inherits(&JSCSSPrimitiveValue::info)) |
|
237 return throwError(exec, TypeError); |
|
238 |
|
239 CSSPrimitiveValue* imp = static_cast<CSSPrimitiveValue*>(static_cast<JSCSSPrimitiveValue*>(thisObj)->impl()); |
|
240 |
|
241 switch (id) { |
|
242 case JSCSSPrimitiveValue::SetFloatValueFuncNum: { |
|
243 ExceptionCode ec = 0; |
|
244 unsigned short unitType = args[0]->toInt32(exec); |
|
245 float floatValue = args[1]->toFloat(exec); |
|
246 |
|
247 imp->setFloatValue(unitType, floatValue, ec); |
|
248 setDOMException(exec, ec); |
|
249 return jsUndefined(); |
|
250 } |
|
251 case JSCSSPrimitiveValue::GetFloatValueFuncNum: { |
|
252 unsigned short unitType = args[0]->toInt32(exec); |
|
253 |
|
254 |
|
255 KJS::JSValue* result = jsNumber(imp->getFloatValue(unitType)); |
|
256 return result; |
|
257 } |
|
258 case JSCSSPrimitiveValue::SetStringValueFuncNum: { |
|
259 ExceptionCode ec = 0; |
|
260 unsigned short stringType = args[0]->toInt32(exec); |
|
261 String stringValue = args[1]->toString(exec); |
|
262 |
|
263 imp->setStringValue(stringType, stringValue, ec); |
|
264 setDOMException(exec, ec); |
|
265 return jsUndefined(); |
|
266 } |
|
267 case JSCSSPrimitiveValue::GetStringValueFuncNum: { |
|
268 |
|
269 |
|
270 KJS::JSValue* result = jsString(imp->getStringValue()); |
|
271 return result; |
|
272 } |
|
273 case JSCSSPrimitiveValue::GetCounterValueFuncNum: { |
|
274 |
|
275 |
|
276 KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->getCounterValue())); |
|
277 return result; |
|
278 } |
|
279 case JSCSSPrimitiveValue::GetRectValueFuncNum: { |
|
280 |
|
281 |
|
282 KJS::JSValue* result = toJS(exec, WTF::getPtr(imp->getRectValue())); |
|
283 return result; |
|
284 } |
|
285 case JSCSSPrimitiveValue::GetRGBColorValueFuncNum: { |
|
286 |
|
287 |
|
288 KJS::JSValue* result = getJSRGBColor(exec, imp->getRGBColorValue()); |
|
289 return result; |
|
290 } |
|
291 } |
|
292 return 0; |
|
293 } |
|
294 |
|
295 } |