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