2009-07-13 Drew Wilson <atwilson@google.com>
[WebKit-https.git] / WebCore / bindings / v8 / V8Index.h
1 /*
2  * Copyright (C) 2009 Google Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  *     * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  *     * Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer
12  * in the documentation and/or other materials provided with the
13  * distribution.
14  *     * Neither the name of Google Inc. nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31 #ifndef V8Index_h
32 #define V8Index_h
33
34 #include <v8.h>
35 #include "PlatformString.h"  // for WebCore::String
36
37 namespace WebCore {
38
39 typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)();
40
41 #if ENABLE(VIDEO)
42 #define VIDEO_HTMLELEMENT_TYPES(V)                                      \
43     V(HTMLAUDIOELEMENT, HTMLAudioElement)                               \
44     V(HTMLMEDIAELEMENT, HTMLMediaElement)                               \
45     V(HTMLSOURCEELEMENT, HTMLSourceElement)                             \
46     V(HTMLVIDEOELEMENT, HTMLVideoElement)
47 #define VIDEO_NONNODE_TYPES(V)                                          \
48     V(MEDIAERROR, MediaError)                                           \
49     V(TIMERANGES, TimeRanges)
50 #else
51 #define VIDEO_HTMLELEMENT_TYPES(V)
52 #define VIDEO_NONNODE_TYPES(V)
53 #endif
54
55 #if ENABLE(WORKERS)
56 #define WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V)                           \
57     V(WORKER, Worker)
58
59 #define WORKER_NONNODE_WRAPPER_TYPES(V)                                 \
60     V(WORKERCONTEXT, WorkerContext)                                     \
61     V(WORKERLOCATION, WorkerLocation)                                   \
62     V(WORKERNAVIGATOR, WorkerNavigator)
63 #else
64 #define WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V)
65 #define WORKER_NONNODE_WRAPPER_TYPES(V)
66 #endif
67
68 #if ENABLE(SHARED_WORKERS)
69 #define SHARED_WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V)                    \
70     V(SHAREDWORKER, SharedWorker)
71
72 #define SHARED_WORKER_NONNODE_WRAPPER_TYPES(V)                          \
73     V(ABSTRACTWORKER, AbstractWorker)
74 #else
75 #define SHARED_WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V)
76 #define SHARED_WORKER_NONNODE_WRAPPER_TYPES(V)
77 #endif
78
79 #define DOM_NODE_TYPES(V)                                               \
80     V(ATTR, Attr)                                                       \
81     V(CHARACTERDATA, CharacterData)                                     \
82     V(CDATASECTION, CDATASection)                                       \
83     V(COMMENT, Comment)                                                 \\r
84     V(DATAGRIDCOLUMN, DataGridColumn)                                   \\r
85     V(DATAGRIDCOLUMNLIST, DataGridColumnList)                           \
86     V(DOCUMENT, Document)                                               \
87     V(DOCUMENTFRAGMENT, DocumentFragment)                               \
88     V(DOCUMENTTYPE, DocumentType)                                       \
89     V(ELEMENT, Element)                                                 \
90     V(ENTITY, Entity)                                                   \
91     V(ENTITYREFERENCE, EntityReference)                                 \
92     V(HTMLDOCUMENT, HTMLDocument)                                       \
93     V(NODE, Node)                                                       \
94     V(NOTATION, Notation)                                               \
95     V(PROCESSINGINSTRUCTION, ProcessingInstruction)                     \
96     V(TEXT, Text)                                                       \
97     V(HTMLANCHORELEMENT, HTMLAnchorElement)                             \
98     V(HTMLAPPLETELEMENT, HTMLAppletElement)                             \
99     V(HTMLAREAELEMENT, HTMLAreaElement)                                 \
100     V(HTMLBASEELEMENT, HTMLBaseElement)                                 \
101     V(HTMLBASEFONTELEMENT, HTMLBaseFontElement)                         \
102     V(HTMLBLOCKQUOTEELEMENT, HTMLBlockquoteElement)                     \
103     V(HTMLBODYELEMENT, HTMLBodyElement)                                 \
104     V(HTMLBRELEMENT, HTMLBRElement)                                     \
105     V(HTMLBUTTONELEMENT, HTMLButtonElement)                             \
106     V(HTMLCANVASELEMENT, HTMLCanvasElement)                             \
107     V(HTMLDATAGRIDCELLELEMENT, HTMLDataGridCellElement)                 \
108     V(HTMLDATAGRIDCOLELEMENT, HTMLDataGridColElement)                   \
109     V(HTMLDATAGRIDELEMENT, HTMLDataGridElement)                         \
110     V(HTMLDATAGRIDROWELEMENT, HTMLDataGridRowElement)                   \
111     V(HTMLDIRECTORYELEMENT, HTMLDirectoryElement)                       \
112     V(HTMLDIVELEMENT, HTMLDivElement)                                   \
113     V(HTMLDLISTELEMENT, HTMLDListElement)                               \
114     V(HTMLEMBEDELEMENT, HTMLEmbedElement)                               \
115     V(HTMLFIELDSETELEMENT, HTMLFieldSetElement)                         \
116     V(HTMLFONTELEMENT, HTMLFontElement)                                 \
117     V(HTMLFORMELEMENT, HTMLFormElement)                                 \
118     V(HTMLFRAMEELEMENT, HTMLFrameElement)                               \
119     V(HTMLFRAMESETELEMENT, HTMLFrameSetElement)                         \
120     V(HTMLHEADINGELEMENT, HTMLHeadingElement)                           \
121     V(HTMLHEADELEMENT, HTMLHeadElement)                                 \
122     V(HTMLHRELEMENT, HTMLHRElement)                                     \
123     V(HTMLHTMLELEMENT, HTMLHtmlElement)                                 \
124     V(HTMLIFRAMEELEMENT, HTMLIFrameElement)                             \
125     V(HTMLIMAGEELEMENT, HTMLImageElement)                               \
126     V(HTMLINPUTELEMENT, HTMLInputElement)                               \
127     V(HTMLISINDEXELEMENT, HTMLIsIndexElement)                           \
128     V(HTMLLABELELEMENT, HTMLLabelElement)                               \
129     V(HTMLLEGENDELEMENT, HTMLLegendElement)                             \
130     V(HTMLLIELEMENT, HTMLLIElement)                                     \
131     V(HTMLLINKELEMENT, HTMLLinkElement)                                 \
132     V(HTMLMAPELEMENT, HTMLMapElement)                                   \
133     V(HTMLMARQUEEELEMENT, HTMLMarqueeElement)                           \
134     V(HTMLMENUELEMENT, HTMLMenuElement)                                 \
135     V(HTMLMETAELEMENT, HTMLMetaElement)                                 \
136     V(HTMLMODELEMENT, HTMLModElement)                                   \
137     V(HTMLOBJECTELEMENT, HTMLObjectElement)                             \
138     V(HTMLOLISTELEMENT, HTMLOListElement)                               \
139     V(HTMLOPTGROUPELEMENT, HTMLOptGroupElement)                         \
140     V(HTMLOPTIONELEMENT, HTMLOptionElement)                             \
141     V(HTMLPARAGRAPHELEMENT, HTMLParagraphElement)                       \
142     V(HTMLPARAMELEMENT, HTMLParamElement)                               \
143     V(HTMLPREELEMENT, HTMLPreElement)                                   \
144     V(HTMLQUOTEELEMENT, HTMLQuoteElement)                               \
145     V(HTMLSCRIPTELEMENT, HTMLScriptElement)                             \
146     V(HTMLSELECTELEMENT, HTMLSelectElement)                             \
147     V(HTMLSTYLEELEMENT, HTMLStyleElement)                               \
148     V(HTMLTABLECAPTIONELEMENT, HTMLTableCaptionElement)                 \
149     V(HTMLTABLECOLELEMENT, HTMLTableColElement)                         \
150     V(HTMLTABLEELEMENT, HTMLTableElement)                               \
151     V(HTMLTABLESECTIONELEMENT, HTMLTableSectionElement)                 \
152     V(HTMLTABLECELLELEMENT, HTMLTableCellElement)                       \
153     V(HTMLTABLEROWELEMENT, HTMLTableRowElement)                         \
154     V(HTMLTEXTAREAELEMENT, HTMLTextAreaElement)                         \
155     V(HTMLTITLEELEMENT, HTMLTitleElement)                               \
156     V(HTMLULISTELEMENT, HTMLUListElement)                               \
157     V(HTMLELEMENT, HTMLElement)                                         \
158     VIDEO_HTMLELEMENT_TYPES(V)
159
160 #if ENABLE(SVG_ANIMATION)
161 #define SVG_ANIMATION_ELEMENT_TYPES(V)                                  \
162     V(SVGANIMATECOLORELEMENT, SVGAnimateColorElement)                   \
163     V(SVGANIMATEELEMENT, SVGAnimateElement)                             \
164     V(SVGANIMATETRANSFORMELEMENT, SVGAnimateTransformElement)           \
165     V(SVGANIMATIONELEMENT, SVGAnimationElement)                         \
166     V(SVGSETELEMENT, SVGSetElement)
167 #else
168 #define SVG_ANIMATION_ELEMENT_TYPES(V)
169 #endif
170
171 #if ENABLE(SVG_FILTERS)
172 #define SVG_FILTERS_ELEMENT_TYPES(V)                                    \
173     V(SVGCOMPONENTTRANSFERFUNCTIONELEMENT, SVGComponentTransferFunctionElement)\
174     V(SVGFEBLENDELEMENT, SVGFEBlendElement)                             \
175     V(SVGFECOLORMATRIXELEMENT, SVGFEColorMatrixElement)                 \
176     V(SVGFECOMPONENTTRANSFERELEMENT, SVGFEComponentTransferElement)     \
177     V(SVGFECOMPOSITEELEMENT, SVGFECompositeElement)                     \
178     V(SVGFEDIFFUSELIGHTINGELEMENT, SVGFEDiffuseLightingElement)         \
179     V(SVGFEDISPLACEMENTMAPELEMENT, SVGFEDisplacementMapElement)         \
180     V(SVGFEDISTANTLIGHTELEMENT, SVGFEDistantLightElement)               \
181     V(SVGFEFLOODELEMENT, SVGFEFloodElement)                             \
182     V(SVGFEFUNCAELEMENT, SVGFEFuncAElement)                             \
183     V(SVGFEFUNCBELEMENT, SVGFEFuncBElement)                             \
184     V(SVGFEFUNCGELEMENT, SVGFEFuncGElement)                             \
185     V(SVGFEFUNCRELEMENT, SVGFEFuncRElement)                             \
186     V(SVGFEGAUSSIANBLURELEMENT, SVGFEGaussianBlurElement)               \
187     V(SVGFEIMAGEELEMENT, SVGFEImageElement)                             \
188     V(SVGFEMERGEELEMENT, SVGFEMergeElement)                             \
189     V(SVGFEMERGENODEELEMENT, SVGFEMergeNodeElement)                     \
190     V(SVGFEOFFSETELEMENT, SVGFEOffsetElement)                           \
191     V(SVGFEPOINTLIGHTELEMENT, SVGFEPointLightElement)                   \
192     V(SVGFESPECULARLIGHTINGELEMENT, SVGFESpecularLightingElement)       \
193     V(SVGFESPOTLIGHTELEMENT, SVGFESpotLightElement)                     \
194     V(SVGFETILEELEMENT, SVGFETileElement)                               \
195     V(SVGFETURBULENCEELEMENT, SVGFETurbulenceElement)                   \
196     V(SVGFILTERELEMENT, SVGFilterElement)
197 #else
198 #define SVG_FILTERS_ELEMENT_TYPES(V)
199 #endif
200
201 #if ENABLE(SVG_FONTS)
202 #define SVG_FONTS_ELEMENT_TYPES(V)                                      \
203     V(SVGDEFINITIONSRCELEMENT, SVGDefinitionSrcElement)                 \
204     V(SVGFONTFACEELEMENT, SVGFontFaceElement)                           \
205     V(SVGFONTFACEFORMATELEMENT, SVGFontFaceFormatElement)               \
206     V(SVGFONTFACENAMEELEMENT, SVGFontFaceNameElement)                   \
207     V(SVGFONTFACESRCELEMENT, SVGFontFaceSrcElement)                     \
208     V(SVGFONTFACEURIELEMENT, SVGFontFaceUriElement)
209 #else
210 #define SVG_FONTS_ELEMENT_TYPES(V)
211 #endif
212
213 #if ENABLE(SVG_FOREIGN_OBJECT)
214 #define SVG_FOREIGN_OBJECT_ELEMENT_TYPES(V)                             \
215     V(SVGFOREIGNOBJECTELEMENT, SVGForeignObjectElement)
216 #else
217 #define SVG_FOREIGN_OBJECT_ELEMENT_TYPES(V)
218 #endif
219
220 #if ENABLE(SVG_USE)
221 #define SVG_USE_ELEMENT_TYPES(V)                                        \
222     V(SVGUSEELEMENT, SVGUseElement)
223 #else
224 #define SVG_USE_ELEMENT_TYPES(V)
225 #endif
226
227 #if ENABLE(SVG)
228 #define SVG_NODE_TYPES(V)                                               \
229     SVG_ANIMATION_ELEMENT_TYPES(V)                                      \
230     SVG_FILTERS_ELEMENT_TYPES(V)                                        \
231     SVG_FONTS_ELEMENT_TYPES(V)                                          \
232     SVG_FOREIGN_OBJECT_ELEMENT_TYPES(V)                                 \
233     SVG_USE_ELEMENT_TYPES(V)                                            \
234     V(SVGAELEMENT, SVGAElement)                                         \
235     V(SVGALTGLYPHELEMENT, SVGAltGlyphElement)                           \
236     V(SVGCIRCLEELEMENT, SVGCircleElement)                               \
237     V(SVGCLIPPATHELEMENT, SVGClipPathElement)                           \
238     V(SVGCURSORELEMENT, SVGCursorElement)                               \
239     V(SVGDEFSELEMENT, SVGDefsElement)                                   \
240     V(SVGDESCELEMENT, SVGDescElement)                                   \
241     V(SVGELLIPSEELEMENT, SVGEllipseElement)                             \
242     V(SVGGELEMENT, SVGGElement)                                         \
243     V(SVGGLYPHELEMENT, SVGGlyphElement)                                 \
244     V(SVGGRADIENTELEMENT, SVGGradientElement)                           \
245     V(SVGIMAGEELEMENT, SVGImageElement)                                 \
246     V(SVGLINEARGRADIENTELEMENT, SVGLinearGradientElement)               \
247     V(SVGLINEELEMENT, SVGLineElement)                                   \
248     V(SVGMARKERELEMENT, SVGMarkerElement)                               \
249     V(SVGMASKELEMENT, SVGMaskElement)                                   \
250     V(SVGMETADATAELEMENT, SVGMetadataElement)                           \
251     V(SVGPATHELEMENT, SVGPathElement)                                   \
252     V(SVGPATTERNELEMENT, SVGPatternElement)                             \
253     V(SVGPOLYGONELEMENT, SVGPolygonElement)                             \
254     V(SVGPOLYLINEELEMENT, SVGPolylineElement)                           \
255     V(SVGRADIALGRADIENTELEMENT, SVGRadialGradientElement)               \
256     V(SVGRECTELEMENT, SVGRectElement)                                   \
257     V(SVGSCRIPTELEMENT, SVGScriptElement)                               \
258     V(SVGSTOPELEMENT, SVGStopElement)                                   \
259     V(SVGSTYLEELEMENT, SVGStyleElement)                                 \
260     V(SVGSVGELEMENT, SVGSVGElement)                                     \
261     V(SVGSWITCHELEMENT, SVGSwitchElement)                               \
262     V(SVGSYMBOLELEMENT, SVGSymbolElement)                               \
263     V(SVGTEXTCONTENTELEMENT, SVGTextContentElement)                     \
264     V(SVGTEXTELEMENT, SVGTextElement)                                   \
265     V(SVGTEXTPATHELEMENT, SVGTextPathElement)                           \
266     V(SVGTEXTPOSITIONINGELEMENT, SVGTextPositioningElement)             \
267     V(SVGTITLEELEMENT, SVGTitleElement)                                 \
268     V(SVGTREFELEMENT, SVGTRefElement)                                   \
269     V(SVGTSPANELEMENT, SVGTSpanElement)                                 \
270     V(SVGVIEWELEMENT, SVGViewElement)                                   \
271     V(SVGELEMENT, SVGElement)                                           \
272     V(SVGDOCUMENT, SVGDocument)
273 #endif  // SVG
274
275
276 // ACTIVE_DOM_OBJECT_TYPES are DOM_OBJECT_TYPES that need special treatement
277 // during GC.
278 #define ACTIVE_DOM_OBJECT_TYPES(V)                                      \
279     V(MESSAGEPORT, MessagePort)                                         \
280     V(XMLHTTPREQUEST, XMLHttpRequest)                                   \
281     WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V)                               \
282     SHARED_WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V)
283
284 // NOTE: DOM_OBJECT_TYPES is split into two halves because
285 //       Visual Studio's Intellinonsense crashes when macros get
286 //       too large.  10-29-08
287 // DOM_OBJECT_TYPES are non-node DOM types.
288 #define DOM_OBJECT_TYPES_1(V)                                           \
289     V(BARINFO, BarInfo)                                                 \
290     V(CANVASGRADIENT, CanvasGradient)                                   \
291     V(CANVASPATTERN, CanvasPattern)                                     \
292     V(CANVASRENDERINGCONTEXT2D, CanvasRenderingContext2D)               \
293     V(CLIENTRECT, ClientRect)                                           \
294     V(CLIENTRECTLIST, ClientRectList)                                   \
295     V(CLIPBOARD, Clipboard)                                             \
296     V(CONSOLE, Console)                                                 \
297     V(COUNTER, Counter)                                                 \
298     V(CSSCHARSETRULE, CSSCharsetRule)                                   \
299     V(CSSFONTFACERULE, CSSFontFaceRule)                                 \
300     V(CSSIMPORTRULE, CSSImportRule)                                     \
301     V(CSSMEDIARULE, CSSMediaRule)                                       \
302     V(CSSPAGERULE, CSSPageRule)                                         \
303     V(CSSPRIMITIVEVALUE, CSSPrimitiveValue)                             \
304     V(CSSRULE, CSSRule)                                                 \
305     V(CSSRULELIST, CSSRuleList)                                         \
306     V(CSSSTYLEDECLARATION, CSSStyleDeclaration)                         \
307     V(CSSSTYLERULE, CSSStyleRule)                                       \
308     V(CSSSTYLESHEET, CSSStyleSheet)                                     \
309     V(CSSVALUE, CSSValue)                                               \
310     V(CSSVALUELIST, CSSValueList)                                       \
311     V(CSSVARIABLESDECLARATION, CSSVariablesDeclaration)                 \
312     V(CSSVARIABLESRULE, CSSVariablesRule)                               \
313     V(DOMCOREEXCEPTION, DOMCoreException)                               \
314     V(DOMIMPLEMENTATION, DOMImplementation)                             \
315     V(DOMPARSER, DOMParser)                                             \
316     V(DOMSELECTION, DOMSelection)                                       \
317     V(DOMWINDOW, DOMWindow)                                             \
318     V(EVENT, Event)                                                     \
319     V(EVENTEXCEPTION, EventException)                                   \
320     V(FILE, File)                                                       \
321     V(FILELIST, FileList)                                               \
322     V(HISTORY, History)                                                 \
323     V(HTMLALLCOLLECTION, HTMLAllCollection)                             \
324     V(HTMLCOLLECTION, HTMLCollection)                                   \
325     V(HTMLOPTIONSCOLLECTION, HTMLOptionsCollection)                     \
326     V(IMAGEDATA, ImageData)                                             \
327     V(CANVASPIXELARRAY, CanvasPixelArray)                               \
328     V(INSPECTORCONTROLLER, InspectorController)                         \
329     V(KEYBOARDEVENT, KeyboardEvent)                                     \
330     V(LOCATION, Location)                                               \
331     V(MEDIALIST, MediaList)
332
333 #define DOM_OBJECT_TYPES_2(V)                                           \
334     V(MESSAGECHANNEL, MessageChannel)                                   \
335     V(MESSAGEEVENT, MessageEvent)                                       \
336     V(MIMETYPE, MimeType)                                               \
337     V(MIMETYPEARRAY, MimeTypeArray)                                     \
338     V(MOUSEEVENT, MouseEvent)                                           \
339     V(MUTATIONEVENT, MutationEvent)                                     \
340     V(NAMEDNODEMAP, NamedNodeMap)                                       \
341     V(NAVIGATOR, Navigator)                                             \
342     V(NODEFILTER, NodeFilter)                                           \
343     V(NODEITERATOR, NodeIterator)                                       \
344     V(NODELIST, NodeList)                                               \
345     V(OVERFLOWEVENT, OverflowEvent)                                     \
346     V(PLUGIN, Plugin)                                                   \
347     V(PLUGINARRAY, PluginArray)                                         \
348     V(PROGRESSEVENT, ProgressEvent)                                     \
349     V(RANGE, Range)                                                     \
350     V(RANGEEXCEPTION, RangeException)                                   \
351     V(RECT, Rect)                                                       \
352     V(RGBCOLOR, RGBColor)                                               \
353     V(SCREEN, Screen)                                                   \
354     V(STYLESHEET, StyleSheet)                                           \
355     V(STYLESHEETLIST, StyleSheetList)                                   \
356     V(TEXTEVENT, TextEvent)                                             \
357     V(TEXTMETRICS, TextMetrics)                                         \
358     V(TREEWALKER, TreeWalker)                                           \
359     V(UIEVENT, UIEvent)                                                 \
360     V(WEBKITANIMATIONEVENT, WebKitAnimationEvent)                       \
361     V(WEBKITCSSKEYFRAMERULE, WebKitCSSKeyframeRule)                     \
362     V(WEBKITCSSKEYFRAMESRULE, WebKitCSSKeyframesRule)                   \
363     V(WEBKITCSSMATRIX, WebKitCSSMatrix)                                 \
364     V(WEBKITPOINT, WebKitPoint)                                         \
365     V(WEBKITCSSTRANSFORMVALUE, WebKitCSSTransformValue)                 \
366     V(WEBKITTRANSITIONEVENT, WebKitTransitionEvent)                     \
367     V(WHEELEVENT, WheelEvent)                                           \
368     V(XMLHTTPREQUESTUPLOAD, XMLHttpRequestUpload)                       \
369     V(XMLHTTPREQUESTEXCEPTION, XMLHttpRequestException)                 \
370     V(XMLHTTPREQUESTPROGRESSEVENT, XMLHttpRequestProgressEvent)         \
371     V(XMLSERIALIZER, XMLSerializer)                                     \
372     V(XPATHEVALUATOR, XPathEvaluator)                                   \
373     V(XPATHEXCEPTION, XPathException)                                   \
374     V(XPATHEXPRESSION, XPathExpression)                                 \
375     V(XPATHNSRESOLVER, XPathNSResolver)                                 \
376     V(XPATHRESULT, XPathResult)                                         \
377     V(XSLTPROCESSOR, XSLTProcessor)                                     \
378     ACTIVE_DOM_OBJECT_TYPES(V)                                          \
379     VIDEO_NONNODE_TYPES(V)                                              \
380     SHARED_WORKER_NONNODE_WRAPPER_TYPES(V)                              \
381     WORKER_NONNODE_WRAPPER_TYPES(V)
382
383 #if ENABLE(DATABASE)
384 #define DOM_OBJECT_DATABASE_TYPES(V)                                    \
385     V(DATABASE, Database)                                               \
386     V(SQLERROR, SQLError)                                               \
387     V(SQLRESULTSET, SQLResultSet)                                       \
388     V(SQLRESULTSETROWLIST, SQLResultSetRowList)                         \
389     V(SQLTRANSACTION, SQLTransaction)
390 #else
391 #define DOM_OBJECT_DATABASE_TYPES(V)
392 #endif\r
393 \r
394 #if ENABLE(DOM_STORAGE)\r
395 #define DOM_OBJECT_STORAGE_TYPES(V)                                     \\r
396     V(STORAGE, Storage)                                                 \\r
397     V(STORAGEEVENT, StorageEvent)\r
398 #else\r
399 #define DOM_OBJECT_STORAGE_TYPES(V)\r
400 #endif
401
402 #define DOM_OBJECT_TYPES(V)                                             \
403     DOM_OBJECT_TYPES_1(V)                                               \
404     DOM_OBJECT_TYPES_2(V)                                               \
405     DOM_OBJECT_DATABASE_TYPES(V)                                        \
406     DOM_OBJECT_STORAGE_TYPES(V)
407
408 #if ENABLE(SVG)
409 // SVG_OBJECT_TYPES are svg non-node, non-pod types.
410 #define SVG_OBJECT_TYPES(V)                                             \
411     V(SVGANGLE, SVGAngle)                                               \
412     V(SVGANIMATEDANGLE, SVGAnimatedAngle)                               \
413     V(SVGANIMATEDBOOLEAN, SVGAnimatedBoolean)                           \
414     V(SVGANIMATEDENUMERATION, SVGAnimatedEnumeration)                   \
415     V(SVGANIMATEDINTEGER, SVGAnimatedInteger)                           \
416     V(SVGANIMATEDLENGTH, SVGAnimatedLength)                             \
417     V(SVGANIMATEDLENGTHLIST, SVGAnimatedLengthList)                     \
418     V(SVGANIMATEDNUMBER, SVGAnimatedNumber)                             \
419     V(SVGANIMATEDNUMBERLIST, SVGAnimatedNumberList)                     \
420     V(SVGANIMATEDPRESERVEASPECTRATIO, SVGAnimatedPreserveAspectRatio)   \
421     V(SVGANIMATEDRECT, SVGAnimatedRect)                                 \
422     V(SVGANIMATEDSTRING, SVGAnimatedString)                             \
423     V(SVGANIMATEDTRANSFORMLIST, SVGAnimatedTransformList)               \
424     V(SVGCOLOR, SVGColor)                                               \
425     V(SVGELEMENTINSTANCE, SVGElementInstance)                           \
426     V(SVGELEMENTINSTANCELIST, SVGElementInstanceList)                   \
427     V(SVGEXCEPTION, SVGException)                                       \
428     V(SVGLENGTHLIST, SVGLengthList)                                     \
429     V(SVGNUMBERLIST, SVGNumberList)                                     \
430     V(SVGPAINT, SVGPaint)                                               \
431     V(SVGPATHSEG, SVGPathSeg)                                           \
432     V(SVGPATHSEGARCABS, SVGPathSegArcAbs)                               \
433     V(SVGPATHSEGARCREL, SVGPathSegArcRel)                               \
434     V(SVGPATHSEGCLOSEPATH, SVGPathSegClosePath)                         \
435     V(SVGPATHSEGCURVETOCUBICABS, SVGPathSegCurvetoCubicAbs)             \
436     V(SVGPATHSEGCURVETOCUBICREL, SVGPathSegCurvetoCubicRel)             \
437     V(SVGPATHSEGCURVETOCUBICSMOOTHABS, SVGPathSegCurvetoCubicSmoothAbs) \
438     V(SVGPATHSEGCURVETOCUBICSMOOTHREL, SVGPathSegCurvetoCubicSmoothRel) \
439     V(SVGPATHSEGCURVETOQUADRATICABS, SVGPathSegCurvetoQuadraticAbs)     \
440     V(SVGPATHSEGCURVETOQUADRATICREL, SVGPathSegCurvetoQuadraticRel)     \
441     V(SVGPATHSEGCURVETOQUADRATICSMOOTHABS, SVGPathSegCurvetoQuadraticSmoothAbs)\
442     V(SVGPATHSEGCURVETOQUADRATICSMOOTHREL, SVGPathSegCurvetoQuadraticSmoothRel)\
443     V(SVGPATHSEGLINETOABS, SVGPathSegLinetoAbs)                         \
444     V(SVGPATHSEGLINETOHORIZONTALABS, SVGPathSegLinetoHorizontalAbs)     \
445     V(SVGPATHSEGLINETOHORIZONTALREL, SVGPathSegLinetoHorizontalRel)     \
446     V(SVGPATHSEGLINETOREL, SVGPathSegLinetoRel)                         \
447     V(SVGPATHSEGLINETOVERTICALABS, SVGPathSegLinetoVerticalAbs)         \
448     V(SVGPATHSEGLINETOVERTICALREL, SVGPathSegLinetoVerticalRel)         \
449     V(SVGPATHSEGLIST, SVGPathSegList)                                   \
450     V(SVGPATHSEGMOVETOABS, SVGPathSegMovetoAbs)                         \
451     V(SVGPATHSEGMOVETOREL, SVGPathSegMovetoRel)                         \
452     V(SVGPOINTLIST, SVGPointList)                                       \
453     V(SVGPRESERVEASPECTRATIO, SVGPreserveAspectRatio)                   \
454     V(SVGRENDERINGINTENT, SVGRenderingIntent)                           \
455     V(SVGSTRINGLIST, SVGStringList)                                     \
456     V(SVGTRANSFORMLIST, SVGTransformList)                               \
457     V(SVGUNITTYPES, SVGUnitTypes)                                       \
458     V(SVGZOOMEVENT, SVGZoomEvent)
459
460 // SVG POD types should list all types whose IDL has PODType declaration.
461 #define SVG_POD_TYPES(V)                                                \
462     V(SVGLENGTH, SVGLength)                                             \
463     V(SVGTRANSFORM, SVGTransform)                                       \
464     V(SVGMATRIX, SVGMatrix)                                             \
465     V(SVGNUMBER, SVGNumber)                                             \
466     V(SVGPOINT, SVGPoint)                                               \
467     V(SVGRECT, SVGRect)
468
469 // POD types can have different implementation names, see CodeGenerateV8.pm.
470 #define SVG_POD_NATIVE_TYPES(V)                                         \
471     V(SVGLENGTH, SVGLength)                                             \
472     V(SVGTRANSFORM, SVGTransform)                                       \
473     V(SVGMATRIX, TransformationMatrix)                                  \
474     V(SVGNUMBER, float)                                                 \
475     V(SVGPOINT, FloatPoint)                                             \
476     V(SVGRECT, FloatRect)
477
478 // Shouldn't generate code for these two types.
479 #define SVG_NO_WRAPPER_TYPES(V)                                         \
480     V(SVGURIREFERENCE, SVGURIReference)                                 \
481     V(SVGANIMATEDPOINTS, SVGAnimatedPoints)
482
483 // SVG_NONNODE_TYPES are SVG non-node object types, pod typs and
484 // numerical types.
485 #define SVG_NONNODE_TYPES(V)                                            \
486     SVG_OBJECT_TYPES(V)                                                 \
487     SVG_POD_TYPES(V)
488 #endif  // SVG
489
490 // EVENTTARGET, EVENTLISTENER, and NPOBJECT do not have V8 wrappers.
491 #define DOM_NO_WRAPPER_TYPES(V)                                         \
492     V(EVENTTARGET, EventTarget)                                         \
493     V(EVENTLISTENER, EventListener)                                     \
494     V(NPOBJECT, NPObject)
495
496 #if ENABLE(SVG)
497 #define WRAPPER_TYPES(V) DOM_NODE_TYPES(V) DOM_OBJECT_TYPES(V) SVG_NODE_TYPES(V) SVG_NONNODE_TYPES(V)
498 #define NO_WRAPPER_TYPES(V) DOM_NO_WRAPPER_TYPES(V) SVG_NO_WRAPPER_TYPES(V)
499 #else  // SVG
500 #define WRAPPER_TYPES(V) DOM_NODE_TYPES(V) DOM_OBJECT_TYPES(V)
501 #define NO_WRAPPER_TYPES(V) DOM_NO_WRAPPER_TYPES(V)
502 #endif  // SVG
503
504 #define ALL_WRAPPER_TYPES(V) WRAPPER_TYPES(V) NO_WRAPPER_TYPES(V)
505
506     class V8ClassIndex {
507     public:
508         // Type must start at non-negative numbers. See ToInt, FromInt.
509         enum V8WrapperType {
510             INVALID_CLASS_INDEX = 0,
511
512 #define DEFINE_ENUM(name, type) name, 
513             ALL_WRAPPER_TYPES(DEFINE_ENUM)
514 #undef DEFINE_ENUM
515
516             CLASSINDEX_END,
517             WRAPPER_TYPE_COUNT = CLASSINDEX_END
518         };
519
520         // FIXME: Convert to toInt after all the bindings are in one place.
521         static int ToInt(V8WrapperType type) { return static_cast<int>(type); }
522
523         // FIXME: Convert to fromInt after all the bindings are in one place.
524         static V8WrapperType FromInt(int v) {
525             ASSERT(INVALID_CLASS_INDEX <= v && v < CLASSINDEX_END);
526             return static_cast<V8WrapperType>(v);
527         }
528
529         // FIXME: Convert to getFactory after all the bindings are in one place.
530         static FunctionTemplateFactory GetFactory(V8WrapperType type);
531
532         // Returns a field to be used as cache for the template for the given type
533         // FIXME: Convert to getCache after all the bindings are in one place.
534         static v8::Persistent<v8::FunctionTemplate>* GetCache(V8WrapperType type);
535     };
536
537 }
538
539 #endif // V8Index_h