webengine/osswebengine/DerivedSources/WebCore/JSSVGRectElement.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 "JSSVGRectElement.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 "JSSVGAnimatedLength.h"
       
    40 #include "JSSVGAnimatedString.h"
       
    41 #include "JSSVGAnimatedTransformList.h"
       
    42 #include "JSSVGElement.h"
       
    43 #include "JSSVGMatrix.h"
       
    44 #include "JSSVGRect.h"
       
    45 #include "JSSVGStringList.h"
       
    46 #include "PlatformString.h"
       
    47 #include "SVGElement.h"
       
    48 #include "SVGRectElement.h"
       
    49 #include "SVGStringList.h"
       
    50 
       
    51 using namespace KJS;
       
    52 
       
    53 namespace WebCore {
       
    54 
       
    55 /* Hash table */
       
    56 
       
    57 static const HashEntry JSSVGRectElementTableEntries[] =
       
    58 {
       
    59     { "height", JSSVGRectElement::HeightAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    60     { "requiredFeatures", JSSVGRectElement::RequiredFeaturesAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    61     { "systemLanguage", JSSVGRectElement::SystemLanguageAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    62     { "farthestViewportElement", JSSVGRectElement::FarthestViewportElementAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    63     { 0, 0, 0, 0, 0 },
       
    64     { "x", JSSVGRectElement::XAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    65     { 0, 0, 0, 0, 0 },
       
    66     { "ry", JSSVGRectElement::RyAttrNum, DontDelete|ReadOnly, 0, &JSSVGRectElementTableEntries[19] },
       
    67     { 0, 0, 0, 0, 0 },
       
    68     { "requiredExtensions", JSSVGRectElement::RequiredExtensionsAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    69     { "width", JSSVGRectElement::WidthAttrNum, DontDelete|ReadOnly, 0, &JSSVGRectElementTableEntries[21] },
       
    70     { "y", JSSVGRectElement::YAttrNum, DontDelete|ReadOnly, 0, &JSSVGRectElementTableEntries[17] },
       
    71     { "transform", JSSVGRectElement::TransformAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    72     { 0, 0, 0, 0, 0 },
       
    73     { "rx", JSSVGRectElement::RxAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    74     { "style", JSSVGRectElement::StyleAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    75     { 0, 0, 0, 0, 0 },
       
    76     { "xmllang", JSSVGRectElement::XmllangAttrNum, DontDelete, 0, &JSSVGRectElementTableEntries[18] },
       
    77     { "xmlspace", JSSVGRectElement::XmlspaceAttrNum, DontDelete, 0, &JSSVGRectElementTableEntries[20] },
       
    78     { "externalResourcesRequired", JSSVGRectElement::ExternalResourcesRequiredAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    79     { "className", JSSVGRectElement::ClassNameAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    80     { "nearestViewportElement", JSSVGRectElement::NearestViewportElementAttrNum, DontDelete|ReadOnly, 0, 0 }
       
    81 };
       
    82 
       
    83 static const HashTable JSSVGRectElementTable = 
       
    84 {
       
    85     2, 22, JSSVGRectElementTableEntries, 17
       
    86 };
       
    87 
       
    88 /* Hash table for prototype */
       
    89 
       
    90 static const HashEntry JSSVGRectElementPrototypeTableEntries[] =
       
    91 {
       
    92     { "hasExtension", JSSVGRectElement::HasExtensionFuncNum, DontDelete|Function, 1, &JSSVGRectElementPrototypeTableEntries[6] },
       
    93     { 0, 0, 0, 0, 0 },
       
    94     { 0, 0, 0, 0, 0 },
       
    95     { "getBBox", JSSVGRectElement::GetBBoxFuncNum, DontDelete|Function, 0, &JSSVGRectElementPrototypeTableEntries[5] },
       
    96     { "getTransformToElement", JSSVGRectElement::GetTransformToElementFuncNum, DontDelete|Function, 1, 0 },
       
    97     { "getCTM", JSSVGRectElement::GetCTMFuncNum, DontDelete|Function, 0, 0 },
       
    98     { "getScreenCTM", JSSVGRectElement::GetScreenCTMFuncNum, DontDelete|Function, 0, 0 }
       
    99 };
       
   100 
       
   101 static const HashTable JSSVGRectElementPrototypeTable = 
       
   102 {
       
   103     2, 7, JSSVGRectElementPrototypeTableEntries, 5
       
   104 };
       
   105 
       
   106 const ClassInfo JSSVGRectElementPrototype::info = { "SVGRectElementPrototype", 0, &JSSVGRectElementPrototypeTable, 0 };
       
   107 
       
   108 JSObject* JSSVGRectElementPrototype::self(ExecState* exec)
       
   109 {
       
   110     return KJS::cacheGlobalObject<JSSVGRectElementPrototype>(exec, "[[JSSVGRectElement.prototype]]");
       
   111 }
       
   112 
       
   113 bool JSSVGRectElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   114 {
       
   115     return getStaticFunctionSlot<JSSVGRectElementPrototypeFunction, JSObject>(exec, &JSSVGRectElementPrototypeTable, this, propertyName, slot);
       
   116 }
       
   117 
       
   118 const ClassInfo JSSVGRectElement::info = { "SVGRectElement", &JSSVGElement::info, &JSSVGRectElementTable, 0 };
       
   119 
       
   120 JSSVGRectElement::JSSVGRectElement(ExecState* exec, SVGRectElement* impl)
       
   121     : JSSVGElement(exec, impl)
       
   122 {
       
   123     setPrototype(JSSVGRectElementPrototype::self(exec));
       
   124 }
       
   125 
       
   126 bool JSSVGRectElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   127 {
       
   128     return getStaticValueSlot<JSSVGRectElement, JSSVGElement>(exec, &JSSVGRectElementTable, this, propertyName, slot);
       
   129 }
       
   130 
       
   131 JSValue* JSSVGRectElement::getValueProperty(ExecState* exec, int token) const
       
   132 {
       
   133     switch (token) {
       
   134     case XAttrNum: {
       
   135         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   136 
       
   137         ASSERT(exec && exec->dynamicInterpreter());
       
   138 
       
   139         RefPtr<SVGAnimatedLength> obj = imp->xAnimated();
       
   140         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   141         if (activeFrame) {
       
   142             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   143             if (extensions) {
       
   144                 if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))
       
   145                     ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);
       
   146                 else
       
   147                     extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);
       
   148             }
       
   149         }
       
   150 
       
   151         return toJS(exec, obj.get());
       
   152     }
       
   153     case YAttrNum: {
       
   154         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   155 
       
   156         ASSERT(exec && exec->dynamicInterpreter());
       
   157 
       
   158         RefPtr<SVGAnimatedLength> obj = imp->yAnimated();
       
   159         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   160         if (activeFrame) {
       
   161             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   162             if (extensions) {
       
   163                 if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))
       
   164                     ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);
       
   165                 else
       
   166                     extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);
       
   167             }
       
   168         }
       
   169 
       
   170         return toJS(exec, obj.get());
       
   171     }
       
   172     case WidthAttrNum: {
       
   173         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   174 
       
   175         ASSERT(exec && exec->dynamicInterpreter());
       
   176 
       
   177         RefPtr<SVGAnimatedLength> obj = imp->widthAnimated();
       
   178         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   179         if (activeFrame) {
       
   180             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   181             if (extensions) {
       
   182                 if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))
       
   183                     ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);
       
   184                 else
       
   185                     extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);
       
   186             }
       
   187         }
       
   188 
       
   189         return toJS(exec, obj.get());
       
   190     }
       
   191     case HeightAttrNum: {
       
   192         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   193 
       
   194         ASSERT(exec && exec->dynamicInterpreter());
       
   195 
       
   196         RefPtr<SVGAnimatedLength> obj = imp->heightAnimated();
       
   197         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   198         if (activeFrame) {
       
   199             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   200             if (extensions) {
       
   201                 if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))
       
   202                     ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);
       
   203                 else
       
   204                     extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);
       
   205             }
       
   206         }
       
   207 
       
   208         return toJS(exec, obj.get());
       
   209     }
       
   210     case RxAttrNum: {
       
   211         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   212 
       
   213         ASSERT(exec && exec->dynamicInterpreter());
       
   214 
       
   215         RefPtr<SVGAnimatedLength> obj = imp->rxAnimated();
       
   216         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   217         if (activeFrame) {
       
   218             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   219             if (extensions) {
       
   220                 if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))
       
   221                     ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);
       
   222                 else
       
   223                     extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);
       
   224             }
       
   225         }
       
   226 
       
   227         return toJS(exec, obj.get());
       
   228     }
       
   229     case RyAttrNum: {
       
   230         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   231 
       
   232         ASSERT(exec && exec->dynamicInterpreter());
       
   233 
       
   234         RefPtr<SVGAnimatedLength> obj = imp->ryAnimated();
       
   235         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   236         if (activeFrame) {
       
   237             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   238             if (extensions) {
       
   239                 if (extensions->hasGenericContext<SVGAnimatedLength>(obj.get()))
       
   240                     ASSERT(extensions->genericContext<SVGAnimatedLength>(obj.get()) == imp);
       
   241                 else
       
   242                     extensions->setGenericContext<SVGAnimatedLength>(obj.get(), imp);
       
   243             }
       
   244         }
       
   245 
       
   246         return toJS(exec, obj.get());
       
   247     }
       
   248     case RequiredFeaturesAttrNum: {
       
   249         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   250 
       
   251         return toJS(exec, WTF::getPtr(imp->requiredFeatures()));
       
   252     }
       
   253     case RequiredExtensionsAttrNum: {
       
   254         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   255 
       
   256         return toJS(exec, WTF::getPtr(imp->requiredExtensions()));
       
   257     }
       
   258     case SystemLanguageAttrNum: {
       
   259         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   260 
       
   261         return toJS(exec, WTF::getPtr(imp->systemLanguage()));
       
   262     }
       
   263     case XmllangAttrNum: {
       
   264         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   265 
       
   266         return jsString(imp->xmllang());
       
   267     }
       
   268     case XmlspaceAttrNum: {
       
   269         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   270 
       
   271         return jsString(imp->xmlspace());
       
   272     }
       
   273     case ExternalResourcesRequiredAttrNum: {
       
   274         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   275 
       
   276         ASSERT(exec && exec->dynamicInterpreter());
       
   277 
       
   278         RefPtr<SVGAnimatedBoolean> obj = imp->externalResourcesRequiredAnimated();
       
   279         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   280         if (activeFrame) {
       
   281             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   282             if (extensions) {
       
   283                 if (extensions->hasGenericContext<SVGAnimatedBoolean>(obj.get()))
       
   284                     ASSERT(extensions->genericContext<SVGAnimatedBoolean>(obj.get()) == imp);
       
   285                 else
       
   286                     extensions->setGenericContext<SVGAnimatedBoolean>(obj.get(), imp);
       
   287             }
       
   288         }
       
   289 
       
   290         return toJS(exec, obj.get());
       
   291     }
       
   292     case ClassNameAttrNum: {
       
   293         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   294 
       
   295         ASSERT(exec && exec->dynamicInterpreter());
       
   296 
       
   297         RefPtr<SVGAnimatedString> obj = imp->classNameAnimated();
       
   298         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   299         if (activeFrame) {
       
   300             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   301             if (extensions) {
       
   302                 if (extensions->hasGenericContext<SVGAnimatedString>(obj.get()))
       
   303                     ASSERT(extensions->genericContext<SVGAnimatedString>(obj.get()) == imp);
       
   304                 else
       
   305                     extensions->setGenericContext<SVGAnimatedString>(obj.get(), imp);
       
   306             }
       
   307         }
       
   308 
       
   309         return toJS(exec, obj.get());
       
   310     }
       
   311     case StyleAttrNum: {
       
   312         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   313 
       
   314         return toJS(exec, WTF::getPtr(imp->style()));
       
   315     }
       
   316     case TransformAttrNum: {
       
   317         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   318 
       
   319         ASSERT(exec && exec->dynamicInterpreter());
       
   320 
       
   321         RefPtr<SVGAnimatedTransformList> obj = imp->transformAnimated();
       
   322         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   323         if (activeFrame) {
       
   324             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   325             if (extensions) {
       
   326                 if (extensions->hasGenericContext<SVGAnimatedTransformList>(obj.get()))
       
   327                     ASSERT(extensions->genericContext<SVGAnimatedTransformList>(obj.get()) == imp);
       
   328                 else
       
   329                     extensions->setGenericContext<SVGAnimatedTransformList>(obj.get(), imp);
       
   330             }
       
   331         }
       
   332 
       
   333         return toJS(exec, obj.get());
       
   334     }
       
   335     case NearestViewportElementAttrNum: {
       
   336         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   337 
       
   338         return toJS(exec, WTF::getPtr(imp->nearestViewportElement()));
       
   339     }
       
   340     case FarthestViewportElementAttrNum: {
       
   341         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   342 
       
   343         return toJS(exec, WTF::getPtr(imp->farthestViewportElement()));
       
   344     }
       
   345     }
       
   346     return 0;
       
   347 }
       
   348 
       
   349 void JSSVGRectElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)
       
   350 {
       
   351     lookupPut<JSSVGRectElement, JSSVGElement>(exec, propertyName, value, attr, &JSSVGRectElementTable, this);
       
   352 }
       
   353 
       
   354 void JSSVGRectElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/)
       
   355 {
       
   356     switch (token) {
       
   357     case XmllangAttrNum: {
       
   358         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   359 
       
   360         imp->setXmllang(value->toString(exec));
       
   361         break;
       
   362     }
       
   363     case XmlspaceAttrNum: {
       
   364         SVGRectElement* imp = static_cast<SVGRectElement*>(impl());
       
   365 
       
   366         imp->setXmlspace(value->toString(exec));
       
   367         break;
       
   368     }
       
   369     }
       
   370 }
       
   371 
       
   372 JSValue* JSSVGRectElementPrototypeFunction::callAsFunction(ExecState* exec, JSObject* thisObj, const List& args)
       
   373 {
       
   374     if (!thisObj->inherits(&JSSVGRectElement::info))
       
   375       return throwError(exec, TypeError);
       
   376 
       
   377     SVGRectElement* imp = static_cast<SVGRectElement*>(static_cast<JSSVGRectElement*>(thisObj)->impl());
       
   378 
       
   379     switch (id) {
       
   380     case JSSVGRectElement::HasExtensionFuncNum: {
       
   381         String extension = args[0]->toString(exec);
       
   382 
       
   383 
       
   384         KJS::JSValue* result = jsBoolean(imp->hasExtension(extension));
       
   385         return result;
       
   386     }
       
   387     case JSSVGRectElement::GetBBoxFuncNum: {
       
   388 
       
   389 
       
   390         KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<FloatRect>(imp->getBBox()));
       
   391         return result;
       
   392     }
       
   393     case JSSVGRectElement::GetCTMFuncNum: {
       
   394 
       
   395 
       
   396         KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getCTM()));
       
   397         return result;
       
   398     }
       
   399     case JSSVGRectElement::GetScreenCTMFuncNum: {
       
   400 
       
   401 
       
   402         KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getScreenCTM()));
       
   403         return result;
       
   404     }
       
   405     case JSSVGRectElement::GetTransformToElementFuncNum: {
       
   406         ExceptionCode ec = 0;
       
   407         SVGElement* element = toSVGElement(args[0]);
       
   408 
       
   409 
       
   410         KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp->getTransformToElement(element, ec)));
       
   411         setDOMException(exec, ec);
       
   412         return result;
       
   413     }
       
   414     }
       
   415     return 0;
       
   416 }
       
   417 
       
   418 }
       
   419 
       
   420 #endif // ENABLE(SVG)