webengine/osswebengine/DerivedSources/WebCore/JSSVGGradientElement.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 "JSSVGGradientElement.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 "JSSVGAnimatedEnumeration.h"
       
    40 #include "JSSVGAnimatedString.h"
       
    41 #include "JSSVGAnimatedTransformList.h"
       
    42 #include "SVGGradientElement.h"
       
    43 
       
    44 using namespace KJS;
       
    45 
       
    46 namespace WebCore {
       
    47 
       
    48 /* Hash table */
       
    49 
       
    50 static const HashEntry JSSVGGradientElementTableEntries[] =
       
    51 {
       
    52     { 0, 0, 0, 0, 0 },
       
    53     { "spreadMethod", JSSVGGradientElement::SpreadMethodAttrNum, DontDelete|ReadOnly, 0, &JSSVGGradientElementTableEntries[8] },
       
    54     { "gradientUnits", JSSVGGradientElement::GradientUnitsAttrNum, DontDelete|ReadOnly, 0, &JSSVGGradientElementTableEntries[7] },
       
    55     { "gradientTransform", JSSVGGradientElement::GradientTransformAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    56     { 0, 0, 0, 0, 0 },
       
    57     { 0, 0, 0, 0, 0 },
       
    58     { "href", JSSVGGradientElement::HrefAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    59     { "externalResourcesRequired", JSSVGGradientElement::ExternalResourcesRequiredAttrNum, DontDelete|ReadOnly, 0, &JSSVGGradientElementTableEntries[9] },
       
    60     { "className", JSSVGGradientElement::ClassNameAttrNum, DontDelete|ReadOnly, 0, 0 },
       
    61     { "style", JSSVGGradientElement::StyleAttrNum, DontDelete|ReadOnly, 0, 0 }
       
    62 };
       
    63 
       
    64 static const HashTable JSSVGGradientElementTable = 
       
    65 {
       
    66     2, 10, JSSVGGradientElementTableEntries, 7
       
    67 };
       
    68 
       
    69 /* Hash table for prototype */
       
    70 
       
    71 static const HashEntry JSSVGGradientElementPrototypeTableEntries[] =
       
    72 {
       
    73     { "SVG_SPREADMETHOD_UNKNOWN", SVGGradientElement::SVG_SPREADMETHOD_UNKNOWN, DontDelete|ReadOnly, 0, 0 },
       
    74     { 0, 0, 0, 0, 0 },
       
    75     { "SVG_SPREADMETHOD_REPEAT", SVGGradientElement::SVG_SPREADMETHOD_REPEAT, DontDelete|ReadOnly, 0, 0 },
       
    76     { "SVG_SPREADMETHOD_PAD", SVGGradientElement::SVG_SPREADMETHOD_PAD, DontDelete|ReadOnly, 0, &JSSVGGradientElementPrototypeTableEntries[4] },
       
    77     { "SVG_SPREADMETHOD_REFLECT", SVGGradientElement::SVG_SPREADMETHOD_REFLECT, DontDelete|ReadOnly, 0, 0 }
       
    78 };
       
    79 
       
    80 static const HashTable JSSVGGradientElementPrototypeTable = 
       
    81 {
       
    82     2, 5, JSSVGGradientElementPrototypeTableEntries, 4
       
    83 };
       
    84 
       
    85 const ClassInfo JSSVGGradientElementPrototype::info = { "SVGGradientElementPrototype", 0, &JSSVGGradientElementPrototypeTable, 0 };
       
    86 
       
    87 JSObject* JSSVGGradientElementPrototype::self(ExecState* exec)
       
    88 {
       
    89     return KJS::cacheGlobalObject<JSSVGGradientElementPrototype>(exec, "[[JSSVGGradientElement.prototype]]");
       
    90 }
       
    91 
       
    92 bool JSSVGGradientElementPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    93 {
       
    94     return getStaticValueSlot<JSSVGGradientElementPrototype, JSObject>(exec, &JSSVGGradientElementPrototypeTable, this, propertyName, slot);
       
    95 }
       
    96 
       
    97 JSValue* JSSVGGradientElementPrototype::getValueProperty(ExecState*, int token) const
       
    98 {
       
    99     // The token is the numeric value of its associated constant
       
   100     return jsNumber(token);
       
   101 }
       
   102 
       
   103 const ClassInfo JSSVGGradientElement::info = { "SVGGradientElement", &JSSVGElement::info, &JSSVGGradientElementTable, 0 };
       
   104 
       
   105 JSSVGGradientElement::JSSVGGradientElement(ExecState* exec, SVGGradientElement* impl)
       
   106     : JSSVGElement(exec, impl)
       
   107 {
       
   108     setPrototype(JSSVGGradientElementPrototype::self(exec));
       
   109 }
       
   110 
       
   111 bool JSSVGGradientElement::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   112 {
       
   113     return getStaticValueSlot<JSSVGGradientElement, JSSVGElement>(exec, &JSSVGGradientElementTable, this, propertyName, slot);
       
   114 }
       
   115 
       
   116 JSValue* JSSVGGradientElement::getValueProperty(ExecState* exec, int token) const
       
   117 {
       
   118     switch (token) {
       
   119     case GradientUnitsAttrNum: {
       
   120         SVGGradientElement* imp = static_cast<SVGGradientElement*>(impl());
       
   121 
       
   122         ASSERT(exec && exec->dynamicInterpreter());
       
   123 
       
   124         RefPtr<SVGAnimatedEnumeration> obj = imp->gradientUnitsAnimated();
       
   125         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   126         if (activeFrame) {
       
   127             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   128             if (extensions) {
       
   129                 if (extensions->hasGenericContext<SVGAnimatedEnumeration>(obj.get()))
       
   130                     ASSERT(extensions->genericContext<SVGAnimatedEnumeration>(obj.get()) == imp);
       
   131                 else
       
   132                     extensions->setGenericContext<SVGAnimatedEnumeration>(obj.get(), imp);
       
   133             }
       
   134         }
       
   135 
       
   136         return toJS(exec, obj.get());
       
   137     }
       
   138     case GradientTransformAttrNum: {
       
   139         SVGGradientElement* imp = static_cast<SVGGradientElement*>(impl());
       
   140 
       
   141         ASSERT(exec && exec->dynamicInterpreter());
       
   142 
       
   143         RefPtr<SVGAnimatedTransformList> obj = imp->gradientTransformAnimated();
       
   144         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   145         if (activeFrame) {
       
   146             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   147             if (extensions) {
       
   148                 if (extensions->hasGenericContext<SVGAnimatedTransformList>(obj.get()))
       
   149                     ASSERT(extensions->genericContext<SVGAnimatedTransformList>(obj.get()) == imp);
       
   150                 else
       
   151                     extensions->setGenericContext<SVGAnimatedTransformList>(obj.get(), imp);
       
   152             }
       
   153         }
       
   154 
       
   155         return toJS(exec, obj.get());
       
   156     }
       
   157     case SpreadMethodAttrNum: {
       
   158         SVGGradientElement* imp = static_cast<SVGGradientElement*>(impl());
       
   159 
       
   160         ASSERT(exec && exec->dynamicInterpreter());
       
   161 
       
   162         RefPtr<SVGAnimatedEnumeration> obj = imp->spreadMethodAnimated();
       
   163         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   164         if (activeFrame) {
       
   165             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   166             if (extensions) {
       
   167                 if (extensions->hasGenericContext<SVGAnimatedEnumeration>(obj.get()))
       
   168                     ASSERT(extensions->genericContext<SVGAnimatedEnumeration>(obj.get()) == imp);
       
   169                 else
       
   170                     extensions->setGenericContext<SVGAnimatedEnumeration>(obj.get(), imp);
       
   171             }
       
   172         }
       
   173 
       
   174         return toJS(exec, obj.get());
       
   175     }
       
   176     case HrefAttrNum: {
       
   177         SVGGradientElement* imp = static_cast<SVGGradientElement*>(impl());
       
   178 
       
   179         ASSERT(exec && exec->dynamicInterpreter());
       
   180 
       
   181         RefPtr<SVGAnimatedString> obj = imp->hrefAnimated();
       
   182         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   183         if (activeFrame) {
       
   184             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   185             if (extensions) {
       
   186                 if (extensions->hasGenericContext<SVGAnimatedString>(obj.get()))
       
   187                     ASSERT(extensions->genericContext<SVGAnimatedString>(obj.get()) == imp);
       
   188                 else
       
   189                     extensions->setGenericContext<SVGAnimatedString>(obj.get(), imp);
       
   190             }
       
   191         }
       
   192 
       
   193         return toJS(exec, obj.get());
       
   194     }
       
   195     case ExternalResourcesRequiredAttrNum: {
       
   196         SVGGradientElement* imp = static_cast<SVGGradientElement*>(impl());
       
   197 
       
   198         ASSERT(exec && exec->dynamicInterpreter());
       
   199 
       
   200         RefPtr<SVGAnimatedBoolean> obj = imp->externalResourcesRequiredAnimated();
       
   201         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   202         if (activeFrame) {
       
   203             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   204             if (extensions) {
       
   205                 if (extensions->hasGenericContext<SVGAnimatedBoolean>(obj.get()))
       
   206                     ASSERT(extensions->genericContext<SVGAnimatedBoolean>(obj.get()) == imp);
       
   207                 else
       
   208                     extensions->setGenericContext<SVGAnimatedBoolean>(obj.get(), imp);
       
   209             }
       
   210         }
       
   211 
       
   212         return toJS(exec, obj.get());
       
   213     }
       
   214     case ClassNameAttrNum: {
       
   215         SVGGradientElement* imp = static_cast<SVGGradientElement*>(impl());
       
   216 
       
   217         ASSERT(exec && exec->dynamicInterpreter());
       
   218 
       
   219         RefPtr<SVGAnimatedString> obj = imp->classNameAnimated();
       
   220         Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();
       
   221         if (activeFrame) {
       
   222             SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);
       
   223             if (extensions) {
       
   224                 if (extensions->hasGenericContext<SVGAnimatedString>(obj.get()))
       
   225                     ASSERT(extensions->genericContext<SVGAnimatedString>(obj.get()) == imp);
       
   226                 else
       
   227                     extensions->setGenericContext<SVGAnimatedString>(obj.get(), imp);
       
   228             }
       
   229         }
       
   230 
       
   231         return toJS(exec, obj.get());
       
   232     }
       
   233     case StyleAttrNum: {
       
   234         SVGGradientElement* imp = static_cast<SVGGradientElement*>(impl());
       
   235 
       
   236         return toJS(exec, WTF::getPtr(imp->style()));
       
   237     }
       
   238     }
       
   239     return 0;
       
   240 }
       
   241 
       
   242 
       
   243 }
       
   244 
       
   245 #endif // ENABLE(SVG)