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