|
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 "JSHTMLStyleElement.h" |
|
24 |
|
25 #include <wtf/GetPtr.h> |
|
26 |
|
27 #include "HTMLStyleElement.h" |
|
28 #include "JSStyleSheet.h" |
|
29 #include "PlatformString.h" |
|
30 #include "StyleSheet.h" |
|
31 |
|
32 using namespace KJS; |
|
33 |
|
34 namespace WebCore { |
|
35 |
|
36 /* Hash table */ |
|
37 |
|
38 static const HashEntry JSHTMLStyleElementTableEntries[] = |
|
39 { |
|
40 { "sheet", JSHTMLStyleElement::SheetAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
41 { 0, 0, 0, 0, 0 }, |
|
42 { "constructor", JSHTMLStyleElement::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 }, |
|
43 { "disabled", JSHTMLStyleElement::DisabledAttrNum, DontDelete, 0, &JSHTMLStyleElementTableEntries[5] }, |
|
44 { "media", JSHTMLStyleElement::MediaAttrNum, DontDelete, 0, 0 }, |
|
45 { "type", JSHTMLStyleElement::TypeAttrNum, DontDelete, 0, 0 } |
|
46 }; |
|
47 |
|
48 static const HashTable JSHTMLStyleElementTable = |
|
49 { |
|
50 2, 6, JSHTMLStyleElementTableEntries, 5 |
|
51 }; |
|
52 |
|
53 /* Hash table for constructor */ |
|
54 |
|
55 static const HashEntry JSHTMLStyleElementConstructorTableEntries[] = |
|
56 { |
|
57 { 0, 0, 0, 0, 0 } |
|
58 }; |
|
59 |
|
60 static const HashTable JSHTMLStyleElementConstructorTable = |
|
61 { |
|
62 2, 1, JSHTMLStyleElementConstructorTableEntries, 1 |
|
63 }; |
|
64 |
|
65 class JSHTMLStyleElementConstructor : public DOMObject { |
|
66 public: |
|
67 JSHTMLStyleElementConstructor(ExecState* exec) |
|
68 { |
|
69 setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype()); |
|
70 putDirect(exec->propertyNames().prototype, JSHTMLStyleElementPrototype::self(exec), None); |
|
71 } |
|
72 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); |
|
73 JSValue* getValueProperty(ExecState*, int token) const; |
|
74 virtual const ClassInfo* classInfo() const { return &info; } |
|
75 static const ClassInfo info; |
|
76 |
|
77 virtual bool implementsHasInstance() const { return true; } |
|
78 }; |
|
79 |
|
80 const ClassInfo JSHTMLStyleElementConstructor::info = { "HTMLStyleElementConstructor", 0, &JSHTMLStyleElementConstructorTable, 0 }; |
|
81 |
|
82 bool JSHTMLStyleElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
83 { |
|
84 return getStaticValueSlot<JSHTMLStyleElementConstructor, DOMObject>(exec, &JSHTMLStyleElementConstructorTable, this, propertyName, slot); |
|
85 } |
|
86 |
|
87 JSValue* JSHTMLStyleElementConstructor::getValueProperty(ExecState*, int token) const |
|
88 { |
|
89 // The token is the numeric value of its associated constant |
|
90 return jsNumber(token); |
|
91 } |
|
92 |
|
93 /* Hash table for prototype */ |
|
94 |
|
95 static const HashEntry JSHTMLStyleElementPrototypeTableEntries[] = |
|
96 { |
|
97 { 0, 0, 0, 0, 0 } |
|
98 }; |
|
99 |
|
100 static const HashTable JSHTMLStyleElementPrototypeTable = |
|
101 { |
|
102 2, 1, JSHTMLStyleElementPrototypeTableEntries, 1 |
|
103 }; |
|
104 |
|
105 const ClassInfo JSHTMLStyleElementPrototype::info = { "HTMLStyleElementPrototype", 0, &JSHTMLStyleElementPrototypeTable, 0 }; |
|
106 |
|
107 JSObject* JSHTMLStyleElementPrototype::self(ExecState* exec) |
|
108 { |
|
109 return KJS::cacheGlobalObject<JSHTMLStyleElementPrototype>(exec, "[[JSHTMLStyleElement.prototype]]"); |
|
110 } |
|
111 |
|
112 const ClassInfo JSHTMLStyleElement::info = { "HTMLStyleElement", &JSHTMLElement::info, &JSHTMLStyleElementTable, 0 }; |
|
113 |
|
114 JSHTMLStyleElement::JSHTMLStyleElement(ExecState* exec, HTMLStyleElement* impl) |
|
115 : JSHTMLElement(exec, impl) |
|
116 { |
|
117 setPrototype(JSHTMLStyleElementPrototype::self(exec)); |
|
118 } |
|
119 |
|
120 bool JSHTMLStyleElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
121 { |
|
122 return getStaticValueSlot<JSHTMLStyleElement, JSHTMLElement>(exec, &JSHTMLStyleElementTable, this, propertyName, slot); |
|
123 } |
|
124 |
|
125 JSValue* JSHTMLStyleElement::getValueProperty(ExecState* exec, int token) const |
|
126 { |
|
127 switch (token) { |
|
128 case DisabledAttrNum: { |
|
129 HTMLStyleElement* imp = static_cast<HTMLStyleElement*>(impl()); |
|
130 |
|
131 return jsBoolean(imp->disabled()); |
|
132 } |
|
133 case MediaAttrNum: { |
|
134 HTMLStyleElement* imp = static_cast<HTMLStyleElement*>(impl()); |
|
135 |
|
136 return jsString(imp->media()); |
|
137 } |
|
138 case TypeAttrNum: { |
|
139 HTMLStyleElement* imp = static_cast<HTMLStyleElement*>(impl()); |
|
140 |
|
141 return jsString(imp->type()); |
|
142 } |
|
143 case SheetAttrNum: { |
|
144 HTMLStyleElement* imp = static_cast<HTMLStyleElement*>(impl()); |
|
145 |
|
146 return toJS(exec, WTF::getPtr(imp->sheet())); |
|
147 } |
|
148 case ConstructorAttrNum: |
|
149 return getConstructor(exec); |
|
150 } |
|
151 return 0; |
|
152 } |
|
153 |
|
154 void JSHTMLStyleElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr) |
|
155 { |
|
156 lookupPut<JSHTMLStyleElement, JSHTMLElement>(exec, propertyName, value, attr, &JSHTMLStyleElementTable, this); |
|
157 } |
|
158 |
|
159 void JSHTMLStyleElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/) |
|
160 { |
|
161 switch (token) { |
|
162 case DisabledAttrNum: { |
|
163 HTMLStyleElement* imp = static_cast<HTMLStyleElement*>(impl()); |
|
164 |
|
165 imp->setDisabled(value->toBoolean(exec)); |
|
166 break; |
|
167 } |
|
168 case MediaAttrNum: { |
|
169 HTMLStyleElement* imp = static_cast<HTMLStyleElement*>(impl()); |
|
170 |
|
171 imp->setMedia(valueToStringWithNullCheck(exec, value)); |
|
172 break; |
|
173 } |
|
174 case TypeAttrNum: { |
|
175 HTMLStyleElement* imp = static_cast<HTMLStyleElement*>(impl()); |
|
176 |
|
177 imp->setType(valueToStringWithNullCheck(exec, value)); |
|
178 break; |
|
179 } |
|
180 } |
|
181 } |
|
182 |
|
183 JSValue* JSHTMLStyleElement::getConstructor(ExecState* exec) |
|
184 { |
|
185 return KJS::cacheGlobalObject<JSHTMLStyleElementConstructor>(exec, "[[HTMLStyleElement.constructor]]"); |
|
186 } |
|
187 |
|
188 } |