21
21
#include "config.h"
23
22
#include "JSCSSFontFaceRule.h"
25
#include <wtf/GetPtr.h>
27
24
#include "CSSFontFaceRule.h"
28
25
#include "CSSMutableStyleDeclaration.h"
29
26
#include "CSSStyleDeclaration.h"
30
27
#include "JSCSSStyleDeclaration.h"
32
#include <runtime/JSNumberCell.h>
28
#include <wtf/GetPtr.h>
34
30
using namespace JSC;
36
32
namespace WebCore {
38
ASSERT_CLASS_FITS_IN_CELL(JSCSSFontFaceRule)
34
ASSERT_CLASS_FITS_IN_CELL(JSCSSFontFaceRule);
49
static const HashTable JSCSSFontFaceRuleTable =
45
static JSC_CONST_HASHTABLE HashTable JSCSSFontFaceRuleTable =
50
46
#if ENABLE(PERFECT_HASH_SIZE)
51
47
{ 1, JSCSSFontFaceRuleTableValues, 0 };
63
static const HashTable JSCSSFontFaceRuleConstructorTable =
59
static JSC_CONST_HASHTABLE HashTable JSCSSFontFaceRuleConstructorTable =
64
60
#if ENABLE(PERFECT_HASH_SIZE)
65
61
{ 0, JSCSSFontFaceRuleConstructorTableValues, 0 };
67
63
{ 1, 0, JSCSSFontFaceRuleConstructorTableValues, 0 };
70
class JSCSSFontFaceRuleConstructor : public DOMObject {
66
class JSCSSFontFaceRuleConstructor : public DOMConstructorObject {
72
JSCSSFontFaceRuleConstructor(ExecState* exec)
73
: DOMObject(JSCSSFontFaceRuleConstructor::createStructure(exec->lexicalGlobalObject()->objectPrototype()))
68
JSCSSFontFaceRuleConstructor(ExecState* exec, JSDOMGlobalObject* globalObject)
69
: DOMConstructorObject(JSCSSFontFaceRuleConstructor::createStructure(globalObject->objectPrototype()), globalObject)
75
putDirect(exec->propertyNames().prototype, JSCSSFontFaceRulePrototype::self(exec, exec->lexicalGlobalObject()), None);
71
putDirect(exec->propertyNames().prototype, JSCSSFontFaceRulePrototype::self(exec, globalObject), None);
77
73
virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
74
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
78
75
virtual const ClassInfo* classInfo() const { return &s_info; }
79
76
static const ClassInfo s_info;
81
static PassRefPtr<Structure> createStructure(JSValuePtr proto)
78
static PassRefPtr<Structure> createStructure(JSValue proto)
83
80
return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance));
91
88
return getStaticValueSlot<JSCSSFontFaceRuleConstructor, DOMObject>(exec, &JSCSSFontFaceRuleConstructorTable, this, propertyName, slot);
91
bool JSCSSFontFaceRuleConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
93
return getStaticValueDescriptor<JSCSSFontFaceRuleConstructor, DOMObject>(exec, &JSCSSFontFaceRuleConstructorTable, this, propertyName, descriptor);
94
96
/* Hash table for prototype */
96
98
static const HashTableValue JSCSSFontFaceRulePrototypeTableValues[1] =
101
static const HashTable JSCSSFontFaceRulePrototypeTable =
103
static JSC_CONST_HASHTABLE HashTable JSCSSFontFaceRulePrototypeTable =
102
104
#if ENABLE(PERFECT_HASH_SIZE)
103
105
{ 0, JSCSSFontFaceRulePrototypeTableValues, 0 };
115
117
const ClassInfo JSCSSFontFaceRule::s_info = { "CSSFontFaceRule", &JSCSSRule::s_info, &JSCSSFontFaceRuleTable, 0 };
117
JSCSSFontFaceRule::JSCSSFontFaceRule(PassRefPtr<Structure> structure, PassRefPtr<CSSFontFaceRule> impl)
118
: JSCSSRule(structure, impl)
119
JSCSSFontFaceRule::JSCSSFontFaceRule(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<CSSFontFaceRule> impl)
120
: JSCSSRule(structure, globalObject, impl)
129
131
return getStaticValueSlot<JSCSSFontFaceRule, Base>(exec, &JSCSSFontFaceRuleTable, this, propertyName, slot);
132
JSValuePtr jsCSSFontFaceRuleStyle(ExecState* exec, const Identifier&, const PropertySlot& slot)
134
CSSFontFaceRule* imp = static_cast<CSSFontFaceRule*>(static_cast<JSCSSFontFaceRule*>(asObject(slot.slotBase()))->impl());
135
return toJS(exec, WTF::getPtr(imp->style()));
138
JSValuePtr jsCSSFontFaceRuleConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
140
return static_cast<JSCSSFontFaceRule*>(asObject(slot.slotBase()))->getConstructor(exec);
142
JSValuePtr JSCSSFontFaceRule::getConstructor(ExecState* exec)
144
return getDOMConstructor<JSCSSFontFaceRuleConstructor>(exec);
134
bool JSCSSFontFaceRule::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
136
return getStaticValueDescriptor<JSCSSFontFaceRule, Base>(exec, &JSCSSFontFaceRuleTable, this, propertyName, descriptor);
139
JSValue jsCSSFontFaceRuleStyle(ExecState* exec, const Identifier&, const PropertySlot& slot)
141
JSCSSFontFaceRule* castedThis = static_cast<JSCSSFontFaceRule*>(asObject(slot.slotBase()));
143
CSSFontFaceRule* imp = static_cast<CSSFontFaceRule*>(castedThis->impl());
144
return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->style()));
147
JSValue jsCSSFontFaceRuleConstructor(ExecState* exec, const Identifier&, const PropertySlot& slot)
149
JSCSSFontFaceRule* domObject = static_cast<JSCSSFontFaceRule*>(asObject(slot.slotBase()));
150
return JSCSSFontFaceRule::getConstructor(exec, domObject->globalObject());
152
JSValue JSCSSFontFaceRule::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
154
return getDOMConstructor<JSCSSFontFaceRuleConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));