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