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