|
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 "JSHTMLFrameElement.h" |
|
24 |
|
25 #include <wtf/GetPtr.h> |
|
26 |
|
27 #include "Document.h" |
|
28 #include "HTMLFrameElement.h" |
|
29 #include "JSDocument.h" |
|
30 #include "PlatformString.h" |
|
31 #include "kjs_dom.h" |
|
32 #include "kjs_window.h" |
|
33 |
|
34 using namespace KJS; |
|
35 |
|
36 namespace WebCore { |
|
37 |
|
38 /* Hash table */ |
|
39 |
|
40 static const HashEntry JSHTMLFrameElementTableEntries[] = |
|
41 { |
|
42 { "scrolling", JSHTMLFrameElement::ScrollingAttrNum, DontDelete, 0, &JSHTMLFrameElementTableEntries[16] }, |
|
43 { "longDesc", JSHTMLFrameElement::LongDescAttrNum, DontDelete, 0, &JSHTMLFrameElementTableEntries[18] }, |
|
44 { "location", JSHTMLFrameElement::LocationAttrNum, DontDelete, 0, 0 }, |
|
45 { 0, 0, 0, 0, 0 }, |
|
46 { 0, 0, 0, 0, 0 }, |
|
47 { 0, 0, 0, 0, 0 }, |
|
48 { 0, 0, 0, 0, 0 }, |
|
49 { 0, 0, 0, 0, 0 }, |
|
50 { "marginWidth", JSHTMLFrameElement::MarginWidthAttrNum, DontDelete, 0, &JSHTMLFrameElementTableEntries[14] }, |
|
51 { "name", JSHTMLFrameElement::NameAttrNum, DontDelete, 0, &JSHTMLFrameElementTableEntries[15] }, |
|
52 { 0, 0, 0, 0, 0 }, |
|
53 { 0, 0, 0, 0, 0 }, |
|
54 { "marginHeight", JSHTMLFrameElement::MarginHeightAttrNum, DontDelete, 0, 0 }, |
|
55 { "frameBorder", JSHTMLFrameElement::FrameBorderAttrNum, DontDelete, 0, &JSHTMLFrameElementTableEntries[17] }, |
|
56 { "noResize", JSHTMLFrameElement::NoResizeAttrNum, DontDelete, 0, 0 }, |
|
57 { "src", JSHTMLFrameElement::SrcAttrNum, DontDelete, 0, &JSHTMLFrameElementTableEntries[19] }, |
|
58 { "contentDocument", JSHTMLFrameElement::ContentDocumentAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
59 { "contentWindow", JSHTMLFrameElement::ContentWindowAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
60 { "width", JSHTMLFrameElement::WidthAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
61 { "height", JSHTMLFrameElement::HeightAttrNum, DontDelete|ReadOnly, 0, &JSHTMLFrameElementTableEntries[20] }, |
|
62 { "constructor", JSHTMLFrameElement::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 } |
|
63 }; |
|
64 |
|
65 static const HashTable JSHTMLFrameElementTable = |
|
66 { |
|
67 2, 21, JSHTMLFrameElementTableEntries, 14 |
|
68 }; |
|
69 |
|
70 /* Hash table for constructor */ |
|
71 |
|
72 static const HashEntry JSHTMLFrameElementConstructorTableEntries[] = |
|
73 { |
|
74 { 0, 0, 0, 0, 0 } |
|
75 }; |
|
76 |
|
77 static const HashTable JSHTMLFrameElementConstructorTable = |
|
78 { |
|
79 2, 1, JSHTMLFrameElementConstructorTableEntries, 1 |
|
80 }; |
|
81 |
|
82 class JSHTMLFrameElementConstructor : public DOMObject { |
|
83 public: |
|
84 JSHTMLFrameElementConstructor(ExecState* exec) |
|
85 { |
|
86 setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype()); |
|
87 putDirect(exec->propertyNames().prototype, JSHTMLFrameElementPrototype::self(exec), None); |
|
88 } |
|
89 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); |
|
90 JSValue* getValueProperty(ExecState*, int token) const; |
|
91 virtual const ClassInfo* classInfo() const { return &info; } |
|
92 static const ClassInfo info; |
|
93 |
|
94 virtual bool implementsHasInstance() const { return true; } |
|
95 }; |
|
96 |
|
97 const ClassInfo JSHTMLFrameElementConstructor::info = { "HTMLFrameElementConstructor", 0, &JSHTMLFrameElementConstructorTable, 0 }; |
|
98 |
|
99 bool JSHTMLFrameElementConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
100 { |
|
101 return getStaticValueSlot<JSHTMLFrameElementConstructor, DOMObject>(exec, &JSHTMLFrameElementConstructorTable, this, propertyName, slot); |
|
102 } |
|
103 |
|
104 JSValue* JSHTMLFrameElementConstructor::getValueProperty(ExecState*, int token) const |
|
105 { |
|
106 // The token is the numeric value of its associated constant |
|
107 return jsNumber(token); |
|
108 } |
|
109 |
|
110 /* Hash table for prototype */ |
|
111 |
|
112 static const HashEntry JSHTMLFrameElementPrototypeTableEntries[] = |
|
113 { |
|
114 { 0, 0, 0, 0, 0 } |
|
115 }; |
|
116 |
|
117 static const HashTable JSHTMLFrameElementPrototypeTable = |
|
118 { |
|
119 2, 1, JSHTMLFrameElementPrototypeTableEntries, 1 |
|
120 }; |
|
121 |
|
122 const ClassInfo JSHTMLFrameElementPrototype::info = { "HTMLFrameElementPrototype", 0, &JSHTMLFrameElementPrototypeTable, 0 }; |
|
123 |
|
124 JSObject* JSHTMLFrameElementPrototype::self(ExecState* exec) |
|
125 { |
|
126 return KJS::cacheGlobalObject<JSHTMLFrameElementPrototype>(exec, "[[JSHTMLFrameElement.prototype]]"); |
|
127 } |
|
128 |
|
129 const ClassInfo JSHTMLFrameElement::info = { "HTMLFrameElement", &JSHTMLElement::info, &JSHTMLFrameElementTable, 0 }; |
|
130 |
|
131 JSHTMLFrameElement::JSHTMLFrameElement(ExecState* exec, HTMLFrameElement* impl) |
|
132 : JSHTMLElement(exec, impl) |
|
133 { |
|
134 setPrototype(JSHTMLFrameElementPrototype::self(exec)); |
|
135 } |
|
136 |
|
137 bool JSHTMLFrameElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
138 { |
|
139 return getStaticValueSlot<JSHTMLFrameElement, JSHTMLElement>(exec, &JSHTMLFrameElementTable, this, propertyName, slot); |
|
140 } |
|
141 |
|
142 JSValue* JSHTMLFrameElement::getValueProperty(ExecState* exec, int token) const |
|
143 { |
|
144 switch (token) { |
|
145 case FrameBorderAttrNum: { |
|
146 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
147 |
|
148 return jsString(imp->frameBorder()); |
|
149 } |
|
150 case LongDescAttrNum: { |
|
151 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
152 |
|
153 return jsString(imp->longDesc()); |
|
154 } |
|
155 case MarginHeightAttrNum: { |
|
156 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
157 |
|
158 return jsString(imp->marginHeight()); |
|
159 } |
|
160 case MarginWidthAttrNum: { |
|
161 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
162 |
|
163 return jsString(imp->marginWidth()); |
|
164 } |
|
165 case NameAttrNum: { |
|
166 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
167 |
|
168 return jsString(imp->name()); |
|
169 } |
|
170 case NoResizeAttrNum: { |
|
171 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
172 |
|
173 return jsBoolean(imp->noResize()); |
|
174 } |
|
175 case ScrollingAttrNum: { |
|
176 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
177 |
|
178 return jsString(imp->scrolling()); |
|
179 } |
|
180 case SrcAttrNum: { |
|
181 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
182 |
|
183 return jsString(imp->src()); |
|
184 } |
|
185 case ContentDocumentAttrNum: { |
|
186 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
187 |
|
188 return checkNodeSecurity(exec, imp->contentDocument()) ? toJS(exec, WTF::getPtr(imp->contentDocument())) : jsUndefined(); |
|
189 } |
|
190 case ContentWindowAttrNum: { |
|
191 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
192 |
|
193 return toJS(exec, WTF::getPtr(imp->contentWindow())); |
|
194 } |
|
195 case LocationAttrNum: { |
|
196 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
197 |
|
198 return jsString(imp->location()); |
|
199 } |
|
200 case WidthAttrNum: { |
|
201 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
202 |
|
203 return jsNumber(imp->width()); |
|
204 } |
|
205 case HeightAttrNum: { |
|
206 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
207 |
|
208 return jsNumber(imp->height()); |
|
209 } |
|
210 case ConstructorAttrNum: |
|
211 return getConstructor(exec); |
|
212 } |
|
213 return 0; |
|
214 } |
|
215 |
|
216 void JSHTMLFrameElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr) |
|
217 { |
|
218 lookupPut<JSHTMLFrameElement, JSHTMLElement>(exec, propertyName, value, attr, &JSHTMLFrameElementTable, this); |
|
219 } |
|
220 |
|
221 void JSHTMLFrameElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/) |
|
222 { |
|
223 switch (token) { |
|
224 case FrameBorderAttrNum: { |
|
225 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
226 |
|
227 imp->setFrameBorder(valueToStringWithNullCheck(exec, value)); |
|
228 break; |
|
229 } |
|
230 case LongDescAttrNum: { |
|
231 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
232 |
|
233 imp->setLongDesc(valueToStringWithNullCheck(exec, value)); |
|
234 break; |
|
235 } |
|
236 case MarginHeightAttrNum: { |
|
237 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
238 |
|
239 imp->setMarginHeight(valueToStringWithNullCheck(exec, value)); |
|
240 break; |
|
241 } |
|
242 case MarginWidthAttrNum: { |
|
243 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
244 |
|
245 imp->setMarginWidth(valueToStringWithNullCheck(exec, value)); |
|
246 break; |
|
247 } |
|
248 case NameAttrNum: { |
|
249 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
250 |
|
251 imp->setName(valueToStringWithNullCheck(exec, value)); |
|
252 break; |
|
253 } |
|
254 case NoResizeAttrNum: { |
|
255 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
256 |
|
257 imp->setNoResize(value->toBoolean(exec)); |
|
258 break; |
|
259 } |
|
260 case ScrollingAttrNum: { |
|
261 HTMLFrameElement* imp = static_cast<HTMLFrameElement*>(impl()); |
|
262 |
|
263 imp->setScrolling(valueToStringWithNullCheck(exec, value)); |
|
264 break; |
|
265 } |
|
266 case SrcAttrNum: { |
|
267 setSrc(exec, value); |
|
268 break; |
|
269 } |
|
270 case LocationAttrNum: { |
|
271 setLocation(exec, value); |
|
272 break; |
|
273 } |
|
274 } |
|
275 } |
|
276 |
|
277 JSValue* JSHTMLFrameElement::getConstructor(ExecState* exec) |
|
278 { |
|
279 return KJS::cacheGlobalObject<JSHTMLFrameElementConstructor>(exec, "[[HTMLFrameElement.constructor]]"); |
|
280 } |
|
281 |
|
282 } |