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