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