webengine/osswebengine/DerivedSources/WebCore/JSSVGSwitchElement.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     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 "JSSVGSwitchElement.h"
       
    32 
       
    33 #include <wtf/GetPtr.h>
       
    34 
       
    35 #include "CSSMutableStyleDeclaration.h"
       
    36 #include "CSSStyleDeclaration.h"
       
    37 #include "JSCSSStyleDeclaration.h"
       
    38 #include "JSSVGAnimatedBoolean.h"
       
    39 #include "JSSVGAnimatedString.h"
       
    40 #include "JSSVGAnimatedTransformList.h"
       
    41 #include "JSSVGElement.h"
       
    42 #include "JSSVGMatrix.h"
       
    43 #include "JSSVGRect.h"
       
    44 #include "JSSVGStringList.h"
       
    45 #include "PlatformString.h"
       
    46 #include "SVGElement.h"
       
    47 #include "SVGStringList.h"
       
    48 #include "SVGSwitchElement.h"
       
    49 
       
    50 using namespace KJS;
       
    51 
       
    52 namespace WebCore {
       
    53 
       
    54 /* Hash table */
       
    55 
       
    56 static const HashEntry JSSVGSwitchElementTableEntries[] =
       
    57 {
       
    58     { 0, 0, 0, 0, 0 },
       
    59     { "farthestViewportElement", JSSVGSwitchElement::FarthestViewportElementAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    60     { "systemLanguage", JSSVGSwitchElement::SystemLanguageAttrNum, DontDelete|ReadOnly, 0, &JSSVGSwitchElementTableEntries[11] },
       
    61     { 0, 0, 0, 0, 0 },
       
    62     { "xmlspace", JSSVGSwitchElement::XmlspaceAttrNum, DontDelete, 0, 0 },
       
    63     { "requiredExtensions", JSSVGSwitchElement::RequiredExtensionsAttrNum, DontDelete|ReadOnly, 0, &JSSVGSwitchElementTableEntries[12] },
       
    64     { "nearestViewportElement", JSSVGSwitchElement::NearestViewportElementAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    65     { "style", JSSVGSwitchElement::StyleAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    66     { 0, 0, 0, 0, 0 },
       
    67     { "requiredFeatures", JSSVGSwitchElement::RequiredFeaturesAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    68     { 0, 0, 0, 0, 0 },
       
    69     { "xmllang", JSSVGSwitchElement::XmllangAttrNum, DontDelete, 0, &JSSVGSwitchElementTableEntries[14] },
       
    70     { "externalResourcesRequired", JSSVGSwitchElement::ExternalResourcesRequiredAttrNum, DontDelete|ReadOnly, 0, &JSSVGSwitchElementTableEntries[13] },
       
    71     { "className", JSSVGSwitchElement::ClassNameAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    72     { "transform", JSSVGSwitchElement::TransformAttrNum, DontDelete|ReadOnly, 0, 0 }
       
    73 };
       
    74 
       
    75 static const HashTable JSSVGSwitchElementTable = 
       
    76 {
       
    77     2, 15, JSSVGSwitchElementTableEntries, 11
       
    78 };
       
    79 
       
    80 /* Hash table for prototype */
       
    81 
       
    82 static const HashEntry JSSVGSwitchElementPrototypeTableEntries[] =
       
    83 {
       
    84     { "hasExtension", JSSVGSwitchElement::HasExtensionFuncNum, DontDelete|Function, 1, &JSSVGSwitchElementPrototypeTableEntries[6] },
       
    85     { 0, 0, 0, 0, 0 },
       
    86     { 0, 0, 0, 0, 0 },
       
    87     { "getBBox", JSSVGSwitchElement::GetBBoxFuncNum, DontDelete|Function, 0, &JSSVGSwitchElementPrototypeTableEntries[5] },
       
    88     { "getTransformToElement", JSSVGSwitchElement::GetTransformToElementFuncNum, DontDelete|Function, 1, 0 },
       
    89     { "getCTM", JSSVGSwitchElement::GetCTMFuncNum, DontDelete|Function, 0, 0 },
       
    90     { "getScreenCTM", JSSVGSwitchElement::GetScreenCTMFuncNum, DontDelete|Function, 0, 0 }
       
    91 };
       
    92 
       
    93 static const HashTable JSSVGSwitchElementPrototypeTable = 
       
    94 {
       
    95     2, 7, JSSVGSwitchElementPrototypeTableEntries, 5
       
    96 };
       
    97 
       
    98 const ClassInfo JSSVGSwitchElementPrototype::info = { "SVGSwitchElementPrototype", 0, &JSSVGSwitchElementPrototypeTable, 0 };
       
    99 
       
   100 JSObject* JSSVGSwitchElementPrototype::self(ExecState* exec)
       
   101 {
       
   102     return KJS::cacheGlobalObject<JSSVGSwitchElementPrototype>(exec, "[[JSSVGSwitchElement.prototype]]");
       
   103 }
       
   104 
       
   105 bool JSSVGSwitchElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   106 {
       
   107     return getStaticFunctionSlot<JSSVGSwitchElementPrototypeFunction, JSObject>(exec, &JSSVGSwitchElementPrototypeTable, this, propertyName, slot);
       
   108 }
       
   109 
       
   110 const ClassInfo JSSVGSwitchElement::info = { "SVGSwitchElement", &JSSVGElement::info, &JSSVGSwitchElementTable, 0 };
       
   111 
       
   112 JSSVGSwitchElement::JSSVGSwitchElement(ExecState* exec, SVGSwitchElement* impl)
       
   113     : JSSVGElement(exec, impl)
       
   114 {
       
   115     setPrototype(JSSVGSwitchElementPrototype::self(exec));
       
   116 }
       
   117 
       
   118 bool JSSVGSwitchElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   119 {
       
   120     return getStaticValueSlot<JSSVGSwitchElement, JSSVGElement>(exec, &JSSVGSwitchElementTable, this, propertyName, slot);
       
   121 }
       
   122 
       
   123 JSValue* JSSVGSwitchElement::getValueProperty(ExecState* exec, int token) const
       
   124 {
       
   125     switch (token) {
       
   126     case RequiredFeaturesAttrNum: {
       
   127         SVGSwitchElement* imp = static_cast<SVGSwitchElement*>(impl());
       
   128 
       
   129         return toJS(exec, WTF::getPtr(imp->requiredFeatures()));
       
   130     }
       
   131     case RequiredExtensionsAttrNum: {
       
   132         SVGSwitchElement* imp = static_cast<SVGSwitchElement*>(impl());
       
   133 
       
   134         return toJS(exec, WTF::getPtr(imp->requiredExtensions()));
       
   135     }
       
   136     case SystemLanguageAttrNum: {
       
   137         SVGSwitchElement* imp = static_cast<SVGSwitchElement*>(impl());
       
   138 
       
   139         return toJS(exec, WTF::getPtr(imp->systemLanguage()));
       
   140     }
       
   141     case XmllangAttrNum: {
       
   142         SVGSwitchElement* imp = static_cast<SVGSwitchElement*>(impl());
       
   143 
       
   144         return jsString(imp->xmllang());
       
   145     }
       
   146     case XmlspaceAttrNum: {
       
   147         SVGSwitchElement* imp = static_cast<SVGSwitchElement*>(impl());
       
   148 
       
   149         return jsString(imp->xmlspace());
       
   150     }
       
   151     case ExternalResourcesRequiredAttrNum: {
       
   152         SVGSwitchElement* imp = static_cast<SVGSwitchElement*>(impl());
       
   153 
       
   154         ASSERT(exec && exec->dynamicInterpreter());
       
   155 
       
   156         RefPtr<SVGAnimatedBoolean> obj = imp->externalResourcesRequiredAnimated();
       
   157         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   158         if (activeFrame) {
       
   159             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   160             if (extensions) {
       
   161                 if (extensions->hasGenericContext<SVGAnimatedBoolean>(obj.get()))
       
   162                     ASSERT(extensions->genericContext<SVGAnimatedBoolean>(obj.get()) == imp);
       
   163                 else
       
   164                     extensions->setGenericContext<SVGAnimatedBoolean>(obj.get(), imp);
       
   165             }
       
   166         }
       
   167 
       
   168         return toJS(exec, obj.get());
       
   169     }
       
   170     case ClassNameAttrNum: {
       
   171         SVGSwitchElement* imp = static_cast<SVGSwitchElement*>(impl());
       
   172 
       
   173         ASSERT(exec && exec->dynamicInterpreter());
       
   174 
       
   175         RefPtr<SVGAnimatedString> obj = imp->classNameAnimated();
       
   176         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   177         if (activeFrame) {
       
   178             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   179             if (extensions) {
       
   180                 if (extensions->hasGenericContext<SVGAnimatedString>(obj.get()))
       
   181                     ASSERT(extensions->genericContext<SVGAnimatedString>(obj.get()) == imp);
       
   182                 else
       
   183                     extensions->setGenericContext<SVGAnimatedString>(obj.get(), imp);
       
   184             }
       
   185         }
       
   186 
       
   187         return toJS(exec, obj.get());
       
   188     }
       
   189     case StyleAttrNum: {
       
   190         SVGSwitchElement* imp = static_cast<SVGSwitchElement*>(impl());
       
   191 
       
   192         return toJS(exec, WTF::getPtr(imp->style()));
       
   193     }
       
   194     case TransformAttrNum: {
       
   195         SVGSwitchElement* imp = static_cast<SVGSwitchElement*>(impl());
       
   196 
       
   197         ASSERT(exec && exec->dynamicInterpreter());
       
   198 
       
   199         RefPtr<SVGAnimatedTransformList> obj = imp->transformAnimated();
       
   200         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   201         if (activeFrame) {
       
   202             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   203             if (extensions) {
       
   204                 if (extensions->hasGenericContext<SVGAnimatedTransformList>(obj.get()))
       
   205                     ASSERT(extensions->genericContext<SVGAnimatedTransformList>(obj.get()) == imp);
       
   206                 else
       
   207                     extensions->setGenericContext<SVGAnimatedTransformList>(obj.get(), imp);
       
   208             }
       
   209         }
       
   210 
       
   211         return toJS(exec, obj.get());
       
   212     }
       
   213     case NearestViewportElementAttrNum: {
       
   214         SVGSwitchElement* imp = static_cast<SVGSwitchElement*>(impl());
       
   215 
       
   216         return toJS(exec, WTF::getPtr(imp->nearestViewportElement()));
       
   217     }
       
   218     case FarthestViewportElementAttrNum: {
       
   219         SVGSwitchElement* imp = static_cast<SVGSwitchElement*>(impl());
       
   220 
       
   221         return toJS(exec, WTF::getPtr(imp->farthestViewportElement()));
       
   222     }
       
   223     }
       
   224     return 0;
       
   225 }
       
   226 
       
   227 void JSSVGSwitchElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)
       
   228 {
       
   229     lookupPut<JSSVGSwitchElement, JSSVGElement>(exec, propertyName, value, attr, &JSSVGSwitchElementTable, this);
       
   230 }
       
   231 
       
   232 void JSSVGSwitchElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/)
       
   233 {
       
   234     switch (token) {
       
   235     case XmllangAttrNum: {
       
   236         SVGSwitchElement* imp = static_cast<SVGSwitchElement*>(impl());
       
   237 
       
   238         imp->setXmllang(value->toString(exec));
       
   239         break;
       
   240     }
       
   241     case XmlspaceAttrNum: {
       
   242         SVGSwitchElement* imp = static_cast<SVGSwitchElement*>(impl());
       
   243 
       
   244         imp->setXmlspace(value->toString(exec));
       
   245         break;
       
   246     }
       
   247     }
       
   248 }
       
   249 
       
   250 JSValue* JSSVGSwitchElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
       
   251 {
       
   252     if (!thisObj->inherits(&JSSVGSwitchElement::info))
       
   253       return throwError(exec, TypeError);
       
   254 
       
   255     SVGSwitchElement* imp = static_cast<SVGSwitchElement*>(static_cast<JSSVGSwitchElement*>(thisObj)->impl());
       
   256 
       
   257     switch (id) {
       
   258     case JSSVGSwitchElement::HasExtensionFuncNum: {
       
   259         String extension = args[0]->toString(exec);
       
   260 
       
   261 
       
   262         KJS::JSValue* result = jsBoolean(imp->hasExtension(extension));
       
   263         return result;
       
   264     }
       
   265     case JSSVGSwitchElement::GetBBoxFuncNum: {
       
   266 
       
   267 
       
   268         KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<FloatRect>(imp->getBBox()));
       
   269         return result;
       
   270     }
       
   271     case JSSVGSwitchElement::GetCTMFuncNum: {
       
   272 
       
   273 
       
   274         KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getCTM()));
       
   275         return result;
       
   276     }
       
   277     case JSSVGSwitchElement::GetScreenCTMFuncNum: {
       
   278 
       
   279 
       
   280         KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getScreenCTM()));
       
   281         return result;
       
   282     }
       
   283     case JSSVGSwitchElement::GetTransformToElementFuncNum: {
       
   284         ExceptionCode ec = 0;
       
   285         SVGElement* element = toSVGElement(args[0]);
       
   286 
       
   287 
       
   288         KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getTransformToElement(element, ec)));
       
   289         setDOMException(exec, ec);
       
   290         return result;
       
   291     }
       
   292     }
       
   293     return 0;
       
   294 }
       
   295 
       
   296 }
       
   297 
       
   298 #endif // ENABLE(SVG)