webengine/osswebengine/DerivedSources/WebCore/JSSVGScriptElement.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 "JSSVGScriptElement.h"
       
    32 
       
    33 #include <wtf/GetPtr.h>
       
    34 
       
    35 #include "JSSVGAnimatedBoolean.h"
       
    36 #include "JSSVGAnimatedString.h"
       
    37 #include "PlatformString.h"
       
    38 #include "SVGScriptElement.h"
       
    39 
       
    40 using namespace KJS;
       
    41 
       
    42 namespace WebCore {
       
    43 
       
    44 /* Hash table */
       
    45 
       
    46 static const HashEntry JSSVGScriptElementTableEntries[] =
       
    47 {
       
    48     { 0, 0, 0, 0, 0 },
       
    49     { "type", JSSVGScriptElement::TypeAttrNum, DontDelete, 0, &JSSVGScriptElementTableEntries[3] },
       
    50     { "externalResourcesRequired", JSSVGScriptElement::ExternalResourcesRequiredAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    51     { "href", JSSVGScriptElement::HrefAttrNum, DontDelete|ReadOnly, 0, 0 }
       
    52 };
       
    53 
       
    54 static const HashTable JSSVGScriptElementTable = 
       
    55 {
       
    56     2, 4, JSSVGScriptElementTableEntries, 3
       
    57 };
       
    58 
       
    59 /* Hash table for prototype */
       
    60 
       
    61 static const HashEntry JSSVGScriptElementPrototypeTableEntries[] =
       
    62 {
       
    63     { 0, 0, 0, 0, 0 }
       
    64 };
       
    65 
       
    66 static const HashTable JSSVGScriptElementPrototypeTable = 
       
    67 {
       
    68     2, 1, JSSVGScriptElementPrototypeTableEntries, 1
       
    69 };
       
    70 
       
    71 const ClassInfo JSSVGScriptElementPrototype::info = { "SVGScriptElementPrototype", 0, &JSSVGScriptElementPrototypeTable, 0 };
       
    72 
       
    73 JSObject* JSSVGScriptElementPrototype::self(ExecState* exec)
       
    74 {
       
    75     return KJS::cacheGlobalObject<JSSVGScriptElementPrototype>(exec, "[[JSSVGScriptElement.prototype]]");
       
    76 }
       
    77 
       
    78 const ClassInfo JSSVGScriptElement::info = { "SVGScriptElement", &JSSVGElement::info, &JSSVGScriptElementTable, 0 };
       
    79 
       
    80 JSSVGScriptElement::JSSVGScriptElement(ExecState* exec, SVGScriptElement* impl)
       
    81     : JSSVGElement(exec, impl)
       
    82 {
       
    83     setPrototype(JSSVGScriptElementPrototype::self(exec));
       
    84 }
       
    85 
       
    86 bool JSSVGScriptElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    87 {
       
    88     return getStaticValueSlot<JSSVGScriptElement, JSSVGElement>(exec, &JSSVGScriptElementTable, this, propertyName, slot);
       
    89 }
       
    90 
       
    91 JSValue* JSSVGScriptElement::getValueProperty(ExecState* exec, int token) const
       
    92 {
       
    93     switch (token) {
       
    94     case TypeAttrNum: {
       
    95         SVGScriptElement* imp = static_cast<SVGScriptElement*>(impl());
       
    96 
       
    97         return jsString(imp->type());
       
    98     }
       
    99     case HrefAttrNum: {
       
   100         SVGScriptElement* imp = static_cast<SVGScriptElement*>(impl());
       
   101 
       
   102         ASSERT(exec && exec->dynamicInterpreter());
       
   103 
       
   104         RefPtr<SVGAnimatedString> obj = imp->hrefAnimated();
       
   105         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   106         if (activeFrame) {
       
   107             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   108             if (extensions) {
       
   109                 if (extensions->hasGenericContext<SVGAnimatedString>(obj.get()))
       
   110                     ASSERT(extensions->genericContext<SVGAnimatedString>(obj.get()) == imp);
       
   111                 else
       
   112                     extensions->setGenericContext<SVGAnimatedString>(obj.get(), imp);
       
   113             }
       
   114         }
       
   115 
       
   116         return toJS(exec, obj.get());
       
   117     }
       
   118     case ExternalResourcesRequiredAttrNum: {
       
   119         SVGScriptElement* imp = static_cast<SVGScriptElement*>(impl());
       
   120 
       
   121         ASSERT(exec && exec->dynamicInterpreter());
       
   122 
       
   123         RefPtr<SVGAnimatedBoolean> obj = imp->externalResourcesRequiredAnimated();
       
   124         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   125         if (activeFrame) {
       
   126             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   127             if (extensions) {
       
   128                 if (extensions->hasGenericContext<SVGAnimatedBoolean>(obj.get()))
       
   129                     ASSERT(extensions->genericContext<SVGAnimatedBoolean>(obj.get()) == imp);
       
   130                 else
       
   131                     extensions->setGenericContext<SVGAnimatedBoolean>(obj.get(), imp);
       
   132             }
       
   133         }
       
   134 
       
   135         return toJS(exec, obj.get());
       
   136     }
       
   137     }
       
   138     return 0;
       
   139 }
       
   140 
       
   141 void JSSVGScriptElement::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)
       
   142 {
       
   143     lookupPut<JSSVGScriptElement, JSSVGElement>(exec, propertyName, value, attr, &JSSVGScriptElementTable, this);
       
   144 }
       
   145 
       
   146 void JSSVGScriptElement::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/)
       
   147 {
       
   148     switch (token) {
       
   149     case TypeAttrNum: {
       
   150         SVGScriptElement* imp = static_cast<SVGScriptElement*>(impl());
       
   151 
       
   152         imp->setType(valueToStringWithNullCheck(exec, value));
       
   153         break;
       
   154     }
       
   155     }
       
   156 }
       
   157 
       
   158 
       
   159 }
       
   160 
       
   161 #endif // ENABLE(SVG)