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