|
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 "JSCSSMediaRule.h" |
|
23 |
|
24 #include "CSSMediaRule.h" |
|
25 #include "CSSRuleList.h" |
|
26 #include "JSCSSRuleList.h" |
|
27 #include "JSMediaList.h" |
|
28 #include "MediaList.h" |
|
29 #include <runtime/Error.h> |
|
30 #include <runtime/JSNumberCell.h> |
|
31 #include <wtf/GetPtr.h> |
|
32 |
|
33 using namespace JSC; |
|
34 |
|
35 namespace WebCore { |
|
36 |
|
37 ASSERT_CLASS_FITS_IN_CELL(JSCSSMediaRule); |
|
38 |
|
39 /* Hash table */ |
|
40 #if ENABLE(JIT) |
|
41 #define THUNK_GENERATOR(generator) , generator |
|
42 #else |
|
43 #define THUNK_GENERATOR(generator) |
|
44 #endif |
|
45 |
|
46 static const HashTableValue JSCSSMediaRuleTableValues[4] = |
|
47 { |
|
48 { "media", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSMediaRuleMedia), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
49 { "cssRules", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSMediaRuleCssRules), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
50 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSMediaRuleConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
51 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
52 }; |
|
53 |
|
54 #undef THUNK_GENERATOR |
|
55 static JSC_CONST_HASHTABLE HashTable JSCSSMediaRuleTable = { 8, 7, JSCSSMediaRuleTableValues, 0 }; |
|
56 /* Hash table for constructor */ |
|
57 #if ENABLE(JIT) |
|
58 #define THUNK_GENERATOR(generator) , generator |
|
59 #else |
|
60 #define THUNK_GENERATOR(generator) |
|
61 #endif |
|
62 |
|
63 static const HashTableValue JSCSSMediaRuleConstructorTableValues[1] = |
|
64 { |
|
65 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
66 }; |
|
67 |
|
68 #undef THUNK_GENERATOR |
|
69 static JSC_CONST_HASHTABLE HashTable JSCSSMediaRuleConstructorTable = { 1, 0, JSCSSMediaRuleConstructorTableValues, 0 }; |
|
70 class JSCSSMediaRuleConstructor : public DOMConstructorObject { |
|
71 public: |
|
72 JSCSSMediaRuleConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
73 |
|
74 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
75 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
76 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
77 static const JSC::ClassInfo s_info; |
|
78 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
79 { |
|
80 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
81 } |
|
82 protected: |
|
83 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
84 }; |
|
85 |
|
86 const ClassInfo JSCSSMediaRuleConstructor::s_info = { "CSSMediaRuleConstructor", 0, &JSCSSMediaRuleConstructorTable, 0 }; |
|
87 |
|
88 JSCSSMediaRuleConstructor::JSCSSMediaRuleConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
89 : DOMConstructorObject(JSCSSMediaRuleConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
90 { |
|
91 putDirect(exec->propertyNames().prototype, JSCSSMediaRulePrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
92 } |
|
93 |
|
94 bool JSCSSMediaRuleConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
95 { |
|
96 return getStaticValueSlot<JSCSSMediaRuleConstructor, DOMObject>(exec, &JSCSSMediaRuleConstructorTable, this, propertyName, slot); |
|
97 } |
|
98 |
|
99 bool JSCSSMediaRuleConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
100 { |
|
101 return getStaticValueDescriptor<JSCSSMediaRuleConstructor, DOMObject>(exec, &JSCSSMediaRuleConstructorTable, this, propertyName, descriptor); |
|
102 } |
|
103 |
|
104 /* Hash table for prototype */ |
|
105 #if ENABLE(JIT) |
|
106 #define THUNK_GENERATOR(generator) , generator |
|
107 #else |
|
108 #define THUNK_GENERATOR(generator) |
|
109 #endif |
|
110 |
|
111 static const HashTableValue JSCSSMediaRulePrototypeTableValues[3] = |
|
112 { |
|
113 { "insertRule", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsCSSMediaRulePrototypeFunctionInsertRule), (intptr_t)2 THUNK_GENERATOR(0) }, |
|
114 { "deleteRule", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsCSSMediaRulePrototypeFunctionDeleteRule), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
115 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
116 }; |
|
117 |
|
118 #undef THUNK_GENERATOR |
|
119 static JSC_CONST_HASHTABLE HashTable JSCSSMediaRulePrototypeTable = { 4, 3, JSCSSMediaRulePrototypeTableValues, 0 }; |
|
120 const ClassInfo JSCSSMediaRulePrototype::s_info = { "CSSMediaRulePrototype", 0, &JSCSSMediaRulePrototypeTable, 0 }; |
|
121 |
|
122 JSObject* JSCSSMediaRulePrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
123 { |
|
124 return getDOMPrototype<JSCSSMediaRule>(exec, globalObject); |
|
125 } |
|
126 |
|
127 bool JSCSSMediaRulePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
128 { |
|
129 return getStaticFunctionSlot<JSObject>(exec, &JSCSSMediaRulePrototypeTable, this, propertyName, slot); |
|
130 } |
|
131 |
|
132 bool JSCSSMediaRulePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
133 { |
|
134 return getStaticFunctionDescriptor<JSObject>(exec, &JSCSSMediaRulePrototypeTable, this, propertyName, descriptor); |
|
135 } |
|
136 |
|
137 const ClassInfo JSCSSMediaRule::s_info = { "CSSMediaRule", &JSCSSRule::s_info, &JSCSSMediaRuleTable, 0 }; |
|
138 |
|
139 JSCSSMediaRule::JSCSSMediaRule(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<CSSMediaRule> impl) |
|
140 : JSCSSRule(structure, globalObject, impl) |
|
141 { |
|
142 } |
|
143 |
|
144 JSObject* JSCSSMediaRule::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
145 { |
|
146 return new (exec) JSCSSMediaRulePrototype(globalObject, JSCSSMediaRulePrototype::createStructure(JSCSSRulePrototype::self(exec, globalObject))); |
|
147 } |
|
148 |
|
149 bool JSCSSMediaRule::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
150 { |
|
151 return getStaticValueSlot<JSCSSMediaRule, Base>(exec, &JSCSSMediaRuleTable, this, propertyName, slot); |
|
152 } |
|
153 |
|
154 bool JSCSSMediaRule::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
155 { |
|
156 return getStaticValueDescriptor<JSCSSMediaRule, Base>(exec, &JSCSSMediaRuleTable, this, propertyName, descriptor); |
|
157 } |
|
158 |
|
159 JSValue jsCSSMediaRuleMedia(ExecState* exec, JSValue slotBase, const Identifier&) |
|
160 { |
|
161 JSCSSMediaRule* castedThis = static_cast<JSCSSMediaRule*>(asObject(slotBase)); |
|
162 UNUSED_PARAM(exec); |
|
163 CSSMediaRule* imp = static_cast<CSSMediaRule*>(castedThis->impl()); |
|
164 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->media())); |
|
165 return result; |
|
166 } |
|
167 |
|
168 JSValue jsCSSMediaRuleCssRules(ExecState* exec, JSValue slotBase, const Identifier&) |
|
169 { |
|
170 JSCSSMediaRule* castedThis = static_cast<JSCSSMediaRule*>(asObject(slotBase)); |
|
171 UNUSED_PARAM(exec); |
|
172 CSSMediaRule* imp = static_cast<CSSMediaRule*>(castedThis->impl()); |
|
173 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->cssRules())); |
|
174 return result; |
|
175 } |
|
176 |
|
177 JSValue jsCSSMediaRuleConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
178 { |
|
179 JSCSSMediaRule* domObject = static_cast<JSCSSMediaRule*>(asObject(slotBase)); |
|
180 return JSCSSMediaRule::getConstructor(exec, domObject->globalObject()); |
|
181 } |
|
182 JSValue JSCSSMediaRule::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
183 { |
|
184 return getDOMConstructor<JSCSSMediaRuleConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
185 } |
|
186 |
|
187 EncodedJSValue JSC_HOST_CALL jsCSSMediaRulePrototypeFunctionInsertRule(ExecState* exec) |
|
188 { |
|
189 JSValue thisValue = exec->hostThisValue(); |
|
190 if (!thisValue.inherits(&JSCSSMediaRule::s_info)) |
|
191 return throwVMTypeError(exec); |
|
192 JSCSSMediaRule* castedThis = static_cast<JSCSSMediaRule*>(asObject(thisValue)); |
|
193 CSSMediaRule* imp = static_cast<CSSMediaRule*>(castedThis->impl()); |
|
194 ExceptionCode ec = 0; |
|
195 const String& rule = ustringToString(exec->argument(0).toString(exec)); |
|
196 unsigned index = exec->argument(1).toInt32(exec); |
|
197 |
|
198 |
|
199 JSC::JSValue result = jsNumber(exec, imp->insertRule(rule, index, ec)); |
|
200 setDOMException(exec, ec); |
|
201 return JSValue::encode(result); |
|
202 } |
|
203 |
|
204 EncodedJSValue JSC_HOST_CALL jsCSSMediaRulePrototypeFunctionDeleteRule(ExecState* exec) |
|
205 { |
|
206 JSValue thisValue = exec->hostThisValue(); |
|
207 if (!thisValue.inherits(&JSCSSMediaRule::s_info)) |
|
208 return throwVMTypeError(exec); |
|
209 JSCSSMediaRule* castedThis = static_cast<JSCSSMediaRule*>(asObject(thisValue)); |
|
210 CSSMediaRule* imp = static_cast<CSSMediaRule*>(castedThis->impl()); |
|
211 ExceptionCode ec = 0; |
|
212 unsigned index = exec->argument(0).toInt32(exec); |
|
213 |
|
214 imp->deleteRule(index, ec); |
|
215 setDOMException(exec, ec); |
|
216 return JSValue::encode(jsUndefined()); |
|
217 } |
|
218 |
|
219 |
|
220 } |