• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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(SHARED_WORKERS)
92 #define SHARED_WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V)                    \
93     V(SHAREDWORKER, SharedWorker)
94 #define SHARED_WORKER_NONNODE_WRAPPER_TYPES(V)
95 #else
96 #define SHARED_WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V)
97 #define SHARED_WORKER_NONNODE_WRAPPER_TYPES(V)
98 #endif
99 
100 #define DOM_NODE_TYPES(V)                                               \
101     V(ATTR, Attr)                                                       \
102     V(CHARACTERDATA, CharacterData)                                     \
103     V(CDATASECTION, CDATASection)                                       \
104     V(COMMENT, Comment)                                                 \
105     V(DOCUMENT, Document)                                               \
106     V(DOCUMENTFRAGMENT, DocumentFragment)                               \
107     V(DOCUMENTTYPE, DocumentType)                                       \
108     V(ELEMENT, Element)                                                 \
109     V(ENTITY, Entity)                                                   \
110     V(ENTITYREFERENCE, EntityReference)                                 \
111     V(HTMLDOCUMENT, HTMLDocument)                                       \
112     V(NODE, Node)                                                       \
113     V(NOTATION, Notation)                                               \
114     V(PROCESSINGINSTRUCTION, ProcessingInstruction)                     \
115     V(TEXT, Text)                                                       \
116     V(HTMLANCHORELEMENT, HTMLAnchorElement)                             \
117     V(HTMLAPPLETELEMENT, HTMLAppletElement)                             \
118     V(HTMLAREAELEMENT, HTMLAreaElement)                                 \
119     V(HTMLBASEELEMENT, HTMLBaseElement)                                 \
120     V(HTMLBASEFONTELEMENT, HTMLBaseFontElement)                         \
121     V(HTMLBLOCKQUOTEELEMENT, HTMLBlockquoteElement)                     \
122     V(HTMLBODYELEMENT, HTMLBodyElement)                                 \
123     V(HTMLBRELEMENT, HTMLBRElement)                                     \
124     V(HTMLBUTTONELEMENT, HTMLButtonElement)                             \
125     V(HTMLCANVASELEMENT, HTMLCanvasElement)                             \
126     V(HTMLDIRECTORYELEMENT, HTMLDirectoryElement)                       \
127     V(HTMLDIVELEMENT, HTMLDivElement)                                   \
128     V(HTMLDLISTELEMENT, HTMLDListElement)                               \
129     V(HTMLEMBEDELEMENT, HTMLEmbedElement)                               \
130     V(HTMLFIELDSETELEMENT, HTMLFieldSetElement)                         \
131     V(HTMLFONTELEMENT, HTMLFontElement)                                 \
132     V(HTMLFORMELEMENT, HTMLFormElement)                                 \
133     V(HTMLFRAMEELEMENT, HTMLFrameElement)                               \
134     V(HTMLFRAMESETELEMENT, HTMLFrameSetElement)                         \
135     V(HTMLHEADINGELEMENT, HTMLHeadingElement)                           \
136     V(HTMLHEADELEMENT, HTMLHeadElement)                                 \
137     V(HTMLHRELEMENT, HTMLHRElement)                                     \
138     V(HTMLHTMLELEMENT, HTMLHtmlElement)                                 \
139     V(HTMLIFRAMEELEMENT, HTMLIFrameElement)                             \
140     V(HTMLIMAGEELEMENT, HTMLImageElement)                               \
141     V(HTMLINPUTELEMENT, HTMLInputElement)                               \
142     V(HTMLISINDEXELEMENT, HTMLIsIndexElement)                           \
143     V(HTMLLABELELEMENT, HTMLLabelElement)                               \
144     V(HTMLLEGENDELEMENT, HTMLLegendElement)                             \
145     V(HTMLLIELEMENT, HTMLLIElement)                                     \
146     V(HTMLLINKELEMENT, HTMLLinkElement)                                 \
147     V(HTMLMAPELEMENT, HTMLMapElement)                                   \
148     V(HTMLMARQUEEELEMENT, HTMLMarqueeElement)                           \
149     V(HTMLMENUELEMENT, HTMLMenuElement)                                 \
150     V(HTMLMETAELEMENT, HTMLMetaElement)                                 \
151     V(HTMLMODELEMENT, HTMLModElement)                                   \
152     V(HTMLOBJECTELEMENT, HTMLObjectElement)                             \
153     V(HTMLOLISTELEMENT, HTMLOListElement)                               \
154     V(HTMLOPTGROUPELEMENT, HTMLOptGroupElement)                         \
155     V(HTMLOPTIONELEMENT, HTMLOptionElement)                             \
156     V(HTMLPARAGRAPHELEMENT, HTMLParagraphElement)                       \
157     V(HTMLPARAMELEMENT, HTMLParamElement)                               \
158     V(HTMLPREELEMENT, HTMLPreElement)                                   \
159     V(HTMLQUOTEELEMENT, HTMLQuoteElement)                               \
160     V(HTMLSCRIPTELEMENT, HTMLScriptElement)                             \
161     V(HTMLSELECTELEMENT, HTMLSelectElement)                             \
162     V(HTMLSTYLEELEMENT, HTMLStyleElement)                               \
163     V(HTMLTABLECAPTIONELEMENT, HTMLTableCaptionElement)                 \
164     V(HTMLTABLECOLELEMENT, HTMLTableColElement)                         \
165     V(HTMLTABLEELEMENT, HTMLTableElement)                               \
166     V(HTMLTABLESECTIONELEMENT, HTMLTableSectionElement)                 \
167     V(HTMLTABLECELLELEMENT, HTMLTableCellElement)                       \
168     V(HTMLTABLEROWELEMENT, HTMLTableRowElement)                         \
169     V(HTMLTEXTAREAELEMENT, HTMLTextAreaElement)                         \
170     V(HTMLTITLEELEMENT, HTMLTitleElement)                               \
171     V(HTMLULISTELEMENT, HTMLUListElement)                               \
172     V(HTMLELEMENT, HTMLElement)                                         \
173     DATAGRID_HTMLELEMENT_TYPES(V)                                       \
174     VIDEO_HTMLELEMENT_TYPES(V)
175 
176 #if ENABLE(SVG_ANIMATION)
177 #define SVG_ANIMATION_ELEMENT_TYPES(V)                                  \
178     V(SVGANIMATECOLORELEMENT, SVGAnimateColorElement)                   \
179     V(SVGANIMATEELEMENT, SVGAnimateElement)                             \
180     V(SVGANIMATETRANSFORMELEMENT, SVGAnimateTransformElement)           \
181     V(SVGANIMATIONELEMENT, SVGAnimationElement)                         \
182     V(SVGSETELEMENT, SVGSetElement)
183 #else
184 #define SVG_ANIMATION_ELEMENT_TYPES(V)
185 #endif
186 
187 #if ENABLE(SVG_FILTERS)
188 #define SVG_FILTERS_ELEMENT_TYPES(V)                                    \
189     V(SVGCOMPONENTTRANSFERFUNCTIONELEMENT, SVGComponentTransferFunctionElement)\
190     V(SVGFEBLENDELEMENT, SVGFEBlendElement)                             \
191     V(SVGFECOLORMATRIXELEMENT, SVGFEColorMatrixElement)                 \
192     V(SVGFECOMPONENTTRANSFERELEMENT, SVGFEComponentTransferElement)     \
193     V(SVGFECOMPOSITEELEMENT, SVGFECompositeElement)                     \
194     V(SVGFEDIFFUSELIGHTINGELEMENT, SVGFEDiffuseLightingElement)         \
195     V(SVGFEDISPLACEMENTMAPELEMENT, SVGFEDisplacementMapElement)         \
196     V(SVGFEDISTANTLIGHTELEMENT, SVGFEDistantLightElement)               \
197     V(SVGFEFLOODELEMENT, SVGFEFloodElement)                             \
198     V(SVGFEFUNCAELEMENT, SVGFEFuncAElement)                             \
199     V(SVGFEFUNCBELEMENT, SVGFEFuncBElement)                             \
200     V(SVGFEFUNCGELEMENT, SVGFEFuncGElement)                             \
201     V(SVGFEFUNCRELEMENT, SVGFEFuncRElement)                             \
202     V(SVGFEGAUSSIANBLURELEMENT, SVGFEGaussianBlurElement)               \
203     V(SVGFEIMAGEELEMENT, SVGFEImageElement)                             \
204     V(SVGFEMERGEELEMENT, SVGFEMergeElement)                             \
205     V(SVGFEMERGENODEELEMENT, SVGFEMergeNodeElement)                     \
206     V(SVGFEOFFSETELEMENT, SVGFEOffsetElement)                           \
207     V(SVGFEPOINTLIGHTELEMENT, SVGFEPointLightElement)                   \
208     V(SVGFESPECULARLIGHTINGELEMENT, SVGFESpecularLightingElement)       \
209     V(SVGFESPOTLIGHTELEMENT, SVGFESpotLightElement)                     \
210     V(SVGFETILEELEMENT, SVGFETileElement)                               \
211     V(SVGFETURBULENCEELEMENT, SVGFETurbulenceElement)                   \
212     V(SVGFILTERELEMENT, SVGFilterElement)
213 #else
214 #define SVG_FILTERS_ELEMENT_TYPES(V)
215 #endif
216 
217 #if ENABLE(SVG_FONTS)
218 #define SVG_FONTS_ELEMENT_TYPES(V)                                      \
219     V(SVGDEFINITIONSRCELEMENT, SVGDefinitionSrcElement)                 \
220     V(SVGFONTFACEELEMENT, SVGFontFaceElement)                           \
221     V(SVGFONTFACEFORMATELEMENT, SVGFontFaceFormatElement)               \
222     V(SVGFONTFACENAMEELEMENT, SVGFontFaceNameElement)                   \
223     V(SVGFONTFACESRCELEMENT, SVGFontFaceSrcElement)                     \
224     V(SVGFONTFACEURIELEMENT, SVGFontFaceUriElement)
225 #else
226 #define SVG_FONTS_ELEMENT_TYPES(V)
227 #endif
228 
229 #if ENABLE(SVG_FOREIGN_OBJECT)
230 #define SVG_FOREIGN_OBJECT_ELEMENT_TYPES(V)                             \
231     V(SVGFOREIGNOBJECTELEMENT, SVGForeignObjectElement)
232 #else
233 #define SVG_FOREIGN_OBJECT_ELEMENT_TYPES(V)
234 #endif
235 
236 #if ENABLE(SVG_USE)
237 #define SVG_USE_ELEMENT_TYPES(V)                                        \
238     V(SVGUSEELEMENT, SVGUseElement)
239 #else
240 #define SVG_USE_ELEMENT_TYPES(V)
241 #endif
242 
243 #if ENABLE(SVG)
244 #define SVG_NODE_TYPES(V)                                               \
245     SVG_ANIMATION_ELEMENT_TYPES(V)                                      \
246     SVG_FILTERS_ELEMENT_TYPES(V)                                        \
247     SVG_FONTS_ELEMENT_TYPES(V)                                          \
248     SVG_FOREIGN_OBJECT_ELEMENT_TYPES(V)                                 \
249     SVG_USE_ELEMENT_TYPES(V)                                            \
250     V(SVGAELEMENT, SVGAElement)                                         \
251     V(SVGALTGLYPHELEMENT, SVGAltGlyphElement)                           \
252     V(SVGCIRCLEELEMENT, SVGCircleElement)                               \
253     V(SVGCLIPPATHELEMENT, SVGClipPathElement)                           \
254     V(SVGCURSORELEMENT, SVGCursorElement)                               \
255     V(SVGDEFSELEMENT, SVGDefsElement)                                   \
256     V(SVGDESCELEMENT, SVGDescElement)                                   \
257     V(SVGELLIPSEELEMENT, SVGEllipseElement)                             \
258     V(SVGGELEMENT, SVGGElement)                                         \
259     V(SVGGLYPHELEMENT, SVGGlyphElement)                                 \
260     V(SVGGRADIENTELEMENT, SVGGradientElement)                           \
261     V(SVGIMAGEELEMENT, SVGImageElement)                                 \
262     V(SVGLINEARGRADIENTELEMENT, SVGLinearGradientElement)               \
263     V(SVGLINEELEMENT, SVGLineElement)                                   \
264     V(SVGMARKERELEMENT, SVGMarkerElement)                               \
265     V(SVGMASKELEMENT, SVGMaskElement)                                   \
266     V(SVGMETADATAELEMENT, SVGMetadataElement)                           \
267     V(SVGPATHELEMENT, SVGPathElement)                                   \
268     V(SVGPATTERNELEMENT, SVGPatternElement)                             \
269     V(SVGPOLYGONELEMENT, SVGPolygonElement)                             \
270     V(SVGPOLYLINEELEMENT, SVGPolylineElement)                           \
271     V(SVGRADIALGRADIENTELEMENT, SVGRadialGradientElement)               \
272     V(SVGRECTELEMENT, SVGRectElement)                                   \
273     V(SVGSCRIPTELEMENT, SVGScriptElement)                               \
274     V(SVGSTOPELEMENT, SVGStopElement)                                   \
275     V(SVGSTYLEELEMENT, SVGStyleElement)                                 \
276     V(SVGSVGELEMENT, SVGSVGElement)                                     \
277     V(SVGSWITCHELEMENT, SVGSwitchElement)                               \
278     V(SVGSYMBOLELEMENT, SVGSymbolElement)                               \
279     V(SVGTEXTCONTENTELEMENT, SVGTextContentElement)                     \
280     V(SVGTEXTELEMENT, SVGTextElement)                                   \
281     V(SVGTEXTPATHELEMENT, SVGTextPathElement)                           \
282     V(SVGTEXTPOSITIONINGELEMENT, SVGTextPositioningElement)             \
283     V(SVGTITLEELEMENT, SVGTitleElement)                                 \
284     V(SVGTREFELEMENT, SVGTRefElement)                                   \
285     V(SVGTSPANELEMENT, SVGTSpanElement)                                 \
286     V(SVGVIEWELEMENT, SVGViewElement)                                   \
287     V(SVGELEMENT, SVGElement)                                           \
288     V(SVGDOCUMENT, SVGDocument)
289 #endif  // SVG
290 
291 
292 // ACTIVE_DOM_OBJECT_TYPES are DOM_OBJECT_TYPES that need special treatement
293 // during GC.
294 #define ACTIVE_DOM_OBJECT_TYPES(V)                                      \
295     V(MESSAGEPORT, MessagePort)                                         \
296     V(XMLHTTPREQUEST, XMLHttpRequest)                                   \
297     WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V)                               \
298     SHARED_WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V)
299 
300 // NOTE: DOM_OBJECT_TYPES is split into two halves because
301 //       Visual Studio's Intellinonsense crashes when macros get
302 //       too large.  10-29-08
303 // DOM_OBJECT_TYPES are non-node DOM types.
304 #define DOM_OBJECT_TYPES_1(V)                                           \
305     V(BARINFO, BarInfo)                                                 \
306     V(CANVASGRADIENT, CanvasGradient)                                   \
307     V(CANVASPATTERN, CanvasPattern)                                     \
308     V(CANVASRENDERINGCONTEXT2D, CanvasRenderingContext2D)               \
309     V(CLIENTRECT, ClientRect)                                           \
310     V(CLIENTRECTLIST, ClientRectList)                                   \
311     V(CLIPBOARD, Clipboard)                                             \
312     V(CONSOLE, Console)                                                 \
313     V(COUNTER, Counter)                                                 \
314     V(CSSCHARSETRULE, CSSCharsetRule)                                   \
315     V(CSSFONTFACERULE, CSSFontFaceRule)                                 \
316     V(CSSIMPORTRULE, CSSImportRule)                                     \
317     V(CSSMEDIARULE, CSSMediaRule)                                       \
318     V(CSSPAGERULE, CSSPageRule)                                         \
319     V(CSSPRIMITIVEVALUE, CSSPrimitiveValue)                             \
320     V(CSSRULE, CSSRule)                                                 \
321     V(CSSRULELIST, CSSRuleList)                                         \
322     V(CSSSTYLEDECLARATION, CSSStyleDeclaration)                         \
323     V(CSSSTYLERULE, CSSStyleRule)                                       \
324     V(CSSSTYLESHEET, CSSStyleSheet)                                     \
325     V(CSSVALUE, CSSValue)                                               \
326     V(CSSVALUELIST, CSSValueList)                                       \
327     V(CSSVARIABLESDECLARATION, CSSVariablesDeclaration)                 \
328     V(CSSVARIABLESRULE, CSSVariablesRule)                               \
329     V(DOMCOREEXCEPTION, DOMCoreException)                               \
330     V(DOMIMPLEMENTATION, DOMImplementation)                             \
331     V(DOMPARSER, DOMParser)                                             \
332     V(DOMSELECTION, DOMSelection)                                       \
333     V(DOMWINDOW, DOMWindow)                                             \
334     V(EVENT, Event)                                                     \
335     V(EVENTEXCEPTION, EventException)                                   \
336     V(FILE, File)                                                       \
337     V(FILELIST, FileList)                                               \
338     V(HISTORY, History)                                                 \
339     V(HTMLALLCOLLECTION, HTMLAllCollection)                             \
340     V(HTMLCOLLECTION, HTMLCollection)                                   \
341     V(HTMLOPTIONSCOLLECTION, HTMLOptionsCollection)                     \
342     V(IMAGEDATA, ImageData)                                             \
343     V(CANVASPIXELARRAY, CanvasPixelArray)                               \
344     V(KEYBOARDEVENT, KeyboardEvent)                                     \
345     V(LOCATION, Location)                                               \
346     V(MEDIA, Media)                                                     \
347     V(MEDIALIST, MediaList)
348 
349 #define DOM_OBJECT_TYPES_2(V)                                           \
350     V(MESSAGECHANNEL, MessageChannel)                                   \
351     V(MESSAGEEVENT, MessageEvent)                                       \
352     V(MIMETYPE, MimeType)                                               \
353     V(MIMETYPEARRAY, MimeTypeArray)                                     \
354     V(MOUSEEVENT, MouseEvent)                                           \
355     V(MUTATIONEVENT, MutationEvent)                                     \
356     V(NAMEDNODEMAP, NamedNodeMap)                                       \
357     V(NAVIGATOR, Navigator)                                             \
358     V(NODEFILTER, NodeFilter)                                           \
359     V(NODEITERATOR, NodeIterator)                                       \
360     V(NODELIST, NodeList)                                               \
361     V(OVERFLOWEVENT, OverflowEvent)                                     \
362     V(PLUGIN, Plugin)                                                   \
363     V(PLUGINARRAY, PluginArray)                                         \
364     V(PROGRESSEVENT, ProgressEvent)                                     \
365     V(RANGE, Range)                                                     \
366     V(RANGEEXCEPTION, RangeException)                                   \
367     V(RECT, Rect)                                                       \
368     V(RGBCOLOR, RGBColor)                                               \
369     V(SCREEN, Screen)                                                   \
370     V(STYLESHEET, StyleSheet)                                           \
371     V(STYLESHEETLIST, StyleSheetList)                                   \
372     V(TEXTEVENT, TextEvent)                                             \
373     V(TEXTMETRICS, TextMetrics)                                         \
374     V(TREEWALKER, TreeWalker)                                           \
375     V(UIEVENT, UIEvent)                                                 \
376     V(VALIDITYSTATE, ValidityState)                                     \
377     V(VOIDCALLBACK, VoidCallback)                                       \
378     V(WEBKITANIMATIONEVENT, WebKitAnimationEvent)                       \
379     V(WEBKITCSSKEYFRAMERULE, WebKitCSSKeyframeRule)                     \
380     V(WEBKITCSSKEYFRAMESRULE, WebKitCSSKeyframesRule)                   \
381     V(WEBKITCSSMATRIX, WebKitCSSMatrix)                                 \
382     V(WEBKITPOINT, WebKitPoint)                                         \
383     V(WEBKITCSSTRANSFORMVALUE, WebKitCSSTransformValue)                 \
384     V(WEBKITTRANSITIONEVENT, WebKitTransitionEvent)                     \
385     V(WHEELEVENT, WheelEvent)                                           \
386     V(XMLHTTPREQUESTUPLOAD, XMLHttpRequestUpload)                       \
387     V(XMLHTTPREQUESTEXCEPTION, XMLHttpRequestException)                 \
388     V(XMLHTTPREQUESTPROGRESSEVENT, XMLHttpRequestProgressEvent)         \
389     V(XMLSERIALIZER, XMLSerializer)                                     \
390     ACTIVE_DOM_OBJECT_TYPES(V)                                          \
391     APPLICATIONCACHE_NONNODE_WRAPPER_TYPES(V)                           \
392     DATAGRID_NONNODE_TYPES(V)                                           \
393     VIDEO_NONNODE_TYPES(V)                                              \
394     SHARED_WORKER_NONNODE_WRAPPER_TYPES(V)                              \
395     WORKER_NONNODE_WRAPPER_TYPES(V)
396 
397 #if ENABLE(XPATH)
398 #define DOM_OBJECT_XPATH_TYPES(V)                                       \
399     V(XPATHEVALUATOR, XPathEvaluator)                                   \
400     V(XPATHEXCEPTION, XPathException)                                   \
401     V(XPATHEXPRESSION, XPathExpression)                                 \
402     V(XPATHNSRESOLVER, XPathNSResolver)                                 \
403     V(XPATHRESULT, XPathResult)
404 #else
405 #define DOM_OBJECT_XPATH_TYPES(V)
406 #endif
407 
408 #if ENABLE(XSLT)
409 #define DOM_OBJECT_XSLT_TYPES(V)                                        \
410     V(XSLTPROCESSOR, XSLTProcessor)
411 #else
412 #define DOM_OBJECT_XSLT_TYPES(V)
413 #endif
414 
415 #if ENABLE(DATABASE)
416 #define DOM_OBJECT_DATABASE_TYPES(V)                                    \
417     V(DATABASE, Database)                                               \
418     V(SQLERROR, SQLError)                                               \
419     V(SQLRESULTSET, SQLResultSet)                                       \
420     V(SQLRESULTSETROWLIST, SQLResultSetRowList)                         \
421     V(SQLTRANSACTION, SQLTransaction)
422 #else
423 #define DOM_OBJECT_DATABASE_TYPES(V)
424 #endif
425 
426 #if ENABLE(DOM_STORAGE)
427 #define DOM_OBJECT_STORAGE_TYPES(V)                                     \
428     V(STORAGE, Storage)                                                 \
429     V(STORAGEEVENT, StorageEvent)
430 #else
431 #define DOM_OBJECT_STORAGE_TYPES(V)
432 #endif
433 
434 #if ENABLE(WORKERS)
435 #define DOM_OBJECT_WORKERS_TYPES(V)                                     \
436     V(ERROREVENT, ErrorEvent)
437 #else
438 #define DOM_OBJECT_WORKERS_TYPES(V)
439 #endif
440 
441 #if ENABLE(GEOLOCATION)
442 #define DOM_OBJECT_GEOLOCATION_TYPES(V)                                 \
443     V(COORDINATES, Coordinates)                                         \
444     V(GEOLOCATION, Geolocation)                                         \
445     V(GEOPOSITION, Geoposition)                                         \
446     V(POSITIONERROR, PositionError)
447 #else
448 #define DOM_OBJECT_GEOLOCATION_TYPES(V)
449 #endif
450 
451 #if ENABLE(TOUCH_EVENTS)
452 #define DOM_OBJECT_TOUCH_EVENT_TYPES(V)                                 \
453     V(TOUCHLIST, TouchList)                                             \
454     V(TOUCHEVENT, TouchEvent)                                           \
455     V(TOUCH, Touch)
456 #else
457 #define DOM_OBJECT_TOUCH_EVENT_TYPES(V)
458 #endif
459 
460 #if PLATFORM(CHROMIUM)
461 #define DOM_OBJECT_TYPES(V)                                             \
462     DOM_OBJECT_TYPES_1(V)                                               \
463     DOM_OBJECT_TYPES_2(V)                                               \
464     DOM_OBJECT_DATABASE_TYPES(V)                                        \
465     DOM_OBJECT_STORAGE_TYPES(V)                                         \
466     DOM_OBJECT_WORKERS_TYPES(V)                                         \
467     DOM_OBJECT_XPATH_TYPES(V)                                           \
468     DOM_OBJECT_XSLT_TYPES(V)                                            \
469     V(INSPECTORBACKEND, InspectorBackend)
470 #elif PLATFORM(ANDROID)
471 #define DOM_OBJECT_TYPES(V)                                             \
472     DOM_OBJECT_TYPES_1(V)                                               \
473     DOM_OBJECT_TYPES_2(V)                                               \
474     DOM_OBJECT_DATABASE_TYPES(V)                                        \
475     DOM_OBJECT_GEOLOCATION_TYPES(V)                                     \
476     DOM_OBJECT_STORAGE_TYPES(V)                                         \
477     DOM_OBJECT_TOUCH_EVENT_TYPES(V)                                     \
478     DOM_OBJECT_WORKERS_TYPES(V)
479 #endif
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.
ToInt(V8WrapperType type)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.
FromInt(int v)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
613