|
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 "JSSVGAnimatedNumber.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 JSSVGAnimatedNumberTableEntries[] = |
|
43 { |
|
44 { "baseVal", JSSVGAnimatedNumber::BaseValAttrNum, DontDelete, 0, 0 }, |
|
45 { "animVal", JSSVGAnimatedNumber::AnimValAttrNum, DontDelete|ReadOnly, 0, 0 } |
|
46 }; |
|
47 |
|
48 static const HashTable JSSVGAnimatedNumberTable = |
|
49 { |
|
50 2, 2, JSSVGAnimatedNumberTableEntries, 2 |
|
51 }; |
|
52 |
|
53 /* Hash table for prototype */ |
|
54 |
|
55 static const HashEntry JSSVGAnimatedNumberPrototypeTableEntries[] = |
|
56 { |
|
57 { 0, 0, 0, 0, 0 } |
|
58 }; |
|
59 |
|
60 static const HashTable JSSVGAnimatedNumberPrototypeTable = |
|
61 { |
|
62 2, 1, JSSVGAnimatedNumberPrototypeTableEntries, 1 |
|
63 }; |
|
64 |
|
65 const ClassInfo JSSVGAnimatedNumberPrototype::info = { "SVGAnimatedNumberPrototype", 0, &JSSVGAnimatedNumberPrototypeTable, 0 }; |
|
66 |
|
67 JSObject* JSSVGAnimatedNumberPrototype::self(ExecState* exec) |
|
68 { |
|
69 return KJS::cacheGlobalObject<JSSVGAnimatedNumberPrototype>(exec, "[[JSSVGAnimatedNumber.prototype]]"); |
|
70 } |
|
71 |
|
72 const ClassInfo JSSVGAnimatedNumber::info = { "SVGAnimatedNumber", 0, &JSSVGAnimatedNumberTable, 0 }; |
|
73 |
|
74 JSSVGAnimatedNumber::JSSVGAnimatedNumber(ExecState* exec, SVGAnimatedNumber* impl) |
|
75 : m_impl(impl) |
|
76 { |
|
77 setPrototype(JSSVGAnimatedNumberPrototype::self(exec)); |
|
78 } |
|
79 |
|
80 JSSVGAnimatedNumber::~JSSVGAnimatedNumber() |
|
81 { |
|
82 SVGDocumentExtensions::forgetGenericContext<SVGAnimatedNumber>(m_impl.get()); |
|
83 ScriptInterpreter::forgetDOMObject(m_impl.get()); |
|
84 } |
|
85 |
|
86 bool JSSVGAnimatedNumber::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
87 { |
|
88 return getStaticValueSlot<JSSVGAnimatedNumber, KJS::DOMObject>(exec, &JSSVGAnimatedNumberTable, this, propertyName, slot); |
|
89 } |
|
90 |
|
91 JSValue* JSSVGAnimatedNumber::getValueProperty(ExecState* exec, int token) const |
|
92 { |
|
93 switch (token) { |
|
94 case BaseValAttrNum: { |
|
95 SVGAnimatedNumber* imp = static_cast<SVGAnimatedNumber*>(impl()); |
|
96 |
|
97 return jsNumber(imp->baseVal()); |
|
98 } |
|
99 case AnimValAttrNum: { |
|
100 SVGAnimatedNumber* imp = static_cast<SVGAnimatedNumber*>(impl()); |
|
101 |
|
102 return jsNumber(imp->animVal()); |
|
103 } |
|
104 } |
|
105 return 0; |
|
106 } |
|
107 |
|
108 void JSSVGAnimatedNumber::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr) |
|
109 { |
|
110 lookupPut<JSSVGAnimatedNumber, KJS::DOMObject>(exec, propertyName, value, attr, &JSSVGAnimatedNumberTable, this); |
|
111 } |
|
112 |
|
113 void JSSVGAnimatedNumber::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/) |
|
114 { |
|
115 switch (token) { |
|
116 case BaseValAttrNum: { |
|
117 SVGAnimatedNumber* imp = static_cast<SVGAnimatedNumber*>(impl()); |
|
118 |
|
119 imp->setBaseVal(value->toFloat(exec)); |
|
120 break; |
|
121 } |
|
122 } |
|
123 SVGAnimatedNumber* imp = static_cast<SVGAnimatedNumber*>(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<SVGAnimatedNumber>(imp)) { |
|
132 const SVGElement* context = extensions->genericContext<SVGAnimatedNumber>(imp); |
|
133 ASSERT(context); |
|
134 |
|
135 context->notifyAttributeChange(); |
|
136 } |
|
137 |
|
138 } |
|
139 |
|
140 KJS::JSValue* toJS(KJS::ExecState* exec, SVGAnimatedNumber* obj) |
|
141 { |
|
142 return KJS::cacheDOMObject<SVGAnimatedNumber, JSSVGAnimatedNumber>(exec, obj); |
|
143 } |
|
144 SVGAnimatedNumber* toSVGAnimatedNumber(KJS::JSValue* val) |
|
145 { |
|
146 return val->isObject(&JSSVGAnimatedNumber::info) ? static_cast<JSSVGAnimatedNumber*>(val)->impl() : 0; |
|
147 } |
|
148 |
|
149 } |
|
150 |
|
151 #endif // ENABLE(SVG) |