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