webengine/osswebengine/DerivedSources/WebCore/JSCSSCharsetRule.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 #include "JSCSSCharsetRule.h"
       
    24 
       
    25 #include <wtf/GetPtr.h>
       
    26 
       
    27 #include "CSSCharsetRule.h"
       
    28 #include "PlatformString.h"
       
    29 
       
    30 using namespace KJS;
       
    31 
       
    32 namespace WebCore {
       
    33 
       
    34 /* Hash table */
       
    35 
       
    36 static const HashEntry JSCSSCharsetRuleTableEntries[] =
       
    37 {
       
    38     { 0, 0, 0, 0, 0 },
       
    39     { "encoding", JSCSSCharsetRule::EncodingAttrNum, DontDelete, 0, &JSCSSCharsetRuleTableEntries[2] },
       
    40     { "constructor", JSCSSCharsetRule::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 }
       
    41 };
       
    42 
       
    43 static const HashTable JSCSSCharsetRuleTable = 
       
    44 {
       
    45     2, 3, JSCSSCharsetRuleTableEntries, 2
       
    46 };
       
    47 
       
    48 /* Hash table for constructor */
       
    49 
       
    50 static const HashEntry JSCSSCharsetRuleConstructorTableEntries[] =
       
    51 {
       
    52     { 0, 0, 0, 0, 0 }
       
    53 };
       
    54 
       
    55 static const HashTable JSCSSCharsetRuleConstructorTable = 
       
    56 {
       
    57     2, 1, JSCSSCharsetRuleConstructorTableEntries, 1
       
    58 };
       
    59 
       
    60 class JSCSSCharsetRuleConstructor : public DOMObject {
       
    61 public:
       
    62     JSCSSCharsetRuleConstructor(ExecState* exec)
       
    63     {
       
    64         setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype());
       
    65         putDirect(exec->propertyNames().prototype, JSCSSCharsetRulePrototype::self(exec), None);
       
    66     }
       
    67     virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
       
    68     JSValue* getValueProperty(ExecState*, int token) const;
       
    69     virtual const ClassInfo* classInfo() const { return &info; }
       
    70     static const ClassInfo info;
       
    71 
       
    72     virtual bool implementsHasInstance() const { return true; }
       
    73 };
       
    74 
       
    75 const ClassInfo JSCSSCharsetRuleConstructor::info = { "CSSCharsetRuleConstructor", 0, &JSCSSCharsetRuleConstructorTable, 0 };
       
    76 
       
    77 bool JSCSSCharsetRuleConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    78 {
       
    79     return getStaticValueSlot<JSCSSCharsetRuleConstructor, DOMObject>(exec, &JSCSSCharsetRuleConstructorTable, this, propertyName, slot);
       
    80 }
       
    81 
       
    82 JSValue* JSCSSCharsetRuleConstructor::getValueProperty(ExecState*, int token) const
       
    83 {
       
    84     // The token is the numeric value of its associated constant
       
    85     return jsNumber(token);
       
    86 }
       
    87 
       
    88 /* Hash table for prototype */
       
    89 
       
    90 static const HashEntry JSCSSCharsetRulePrototypeTableEntries[] =
       
    91 {
       
    92     { 0, 0, 0, 0, 0 }
       
    93 };
       
    94 
       
    95 static const HashTable JSCSSCharsetRulePrototypeTable = 
       
    96 {
       
    97     2, 1, JSCSSCharsetRulePrototypeTableEntries, 1
       
    98 };
       
    99 
       
   100 const ClassInfo JSCSSCharsetRulePrototype::info = { "CSSCharsetRulePrototype", 0, &JSCSSCharsetRulePrototypeTable, 0 };
       
   101 
       
   102 JSObject* JSCSSCharsetRulePrototype::self(ExecState* exec)
       
   103 {
       
   104     return KJS::cacheGlobalObject<JSCSSCharsetRulePrototype>(exec, "[[JSCSSCharsetRule.prototype]]");
       
   105 }
       
   106 
       
   107 const ClassInfo JSCSSCharsetRule::info = { "CSSCharsetRule", &JSCSSRule::info, &JSCSSCharsetRuleTable, 0 };
       
   108 
       
   109 JSCSSCharsetRule::JSCSSCharsetRule(ExecState* exec, CSSCharsetRule* impl)
       
   110     : JSCSSRule(exec, impl)
       
   111 {
       
   112     setPrototype(JSCSSCharsetRulePrototype::self(exec));
       
   113 }
       
   114 
       
   115 bool JSCSSCharsetRule::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   116 {
       
   117     return getStaticValueSlot<JSCSSCharsetRule, JSCSSRule>(exec, &JSCSSCharsetRuleTable, this, propertyName, slot);
       
   118 }
       
   119 
       
   120 JSValue* JSCSSCharsetRule::getValueProperty(ExecState* exec, int token) const
       
   121 {
       
   122     switch (token) {
       
   123     case EncodingAttrNum: {
       
   124         CSSCharsetRule* imp = static_cast<CSSCharsetRule*>(impl());
       
   125 
       
   126         return jsStringOrNull(imp->encoding());
       
   127     }
       
   128     case ConstructorAttrNum:
       
   129         return getConstructor(exec);
       
   130     }
       
   131     return 0;
       
   132 }
       
   133 
       
   134 void JSCSSCharsetRule::put(ExecState* exec, const Identifier& propertyName, JSValue* value, int attr)
       
   135 {
       
   136     lookupPut<JSCSSCharsetRule, JSCSSRule>(exec, propertyName, value, attr, &JSCSSCharsetRuleTable, this);
       
   137 }
       
   138 
       
   139 void JSCSSCharsetRule::putValueProperty(ExecState* exec, int token, JSValue* value, int /*attr*/)
       
   140 {
       
   141     switch (token) {
       
   142     case EncodingAttrNum: {
       
   143         CSSCharsetRule* imp = static_cast<CSSCharsetRule*>(impl());
       
   144 
       
   145         ExceptionCode ec = 0;
       
   146         imp->setEncoding(valueToStringWithNullCheck(exec, value), ec);
       
   147         setDOMException(exec, ec);
       
   148         break;
       
   149     }
       
   150     }
       
   151 }
       
   152 
       
   153 JSValue* JSCSSCharsetRule::getConstructor(ExecState* exec)
       
   154 {
       
   155     return KJS::cacheGlobalObject<JSCSSCharsetRuleConstructor>(exec, "[[CSSCharsetRule.constructor]]");
       
   156 }
       
   157 
       
   158 }