|
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 "JSSVGTextElement.h" |
|
32 |
|
33 #include <wtf/GetPtr.h> |
|
34 |
|
35 #include "JSSVGAnimatedTransformList.h" |
|
36 #include "JSSVGElement.h" |
|
37 #include "JSSVGMatrix.h" |
|
38 #include "JSSVGRect.h" |
|
39 #include "SVGElement.h" |
|
40 #include "SVGTextElement.h" |
|
41 |
|
42 using namespace KJS; |
|
43 |
|
44 namespace WebCore { |
|
45 |
|
46 /* Hash table */ |
|
47 |
|
48 static const HashEntry JSSVGTextElementTableEntries[] = |
|
49 { |
|
50 { "nearestViewportElement", JSSVGTextElement::NearestViewportElementAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
51 { "transform", JSSVGTextElement::TransformAttrNum, DontDelete|ReadOnly, 0, &JSSVGTextElementTableEntries[3] }, |
|
52 { 0, 0, 0, 0, 0 }, |
|
53 { "farthestViewportElement", JSSVGTextElement::FarthestViewportElementAttrNum, DontDelete|ReadOnly, 0, 0 } |
|
54 }; |
|
55 |
|
56 static const HashTable JSSVGTextElementTable = |
|
57 { |
|
58 2, 4, JSSVGTextElementTableEntries, 3 |
|
59 }; |
|
60 |
|
61 /* Hash table for prototype */ |
|
62 |
|
63 static const HashEntry JSSVGTextElementPrototypeTableEntries[] = |
|
64 { |
|
65 { "getTransformToElement", JSSVGTextElement::GetTransformToElementFuncNum, DontDelete|Function, 1, 0 }, |
|
66 { "getScreenCTM", JSSVGTextElement::GetScreenCTMFuncNum, DontDelete|Function, 0, 0 }, |
|
67 { "getCTM", JSSVGTextElement::GetCTMFuncNum, DontDelete|Function, 0, 0 }, |
|
68 { "getBBox", JSSVGTextElement::GetBBoxFuncNum, DontDelete|Function, 0, 0 } |
|
69 }; |
|
70 |
|
71 static const HashTable JSSVGTextElementPrototypeTable = |
|
72 { |
|
73 2, 4, JSSVGTextElementPrototypeTableEntries, 4 |
|
74 }; |
|
75 |
|
76 const ClassInfo JSSVGTextElementPrototype::info = { "SVGTextElementPrototype", 0, &JSSVGTextElementPrototypeTable, 0 }; |
|
77 |
|
78 JSObject* JSSVGTextElementPrototype::self(ExecState* exec) |
|
79 { |
|
80 return KJS::cacheGlobalObject<JSSVGTextElementPrototype>(exec, "[[JSSVGTextElement.prototype]]"); |
|
81 } |
|
82 |
|
83 bool JSSVGTextElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
84 { |
|
85 return getStaticFunctionSlot<JSSVGTextElementPrototypeFunction, JSObject>(exec, &JSSVGTextElementPrototypeTable, this, propertyName, slot); |
|
86 } |
|
87 |
|
88 const ClassInfo JSSVGTextElement::info = { "SVGTextElement", &JSSVGTextPositioningElement::info, &JSSVGTextElementTable, 0 }; |
|
89 |
|
90 JSSVGTextElement::JSSVGTextElement(ExecState* exec, SVGTextElement* impl) |
|
91 : JSSVGTextPositioningElement(exec, impl) |
|
92 { |
|
93 setPrototype(JSSVGTextElementPrototype::self(exec)); |
|
94 } |
|
95 |
|
96 bool JSSVGTextElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
97 { |
|
98 return getStaticValueSlot<JSSVGTextElement, JSSVGTextPositioningElement>(exec, &JSSVGTextElementTable, this, propertyName, slot); |
|
99 } |
|
100 |
|
101 JSValue* JSSVGTextElement::getValueProperty(ExecState* exec, int token) const |
|
102 { |
|
103 switch (token) { |
|
104 case TransformAttrNum: { |
|
105 SVGTextElement* imp = static_cast<SVGTextElement*>(impl()); |
|
106 |
|
107 ASSERT(exec && exec->dynamicInterpreter()); |
|
108 |
|
109 RefPtr<SVGAnimatedTransformList> obj = imp->transformAnimated(); |
|
110 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); |
|
111 if (activeFrame) { |
|
112 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); |
|
113 if (extensions) { |
|
114 if (extensions->hasGenericContext<SVGAnimatedTransformList>(obj.get())) |
|
115 ASSERT(extensions->genericContext<SVGAnimatedTransformList>(obj.get()) == imp); |
|
116 else |
|
117 extensions->setGenericContext<SVGAnimatedTransformList>(obj.get(), imp); |
|
118 } |
|
119 } |
|
120 |
|
121 return toJS(exec, obj.get()); |
|
122 } |
|
123 case NearestViewportElementAttrNum: { |
|
124 SVGTextElement* imp = static_cast<SVGTextElement*>(impl()); |
|
125 |
|
126 return toJS(exec, WTF::getPtr(imp->nearestViewportElement())); |
|
127 } |
|
128 case FarthestViewportElementAttrNum: { |
|
129 SVGTextElement* imp = static_cast<SVGTextElement*>(impl()); |
|
130 |
|
131 return toJS(exec, WTF::getPtr(imp->farthestViewportElement())); |
|
132 } |
|
133 } |
|
134 return 0; |
|
135 } |
|
136 |
|
137 JSValue* JSSVGTextElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args) |
|
138 { |
|
139 if (!thisObj->inherits(&JSSVGTextElement::info)) |
|
140 return throwError(exec, TypeError); |
|
141 |
|
142 SVGTextElement* imp = static_cast<SVGTextElement*>(static_cast<JSSVGTextElement*>(thisObj)->impl()); |
|
143 |
|
144 switch (id) { |
|
145 case JSSVGTextElement::GetBBoxFuncNum: { |
|
146 |
|
147 |
|
148 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<FloatRect>(imp->getBBox())); |
|
149 return result; |
|
150 } |
|
151 case JSSVGTextElement::GetCTMFuncNum: { |
|
152 |
|
153 |
|
154 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getCTM())); |
|
155 return result; |
|
156 } |
|
157 case JSSVGTextElement::GetScreenCTMFuncNum: { |
|
158 |
|
159 |
|
160 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getScreenCTM())); |
|
161 return result; |
|
162 } |
|
163 case JSSVGTextElement::GetTransformToElementFuncNum: { |
|
164 ExceptionCode ec = 0; |
|
165 SVGElement* element = toSVGElement(args[0]); |
|
166 |
|
167 |
|
168 KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getTransformToElement(element, ec))); |
|
169 setDOMException(exec, ec); |
|
170 return result; |
|
171 } |
|
172 } |
|
173 return 0; |
|
174 } |
|
175 |
|
176 } |
|
177 |
|
178 #endif // ENABLE(SVG) |