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