|
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 "JSCSSImportRule.h" |
|
24 |
|
25 #include <wtf/GetPtr.h> |
|
26 |
|
27 #include "CSSImportRule.h" |
|
28 #include "CSSStyleSheet.h" |
|
29 #include "JSCSSStyleSheet.h" |
|
30 #include "JSMediaList.h" |
|
31 #include "MediaList.h" |
|
32 #include "PlatformString.h" |
|
33 |
|
34 using namespace KJS; |
|
35 |
|
36 namespace WebCore { |
|
37 |
|
38 /* Hash table */ |
|
39 |
|
40 static const HashEntry JSCSSImportRuleTableEntries[] = |
|
41 { |
|
42 { "href", JSCSSImportRule::HrefAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
43 { "media", JSCSSImportRule::MediaAttrNum, DontDelete|ReadOnly, 0, &JSCSSImportRuleTableEntries[4] }, |
|
44 { "styleSheet", JSCSSImportRule::StyleSheetAttrNum, DontDelete|ReadOnly, 0, 0 }, |
|
45 { 0, 0, 0, 0, 0 }, |
|
46 { "constructor", JSCSSImportRule::ConstructorAttrNum, DontDelete|DontEnum|ReadOnly, 0, 0 } |
|
47 }; |
|
48 |
|
49 static const HashTable JSCSSImportRuleTable = |
|
50 { |
|
51 2, 5, JSCSSImportRuleTableEntries, 4 |
|
52 }; |
|
53 |
|
54 /* Hash table for constructor */ |
|
55 |
|
56 static const HashEntry JSCSSImportRuleConstructorTableEntries[] = |
|
57 { |
|
58 { 0, 0, 0, 0, 0 } |
|
59 }; |
|
60 |
|
61 static const HashTable JSCSSImportRuleConstructorTable = |
|
62 { |
|
63 2, 1, JSCSSImportRuleConstructorTableEntries, 1 |
|
64 }; |
|
65 |
|
66 class JSCSSImportRuleConstructor : public DOMObject { |
|
67 public: |
|
68 JSCSSImportRuleConstructor(ExecState* exec) |
|
69 { |
|
70 setPrototype(exec->lexicalInterpreter()->builtinObjectPrototype()); |
|
71 putDirect(exec->propertyNames().prototype, JSCSSImportRulePrototype::self(exec), None); |
|
72 } |
|
73 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); |
|
74 JSValue* getValueProperty(ExecState*, int token) const; |
|
75 virtual const ClassInfo* classInfo() const { return &info; } |
|
76 static const ClassInfo info; |
|
77 |
|
78 virtual bool implementsHasInstance() const { return true; } |
|
79 }; |
|
80 |
|
81 const ClassInfo JSCSSImportRuleConstructor::info = { "CSSImportRuleConstructor", 0, &JSCSSImportRuleConstructorTable, 0 }; |
|
82 |
|
83 bool JSCSSImportRuleConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
84 { |
|
85 return getStaticValueSlot<JSCSSImportRuleConstructor, DOMObject>(exec, &JSCSSImportRuleConstructorTable, this, propertyName, slot); |
|
86 } |
|
87 |
|
88 JSValue* JSCSSImportRuleConstructor::getValueProperty(ExecState*, int token) const |
|
89 { |
|
90 // The token is the numeric value of its associated constant |
|
91 return jsNumber(token); |
|
92 } |
|
93 |
|
94 /* Hash table for prototype */ |
|
95 |
|
96 static const HashEntry JSCSSImportRulePrototypeTableEntries[] = |
|
97 { |
|
98 { 0, 0, 0, 0, 0 } |
|
99 }; |
|
100 |
|
101 static const HashTable JSCSSImportRulePrototypeTable = |
|
102 { |
|
103 2, 1, JSCSSImportRulePrototypeTableEntries, 1 |
|
104 }; |
|
105 |
|
106 const ClassInfo JSCSSImportRulePrototype::info = { "CSSImportRulePrototype", 0, &JSCSSImportRulePrototypeTable, 0 }; |
|
107 |
|
108 JSObject* JSCSSImportRulePrototype::self(ExecState* exec) |
|
109 { |
|
110 return KJS::cacheGlobalObject<JSCSSImportRulePrototype>(exec, "[[JSCSSImportRule.prototype]]"); |
|
111 } |
|
112 |
|
113 const ClassInfo JSCSSImportRule::info = { "CSSImportRule", &JSCSSRule::info, &JSCSSImportRuleTable, 0 }; |
|
114 |
|
115 JSCSSImportRule::JSCSSImportRule(ExecState* exec, CSSImportRule* impl) |
|
116 : JSCSSRule(exec, impl) |
|
117 { |
|
118 setPrototype(JSCSSImportRulePrototype::self(exec)); |
|
119 } |
|
120 |
|
121 bool JSCSSImportRule::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
122 { |
|
123 return getStaticValueSlot<JSCSSImportRule, JSCSSRule>(exec, &JSCSSImportRuleTable, this, propertyName, slot); |
|
124 } |
|
125 |
|
126 JSValue* JSCSSImportRule::getValueProperty(ExecState* exec, int token) const |
|
127 { |
|
128 switch (token) { |
|
129 case HrefAttrNum: { |
|
130 CSSImportRule* imp = static_cast<CSSImportRule*>(impl()); |
|
131 |
|
132 return jsStringOrNull(imp->href()); |
|
133 } |
|
134 case MediaAttrNum: { |
|
135 CSSImportRule* imp = static_cast<CSSImportRule*>(impl()); |
|
136 |
|
137 return toJS(exec, WTF::getPtr(imp->media())); |
|
138 } |
|
139 case StyleSheetAttrNum: { |
|
140 CSSImportRule* imp = static_cast<CSSImportRule*>(impl()); |
|
141 |
|
142 return toJS(exec, WTF::getPtr(imp->styleSheet())); |
|
143 } |
|
144 case ConstructorAttrNum: |
|
145 return getConstructor(exec); |
|
146 } |
|
147 return 0; |
|
148 } |
|
149 |
|
150 JSValue* JSCSSImportRule::getConstructor(ExecState* exec) |
|
151 { |
|
152 return KJS::cacheGlobalObject<JSCSSImportRuleConstructor>(exec, "[[CSSImportRule.constructor]]"); |
|
153 } |
|
154 |
|
155 } |