WebCore/generated/JSCSSRule.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     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 #include "JSCSSRule.h"
       
    23 
       
    24 #include "CSSRule.h"
       
    25 #include "CSSStyleSheet.h"
       
    26 #include "JSCSSRule.h"
       
    27 #include "JSCSSStyleSheet.h"
       
    28 #include "KURL.h"
       
    29 #include <runtime/JSNumberCell.h>
       
    30 #include <wtf/GetPtr.h>
       
    31 
       
    32 using namespace JSC;
       
    33 
       
    34 namespace WebCore {
       
    35 
       
    36 ASSERT_CLASS_FITS_IN_CELL(JSCSSRule);
       
    37 
       
    38 /* Hash table */
       
    39 #if ENABLE(JIT)
       
    40 #define THUNK_GENERATOR(generator) , generator
       
    41 #else
       
    42 #define THUNK_GENERATOR(generator)
       
    43 #endif
       
    44 
       
    45 static const HashTableValue JSCSSRuleTableValues[6] =
       
    46 {
       
    47     { "type", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleType), (intptr_t)0 THUNK_GENERATOR(0) },
       
    48     { "cssText", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleCssText), (intptr_t)setJSCSSRuleCssText THUNK_GENERATOR(0) },
       
    49     { "parentStyleSheet", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleParentStyleSheet), (intptr_t)0 THUNK_GENERATOR(0) },
       
    50     { "parentRule", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleParentRule), (intptr_t)0 THUNK_GENERATOR(0) },
       
    51     { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
       
    52     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    53 };
       
    54 
       
    55 #undef THUNK_GENERATOR
       
    56 static JSC_CONST_HASHTABLE HashTable JSCSSRuleTable = { 17, 15, JSCSSRuleTableValues, 0 };
       
    57 /* Hash table for constructor */
       
    58 #if ENABLE(JIT)
       
    59 #define THUNK_GENERATOR(generator) , generator
       
    60 #else
       
    61 #define THUNK_GENERATOR(generator)
       
    62 #endif
       
    63 
       
    64 static const HashTableValue JSCSSRuleConstructorTableValues[11] =
       
    65 {
       
    66     { "UNKNOWN_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleUNKNOWN_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    67     { "STYLE_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleSTYLE_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    68     { "CHARSET_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleCHARSET_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    69     { "IMPORT_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleIMPORT_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    70     { "MEDIA_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleMEDIA_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    71     { "FONT_FACE_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleFONT_FACE_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    72     { "PAGE_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRulePAGE_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    73     { "VARIABLES_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleVARIABLES_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    74     { "WEBKIT_KEYFRAMES_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleWEBKIT_KEYFRAMES_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    75     { "WEBKIT_KEYFRAME_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleWEBKIT_KEYFRAME_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
    76     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    77 };
       
    78 
       
    79 #undef THUNK_GENERATOR
       
    80 static JSC_CONST_HASHTABLE HashTable JSCSSRuleConstructorTable = { 34, 31, JSCSSRuleConstructorTableValues, 0 };
       
    81 
       
    82 COMPILE_ASSERT(0 == CSSRule::UNKNOWN_RULE, CSSRuleEnumUNKNOWN_RULEIsWrongUseDontCheckEnums);
       
    83 COMPILE_ASSERT(1 == CSSRule::STYLE_RULE, CSSRuleEnumSTYLE_RULEIsWrongUseDontCheckEnums);
       
    84 COMPILE_ASSERT(2 == CSSRule::CHARSET_RULE, CSSRuleEnumCHARSET_RULEIsWrongUseDontCheckEnums);
       
    85 COMPILE_ASSERT(3 == CSSRule::IMPORT_RULE, CSSRuleEnumIMPORT_RULEIsWrongUseDontCheckEnums);
       
    86 COMPILE_ASSERT(4 == CSSRule::MEDIA_RULE, CSSRuleEnumMEDIA_RULEIsWrongUseDontCheckEnums);
       
    87 COMPILE_ASSERT(5 == CSSRule::FONT_FACE_RULE, CSSRuleEnumFONT_FACE_RULEIsWrongUseDontCheckEnums);
       
    88 COMPILE_ASSERT(6 == CSSRule::PAGE_RULE, CSSRuleEnumPAGE_RULEIsWrongUseDontCheckEnums);
       
    89 COMPILE_ASSERT(7 == CSSRule::VARIABLES_RULE, CSSRuleEnumVARIABLES_RULEIsWrongUseDontCheckEnums);
       
    90 COMPILE_ASSERT(8 == CSSRule::WEBKIT_KEYFRAMES_RULE, CSSRuleEnumWEBKIT_KEYFRAMES_RULEIsWrongUseDontCheckEnums);
       
    91 COMPILE_ASSERT(9 == CSSRule::WEBKIT_KEYFRAME_RULE, CSSRuleEnumWEBKIT_KEYFRAME_RULEIsWrongUseDontCheckEnums);
       
    92 
       
    93 class JSCSSRuleConstructor : public DOMConstructorObject {
       
    94 public:
       
    95     JSCSSRuleConstructor(JSC::ExecState*, JSDOMGlobalObject*);
       
    96 
       
    97     virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
       
    98     virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
       
    99     virtual const JSC::ClassInfo* classInfo() const { return &s_info; }
       
   100     static const JSC::ClassInfo s_info;
       
   101     static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)
       
   102     {
       
   103         return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount);
       
   104     }
       
   105 protected:
       
   106     static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
       
   107 };
       
   108 
       
   109 const ClassInfo JSCSSRuleConstructor::s_info = { "CSSRuleConstructor", 0, &JSCSSRuleConstructorTable, 0 };
       
   110 
       
   111 JSCSSRuleConstructor::JSCSSRuleConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
       
   112     : DOMConstructorObject(JSCSSRuleConstructor::createStructure(globalObject->objectPrototype()), globalObject)
       
   113 {
       
   114     putDirect(exec->propertyNames().prototype, JSCSSRulePrototype::self(exec, globalObject), DontDelete | ReadOnly);
       
   115 }
       
   116 
       
   117 bool JSCSSRuleConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   118 {
       
   119     return getStaticValueSlot<JSCSSRuleConstructor, DOMObject>(exec, &JSCSSRuleConstructorTable, this, propertyName, slot);
       
   120 }
       
   121 
       
   122 bool JSCSSRuleConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   123 {
       
   124     return getStaticValueDescriptor<JSCSSRuleConstructor, DOMObject>(exec, &JSCSSRuleConstructorTable, this, propertyName, descriptor);
       
   125 }
       
   126 
       
   127 /* Hash table for prototype */
       
   128 #if ENABLE(JIT)
       
   129 #define THUNK_GENERATOR(generator) , generator
       
   130 #else
       
   131 #define THUNK_GENERATOR(generator)
       
   132 #endif
       
   133 
       
   134 static const HashTableValue JSCSSRulePrototypeTableValues[11] =
       
   135 {
       
   136     { "UNKNOWN_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleUNKNOWN_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   137     { "STYLE_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleSTYLE_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   138     { "CHARSET_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleCHARSET_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   139     { "IMPORT_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleIMPORT_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   140     { "MEDIA_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleMEDIA_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   141     { "FONT_FACE_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleFONT_FACE_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   142     { "PAGE_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRulePAGE_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   143     { "VARIABLES_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleVARIABLES_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   144     { "WEBKIT_KEYFRAMES_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleWEBKIT_KEYFRAMES_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   145     { "WEBKIT_KEYFRAME_RULE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsCSSRuleWEBKIT_KEYFRAME_RULE), (intptr_t)0 THUNK_GENERATOR(0) },
       
   146     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
   147 };
       
   148 
       
   149 #undef THUNK_GENERATOR
       
   150 static JSC_CONST_HASHTABLE HashTable JSCSSRulePrototypeTable = { 34, 31, JSCSSRulePrototypeTableValues, 0 };
       
   151 const ClassInfo JSCSSRulePrototype::s_info = { "CSSRulePrototype", 0, &JSCSSRulePrototypeTable, 0 };
       
   152 
       
   153 JSObject* JSCSSRulePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
   154 {
       
   155     return getDOMPrototype<JSCSSRule>(exec, globalObject);
       
   156 }
       
   157 
       
   158 bool JSCSSRulePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   159 {
       
   160     return getStaticValueSlot<JSCSSRulePrototype, JSObject>(exec, &JSCSSRulePrototypeTable, this, propertyName, slot);
       
   161 }
       
   162 
       
   163 bool JSCSSRulePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   164 {
       
   165     return getStaticValueDescriptor<JSCSSRulePrototype, JSObject>(exec, &JSCSSRulePrototypeTable, this, propertyName, descriptor);
       
   166 }
       
   167 
       
   168 const ClassInfo JSCSSRule::s_info = { "CSSRule", 0, &JSCSSRuleTable, 0 };
       
   169 
       
   170 JSCSSRule::JSCSSRule(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<CSSRule> impl)
       
   171     : DOMObjectWithGlobalPointer(structure, globalObject)
       
   172     , m_impl(impl)
       
   173 {
       
   174 }
       
   175 
       
   176 JSCSSRule::~JSCSSRule()
       
   177 {
       
   178     forgetDOMObject(this, impl());
       
   179 }
       
   180 
       
   181 JSObject* JSCSSRule::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
   182 {
       
   183     return new (exec) JSCSSRulePrototype(globalObject, JSCSSRulePrototype::createStructure(globalObject->objectPrototype()));
       
   184 }
       
   185 
       
   186 bool JSCSSRule::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
   187 {
       
   188     return getStaticValueSlot<JSCSSRule, Base>(exec, &JSCSSRuleTable, this, propertyName, slot);
       
   189 }
       
   190 
       
   191 bool JSCSSRule::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   192 {
       
   193     return getStaticValueDescriptor<JSCSSRule, Base>(exec, &JSCSSRuleTable, this, propertyName, descriptor);
       
   194 }
       
   195 
       
   196 JSValue jsCSSRuleType(ExecState* exec, JSValue slotBase, const Identifier&)
       
   197 {
       
   198     JSCSSRule* castedThis = static_cast<JSCSSRule*>(asObject(slotBase));
       
   199     UNUSED_PARAM(exec);
       
   200     CSSRule* imp = static_cast<CSSRule*>(castedThis->impl());
       
   201     JSValue result = jsNumber(exec, imp->type());
       
   202     return result;
       
   203 }
       
   204 
       
   205 JSValue jsCSSRuleCssText(ExecState* exec, JSValue slotBase, const Identifier&)
       
   206 {
       
   207     JSCSSRule* castedThis = static_cast<JSCSSRule*>(asObject(slotBase));
       
   208     UNUSED_PARAM(exec);
       
   209     CSSRule* imp = static_cast<CSSRule*>(castedThis->impl());
       
   210     JSValue result = jsStringOrNull(exec, imp->cssText());
       
   211     return result;
       
   212 }
       
   213 
       
   214 JSValue jsCSSRuleParentStyleSheet(ExecState* exec, JSValue slotBase, const Identifier&)
       
   215 {
       
   216     JSCSSRule* castedThis = static_cast<JSCSSRule*>(asObject(slotBase));
       
   217     UNUSED_PARAM(exec);
       
   218     CSSRule* imp = static_cast<CSSRule*>(castedThis->impl());
       
   219     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentStyleSheet()));
       
   220     return result;
       
   221 }
       
   222 
       
   223 JSValue jsCSSRuleParentRule(ExecState* exec, JSValue slotBase, const Identifier&)
       
   224 {
       
   225     JSCSSRule* castedThis = static_cast<JSCSSRule*>(asObject(slotBase));
       
   226     UNUSED_PARAM(exec);
       
   227     CSSRule* imp = static_cast<CSSRule*>(castedThis->impl());
       
   228     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->parentRule()));
       
   229     return result;
       
   230 }
       
   231 
       
   232 JSValue jsCSSRuleConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
       
   233 {
       
   234     JSCSSRule* domObject = static_cast<JSCSSRule*>(asObject(slotBase));
       
   235     return JSCSSRule::getConstructor(exec, domObject->globalObject());
       
   236 }
       
   237 void JSCSSRule::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
       
   238 {
       
   239     lookupPut<JSCSSRule, Base>(exec, propertyName, value, &JSCSSRuleTable, this, slot);
       
   240 }
       
   241 
       
   242 void setJSCSSRuleCssText(ExecState* exec, JSObject* thisObject, JSValue value)
       
   243 {
       
   244     JSCSSRule* castedThis = static_cast<JSCSSRule*>(thisObject);
       
   245     CSSRule* imp = static_cast<CSSRule*>(castedThis->impl());
       
   246     ExceptionCode ec = 0;
       
   247     imp->setCssText(valueToStringWithNullCheck(exec, value), ec);
       
   248     setDOMException(exec, ec);
       
   249 }
       
   250 
       
   251 JSValue JSCSSRule::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
       
   252 {
       
   253     return getDOMConstructor<JSCSSRuleConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
       
   254 }
       
   255 
       
   256 // Constant getters
       
   257 
       
   258 JSValue jsCSSRuleUNKNOWN_RULE(ExecState* exec, JSValue, const Identifier&)
       
   259 {
       
   260     return jsNumber(exec, static_cast<int>(0));
       
   261 }
       
   262 
       
   263 JSValue jsCSSRuleSTYLE_RULE(ExecState* exec, JSValue, const Identifier&)
       
   264 {
       
   265     return jsNumber(exec, static_cast<int>(1));
       
   266 }
       
   267 
       
   268 JSValue jsCSSRuleCHARSET_RULE(ExecState* exec, JSValue, const Identifier&)
       
   269 {
       
   270     return jsNumber(exec, static_cast<int>(2));
       
   271 }
       
   272 
       
   273 JSValue jsCSSRuleIMPORT_RULE(ExecState* exec, JSValue, const Identifier&)
       
   274 {
       
   275     return jsNumber(exec, static_cast<int>(3));
       
   276 }
       
   277 
       
   278 JSValue jsCSSRuleMEDIA_RULE(ExecState* exec, JSValue, const Identifier&)
       
   279 {
       
   280     return jsNumber(exec, static_cast<int>(4));
       
   281 }
       
   282 
       
   283 JSValue jsCSSRuleFONT_FACE_RULE(ExecState* exec, JSValue, const Identifier&)
       
   284 {
       
   285     return jsNumber(exec, static_cast<int>(5));
       
   286 }
       
   287 
       
   288 JSValue jsCSSRulePAGE_RULE(ExecState* exec, JSValue, const Identifier&)
       
   289 {
       
   290     return jsNumber(exec, static_cast<int>(6));
       
   291 }
       
   292 
       
   293 JSValue jsCSSRuleVARIABLES_RULE(ExecState* exec, JSValue, const Identifier&)
       
   294 {
       
   295     return jsNumber(exec, static_cast<int>(7));
       
   296 }
       
   297 
       
   298 JSValue jsCSSRuleWEBKIT_KEYFRAMES_RULE(ExecState* exec, JSValue, const Identifier&)
       
   299 {
       
   300     return jsNumber(exec, static_cast<int>(8));
       
   301 }
       
   302 
       
   303 JSValue jsCSSRuleWEBKIT_KEYFRAME_RULE(ExecState* exec, JSValue, const Identifier&)
       
   304 {
       
   305     return jsNumber(exec, static_cast<int>(9));
       
   306 }
       
   307 
       
   308 CSSRule* toCSSRule(JSC::JSValue value)
       
   309 {
       
   310     return value.inherits(&JSCSSRule::s_info) ? static_cast<JSCSSRule*>(asObject(value))->impl() : 0;
       
   311 }
       
   312 
       
   313 }