|
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 |
|
24 #if ENABLE(SVG) |
|
25 |
|
26 #include "Document.h" |
|
27 #include "Frame.h" |
|
28 #include "SVGDocumentExtensions.h" |
|
29 #include "SVGElement.h" |
|
30 #include "SVGAnimatedTemplate.h" |
|
31 #include "JSSVGAnimatedBoolean.h" |
|
32 |
|
33 #include <wtf/GetPtr.h> |
|
34 |
|
35 |
|
36 using namespace KJS; |
|
37 |
|
38 namespace WebCore { |
|
39 |
|
40 /* Hash table */ |
|
41 |
|
42 static const HashEntry JSSVGAnimatedBooleanTableEntries[] = |
|
43 { |
|
44 { "baseVal", JSSVGAnimatedBoolean::BaseValAttrNum, DontDelete, 0, 0 }, |
|
45 { "animVal", JSSVGAnimatedBoolean::AnimValAttrNum, DontDelete|ReadOnly, 0, 0 } |
|
46 }; |
|
47 |
|
48 static const HashTable JSSVGAnimatedBooleanTable = |
|
49 { |
|
50 2, 2, JSSVGAnimatedBooleanTableEntries, 2 |
|
51 }; |
|
52 |
|
53 /* Hash table for prototype */ |
|
54 |
|
55 static const HashEntry JSSVGAnimatedBooleanPrototypeTableEntries[] = |
|
56 { |
|
57 { 0, 0, 0, 0, 0 } |
|
58 }; |
|
59 |
|
60 static const HashTable JSSVGAnimatedBooleanPrototypeTable = |
|
61 { |
|
62 2, 1, JSSVGAnimatedBooleanPrototypeTableEntries, 1 |
|
63 }; |
|
64 |
|
65 const ClassInfo JSSVGAnimatedBooleanPrototype::info = { "SVGAnimatedBooleanPrototype", 0, &JSSVGAnimatedBooleanPrototypeTable, 0 }; |
|
66 |
|
67 JSObject* JSSVGAnimatedBooleanPrototype::self(ExecState* exec) |
|
68 { |
|
69 return KJS::cacheGlobalObject<JSSVGAnimatedBooleanPrototype>(exec, "[[JSSVGAnimatedBoolean.prototype]]"); |
|
70 } |
|
71 |
|
72 const ClassInfo JSSVGAnimatedBoolean::info = { "SVGAnimatedBoolean", 0, &JSSVGAnimatedBooleanTable, 0 }; |
|
73 |
|
74 JSSVGAnimatedBoolean::JSSVGAnimatedBoolean(ExecState* exec, SVGAnimatedBoolean* impl) |
|
75 : m_impl(impl) |
|
76 { |
|
77 setPrototype(JSSVGAnimatedBooleanPrototype::self(exec)); |
|
78 } |
|
79 |
|
80 JSSVGAnimatedBoolean::~JSSVGAnimatedBoolean() |
|
81 { |
|
82 SVGDocumentExtensions::forgetGenericContext<SVGAnimatedBoolean>(m_impl.get()); |
|
83 ScriptInterpreter::forgetDOMObject(m_impl.get()); |
|
84 } |
|
85 |
|
86 bool JSSVGAnimatedBoolean::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
87 { |
|
88 return getStaticValueSlot<JSSVGAnimatedBoolean, KJS::DOMObject>(exec, &JSSVGAnimatedBooleanTable, this, propertyName, slot); |
|
89 } |
|
90 |
|
91 JSValue* JSSVGAnimatedBoolean::getValueProperty(ExecState* exec, int token) const |
|
92 { |
|
93 switch (token) { |
|
94 case BaseValAttrNum: { |
|
95 SVGAnimatedBoolean* imp = static_cast<SVGAnimatedBoolean*>(impl()); |
|
96 |
|
97 return jsBoolean(imp->baseVal()); |
|
98 } |
|
99 case AnimValAttrNum: { |
|
100 SVGAnimatedBoolean* imp = static_cast<SVGAnimatedBoolean*>(impl()); |
|
101 |
|
102 return jsBoolean(imp->animVal()); |
|
103 } |
|
104 } |
|
105 return 0; |
|
106 } |
|
107 |
|
108 void JSSVGAnimatedBoolean::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr) |
|
109 { |
|
110 lookupPut<JSSVGAnimatedBoolean, KJS::DOMObject>(exec, propertyName, value, attr, &JSSVGAnimatedBooleanTable, this); |
|
111 } |
|
112 |
|
113 void JSSVGAnimatedBoolean::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/) |
|
114 { |
|
115 switch (token) { |
|
116 case BaseValAttrNum: { |
|
117 SVGAnimatedBoolean* imp = static_cast<SVGAnimatedBoolean*>(impl()); |
|
118 |
|
119 imp->setBaseVal(value->toBoolean(exec)); |
|
120 break; |
|
121 } |
|
122 } |
|
123 SVGAnimatedBoolean* imp = static_cast<SVGAnimatedBoolean*>(impl()); |
|
124 |
|
125 ASSERT(exec && exec->dynamicInterpreter()); |
|
126 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
127 if (!activeFrame) |
|
128 return; |
|
129 |
|
130 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
131 if (extensions && extensions->hasGenericContext<SVGAnimatedBoolean>(imp)) { |
|
132 const SVGElement* context = extensions->genericContext<SVGAnimatedBoolean>(imp); |
|
133 ASSERT(context); |
|
134 |
|
135 context->notifyAttributeChange(); |
|
136 } |
|
137 |
|
138 } |
|
139 |
|
140 KJS::JSValue* toJS(KJS::ExecState* exec, SVGAnimatedBoolean* obj) |
|
141 { |
|
142 return KJS::cacheDOMObject<SVGAnimatedBoolean, JSSVGAnimatedBoolean>(exec, obj); |
|
143 } |
|
144 SVGAnimatedBoolean* toSVGAnimatedBoolean(KJS::JSValue* val) |
|
145 { |
|
146 return val->isObject(&JSSVGAnimatedBoolean::info) ? static_cast<JSSVGAnimatedBoolean*>(val)->impl() : 0; |
|
147 } |
|
148 |
|
149 } |
|
150 |
|
151 #endif // ENABLE(SVG) |