diff --git a/js/js.libraries/src/core/dom.kt b/js/js.libraries/src/core/dom.kt index 1f30f4aaf29..1e1822b043f 100644 --- a/js/js.libraries/src/core/dom.kt +++ b/js/js.libraries/src/core/dom.kt @@ -1181,7 +1181,7 @@ native trait HTMLParamElement : HTMLElement { get() = noImpl set(value) = noImpl } -native trait HTMLVideoElement : HTMLMediaElement { +native trait HTMLVideoElement : HTMLMediaElement, CanvasImageSource, ImageBitmapSource { var width : Int get() = noImpl set(value) = noImpl @@ -1239,12 +1239,12 @@ native trait HTMLTrackElement : HTMLElement { var track : TextTrack get() = noImpl set(value) = noImpl -companion object { - val NONE : Short = 0 - val LOADING : Short = 1 - val LOADED : Short = 2 - val ERROR : Short = 3 -} + companion object { + val NONE : Short = 0 + val LOADING : Short = 1 + val LOADED : Short = 2 + val ERROR : Short = 3 + } } native trait HTMLMediaElement : HTMLElement { var error : MediaError? @@ -1341,28 +1341,28 @@ native trait HTMLMediaElement : HTMLElement { fun play() : Unit = noImpl fun pause() : Unit = noImpl fun addTextTrack(kind : String, label : String = "", language : String = "") : TextTrack = noImpl -companion object { - val NETWORK_EMPTY : Short = 0 - val NETWORK_IDLE : Short = 1 - val NETWORK_LOADING : Short = 2 - val NETWORK_NO_SOURCE : Short = 3 - val HAVE_NOTHING : Short = 0 - val HAVE_METADATA : Short = 1 - val HAVE_CURRENT_DATA : Short = 2 - val HAVE_FUTURE_DATA : Short = 3 - val HAVE_ENOUGH_DATA : Short = 4 -} + companion object { + val NETWORK_EMPTY : Short = 0 + val NETWORK_IDLE : Short = 1 + val NETWORK_LOADING : Short = 2 + val NETWORK_NO_SOURCE : Short = 3 + val HAVE_NOTHING : Short = 0 + val HAVE_METADATA : Short = 1 + val HAVE_CURRENT_DATA : Short = 2 + val HAVE_FUTURE_DATA : Short = 3 + val HAVE_ENOUGH_DATA : Short = 4 + } } native trait MediaError { var code : Short get() = noImpl set(value) = noImpl -companion object { - val MEDIA_ERR_ABORTED : Short = 1 - val MEDIA_ERR_NETWORK : Short = 2 - val MEDIA_ERR_DECODE : Short = 3 - val MEDIA_ERR_SRC_NOT_SUPPORTED : Short = 4 -} + companion object { + val MEDIA_ERR_ABORTED : Short = 1 + val MEDIA_ERR_NETWORK : Short = 2 + val MEDIA_ERR_DECODE : Short = 3 + val MEDIA_ERR_SRC_NOT_SUPPORTED : Short = 4 + } } native trait AudioTrackList : EventTarget { var length : Int @@ -2581,27 +2581,27 @@ native trait HTMLTemplateElement : HTMLElement { get() = noImpl set(value) = noImpl } -native trait HTMLCanvasElement : HTMLElement { +native trait HTMLCanvasElement : HTMLElement, CanvasImageSource, ImageBitmapSource { var width : Int get() = noImpl set(value) = noImpl var height : Int get() = noImpl set(value) = noImpl - fun getContext(contextId : String, vararg arguments : Any) : dynamic = noImpl + fun getContext(contextId : String, vararg arguments : Any) : RenderingContext? = noImpl fun probablySupportsContext(contextId : String, vararg arguments : Any) : Boolean = noImpl - fun setContext(context : dynamic) : Unit = noImpl + fun setContext(context : RenderingContext) : Unit = noImpl fun transferControlToProxy() : CanvasProxy = noImpl fun toDataURL(type : String = noImpl, vararg arguments : Any) : String = noImpl fun toBlob(_callback : () -> Unit?, type : String = noImpl, vararg arguments : Any) : Unit = noImpl } native trait CanvasProxy { - fun setContext(context : dynamic) : Unit = noImpl + fun setContext(context : RenderingContext) : Unit = noImpl } native open class CanvasRenderingContext2DSettings { var alpha : dynamic = true } -native open class CanvasRenderingContext2D { +native open class CanvasRenderingContext2D : RenderingContext, CanvasImageSource, ImageBitmapSource { var canvas : HTMLCanvasElement get() = noImpl set(value) = noImpl @@ -2679,7 +2679,7 @@ native open class CanvasRenderingContext2D { fun resetTransform() : Unit = noImpl fun createLinearGradient(x0 : Double, y0 : Double, x1 : Double, y1 : Double) : CanvasGradient = noImpl fun createRadialGradient(x0 : Double, y0 : Double, r0 : Double, x1 : Double, y1 : Double, r1 : Double) : CanvasGradient = noImpl - fun createPattern(image : dynamic, repetition : String) : CanvasPattern = noImpl + fun createPattern(image : CanvasImageSource, repetition : String) : CanvasPattern = noImpl fun clearRect(x : Double, y : Double, w : Double, h : Double) : Unit = noImpl fun fillRect(x : Double, y : Double, w : Double, h : Double) : Unit = noImpl fun strokeRect(x : Double, y : Double, w : Double, h : Double) : Unit = noImpl @@ -2702,9 +2702,9 @@ native open class CanvasRenderingContext2D { fun fillText(text : String, x : Double, y : Double, maxWidth : Double = noImpl) : Unit = noImpl fun strokeText(text : String, x : Double, y : Double, maxWidth : Double = noImpl) : Unit = noImpl fun measureText(text : String) : TextMetrics = noImpl - fun drawImage(image : dynamic, dx : Double, dy : Double) : Unit = noImpl - fun drawImage(image : dynamic, dx : Double, dy : Double, dw : Double, dh : Double) : Unit = noImpl - fun drawImage(image : dynamic, sx : Double, sy : Double, sw : Double, sh : Double, dx : Double, dy : Double, dw : Double, dh : Double) : Unit = noImpl + fun drawImage(image : CanvasImageSource, dx : Double, dy : Double) : Unit = noImpl + fun drawImage(image : CanvasImageSource, dx : Double, dy : Double, dw : Double, dh : Double) : Unit = noImpl + fun drawImage(image : CanvasImageSource, sx : Double, sy : Double, sw : Double, sh : Double, dx : Double, dy : Double, dw : Double, dh : Double) : Unit = noImpl fun addHitRegion(options : HitRegionOptions = noImpl) : Unit = noImpl fun removeHitRegion(id : String) : Unit = noImpl fun clearHitRegions() : Unit = noImpl @@ -2780,7 +2780,7 @@ native open class HitRegionOptions { var label : dynamic = null var role : dynamic = null } -native open class ImageData(sw : Int, sh : Int) { +native open class ImageData(sw : Int, sh : Int) : ImageBitmapSource { var width : Int get() = noImpl set(value) = noImpl @@ -3269,8 +3269,8 @@ native trait Window : EventTarget { fun setInterval(handler : () -> dynamic, timeout : Int = 0, vararg arguments : Any) : Int = noImpl fun setInterval(handler : String, timeout : Int = 0, vararg arguments : Any) : Int = noImpl fun clearInterval(handle : Int = 0) : Unit = noImpl - fun createImageBitmap(image : dynamic) : dynamic = noImpl - fun createImageBitmap(image : dynamic, sx : Int, sy : Int, sw : Int, sh : Int) : dynamic = noImpl + fun createImageBitmap(image : ImageBitmapSource) : dynamic = noImpl + fun createImageBitmap(image : ImageBitmapSource, sx : Int, sy : Int, sw : Int, sh : Int) : dynamic = noImpl fun fetch(input : dynamic, init : RequestInit = noImpl) : dynamic = noImpl } native trait BarProp { @@ -3363,14 +3363,14 @@ native trait ApplicationCache : EventTarget { fun update() : Unit = noImpl fun abort() : Unit = noImpl fun swapCache() : Unit = noImpl -companion object { - val UNCACHED : Short = 0 - val IDLE : Short = 1 - val CHECKING : Short = 2 - val DOWNLOADING : Short = 3 - val UPDATEREADY : Short = 4 - val OBSOLETE : Short = 5 -} + companion object { + val UNCACHED : Short = 0 + val IDLE : Short = 1 + val CHECKING : Short = 2 + val DOWNLOADING : Short = 3 + val UPDATEREADY : Short = 4 + val OBSOLETE : Short = 5 + } } native open class ErrorEvent(type : String, eventInitDict : ErrorEventInit = noImpl) : Event(type, eventInitDict) { var message : String @@ -3507,7 +3507,7 @@ native trait External { fun AddSearchProvider(engineURL : String) : Unit = noImpl fun IsSearchProviderInstalled(engineURL : String) : Int = noImpl } -native trait ImageBitmap { +native trait ImageBitmap : CanvasImageSource, ImageBitmapSource { var width : Int get() = noImpl set(value) = noImpl @@ -3560,11 +3560,11 @@ native open class EventSource(url : String, eventSourceInitDict : EventSourceIni get() = noImpl set(value) = noImpl fun close() : Unit = noImpl -companion object { - val CONNECTING : Short = 0 - val OPEN : Short = 1 - val CLOSED : Short = 2 -} + companion object { + val CONNECTING : Short = 0 + val OPEN : Short = 1 + val CLOSED : Short = 2 + } } native open class EventSourceInit { var withCredentials : dynamic = false @@ -3604,12 +3604,12 @@ native open class WebSocket(url : String, protocols : dynamic = noImpl) : EventT fun send(data : String) : Unit = noImpl fun send(data : Blob) : Unit = noImpl fun send(data : dynamic) : Unit = noImpl -companion object { - val CONNECTING : Short = 0 - val OPEN : Short = 1 - val CLOSING : Short = 2 - val CLOSED : Short = 3 -} + companion object { + val CONNECTING : Short = 0 + val OPEN : Short = 1 + val CLOSING : Short = 2 + val CLOSED : Short = 3 + } } native open class CloseEvent(type : String, eventInitDict : CloseEventInit = noImpl) : Event(type, eventInitDict) { var wasClean : Boolean @@ -3686,8 +3686,8 @@ native trait WorkerGlobalScope : EventTarget { set(value) = noImpl fun close() : Unit = noImpl fun importScripts(vararg urls : String) : Unit = noImpl - fun createImageBitmap(image : dynamic) : dynamic = noImpl - fun createImageBitmap(image : dynamic, sx : Int, sy : Int, sw : Int, sh : Int) : dynamic = noImpl + fun createImageBitmap(image : ImageBitmapSource) : dynamic = noImpl + fun createImageBitmap(image : ImageBitmapSource, sx : Int, sy : Int, sw : Int, sh : Int) : dynamic = noImpl fun setTimeout(handler : () -> dynamic, timeout : Int = 0, vararg arguments : Any) : Int = noImpl fun setTimeout(handler : String, timeout : Int = 0, vararg arguments : Any) : Int = noImpl fun clearTimeout(handle : Int = 0) : Unit = noImpl @@ -3983,7 +3983,7 @@ native trait HTMLFontElement : HTMLElement { get() = noImpl set(value) = noImpl } -native trait HTMLImageElement : HTMLElement { +native trait HTMLImageElement : HTMLElement, CanvasImageSource, ImageBitmapSource { var name : String get() = noImpl set(value) = noImpl @@ -4079,12 +4079,12 @@ native open class Event(type : String, eventInitDict : EventInit = noImpl) { fun stopImmediatePropagation() : Unit = noImpl fun preventDefault() : Unit = noImpl fun initEvent(type : String, bubbles : Boolean, cancelable : Boolean) : Unit = noImpl -companion object { - val NONE : Short = 0 - val CAPTURING_PHASE : Short = 1 - val AT_TARGET : Short = 2 - val BUBBLING_PHASE : Short = 3 -} + companion object { + val NONE : Short = 0 + val CAPTURING_PHASE : Short = 1 + val AT_TARGET : Short = 2 + val BUBBLING_PHASE : Short = 3 + } } native open class EventInit { var bubbles : dynamic = false @@ -4219,26 +4219,26 @@ native trait Node : EventTarget { fun appendChild(node : Node) : Node = noImpl fun replaceChild(node : Node, child : Node) : Node = noImpl fun removeChild(child : Node) : Node = noImpl -companion object { - val ELEMENT_NODE : Short = 1 - val ATTRIBUTE_NODE : Short = 2 - val TEXT_NODE : Short = 3 - val CDATA_SECTION_NODE : Short = 4 - val ENTITY_REFERENCE_NODE : Short = 5 - val ENTITY_NODE : Short = 6 - val PROCESSING_INSTRUCTION_NODE : Short = 7 - val COMMENT_NODE : Short = 8 - val DOCUMENT_NODE : Short = 9 - val DOCUMENT_TYPE_NODE : Short = 10 - val DOCUMENT_FRAGMENT_NODE : Short = 11 - val NOTATION_NODE : Short = 12 - val DOCUMENT_POSITION_DISCONNECTED : Short = 0x01 - val DOCUMENT_POSITION_PRECEDING : Short = 0x02 - val DOCUMENT_POSITION_FOLLOWING : Short = 0x04 - val DOCUMENT_POSITION_CONTAINS : Short = 0x08 - val DOCUMENT_POSITION_CONTAINED_BY : Short = 0x10 - val DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC : Short = 0x20 -} + companion object { + val ELEMENT_NODE : Short = 1 + val ATTRIBUTE_NODE : Short = 2 + val TEXT_NODE : Short = 3 + val CDATA_SECTION_NODE : Short = 4 + val ENTITY_REFERENCE_NODE : Short = 5 + val ENTITY_NODE : Short = 6 + val PROCESSING_INSTRUCTION_NODE : Short = 7 + val COMMENT_NODE : Short = 8 + val DOCUMENT_NODE : Short = 9 + val DOCUMENT_TYPE_NODE : Short = 10 + val DOCUMENT_FRAGMENT_NODE : Short = 11 + val NOTATION_NODE : Short = 12 + val DOCUMENT_POSITION_DISCONNECTED : Short = 0x01 + val DOCUMENT_POSITION_PRECEDING : Short = 0x02 + val DOCUMENT_POSITION_FOLLOWING : Short = 0x04 + val DOCUMENT_POSITION_CONTAINS : Short = 0x08 + val DOCUMENT_POSITION_CONTAINED_BY : Short = 0x10 + val DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC : Short = 0x20 + } } native trait DOMImplementation { fun createDocumentType(qualifiedName : String, publicId : String, systemId : String) : DocumentType = noImpl @@ -4498,12 +4498,12 @@ native open class Range { fun comparePoint(node : Node, offset : Int) : Short = noImpl fun intersectsNode(node : Node) : Boolean = noImpl fun createContextualFragment(fragment : String) : DocumentFragment = noImpl -companion object { - val START_TO_START : Short = 0 - val START_TO_END : Short = 1 - val END_TO_END : Short = 2 - val END_TO_START : Short = 3 -} + companion object { + val START_TO_START : Short = 0 + val START_TO_END : Short = 1 + val END_TO_END : Short = 2 + val END_TO_START : Short = 3 + } } native trait NodeIterator { var root : Node @@ -4548,24 +4548,24 @@ native trait TreeWalker { } native trait NodeFilter { fun acceptNode(node : Node) : Short = noImpl -companion object { - val FILTER_ACCEPT : Short = 1 - val FILTER_REJECT : Short = 2 - val FILTER_SKIP : Short = 3 - val SHOW_ALL : Int = noImpl - val SHOW_ELEMENT : Int = 0x1 - val SHOW_ATTRIBUTE : Int = 0x2 - val SHOW_TEXT : Int = 0x4 - val SHOW_CDATA_SECTION : Int = 0x8 - val SHOW_ENTITY_REFERENCE : Int = 0x10 - val SHOW_ENTITY : Int = 0x20 - val SHOW_PROCESSING_INSTRUCTION : Int = 0x40 - val SHOW_COMMENT : Int = 0x80 - val SHOW_DOCUMENT : Int = 0x100 - val SHOW_DOCUMENT_TYPE : Int = 0x200 - val SHOW_DOCUMENT_FRAGMENT : Int = 0x400 - val SHOW_NOTATION : Int = 0x800 -} + companion object { + val FILTER_ACCEPT : Short = 1 + val FILTER_REJECT : Short = 2 + val FILTER_SKIP : Short = 3 + val SHOW_ALL : Int = noImpl + val SHOW_ELEMENT : Int = 0x1 + val SHOW_ATTRIBUTE : Int = 0x2 + val SHOW_TEXT : Int = 0x4 + val SHOW_CDATA_SECTION : Int = 0x8 + val SHOW_ENTITY_REFERENCE : Int = 0x10 + val SHOW_ENTITY : Int = 0x20 + val SHOW_PROCESSING_INSTRUCTION : Int = 0x40 + val SHOW_COMMENT : Int = 0x80 + val SHOW_DOCUMENT : Int = 0x100 + val SHOW_DOCUMENT_TYPE : Int = 0x200 + val SHOW_DOCUMENT_FRAGMENT : Int = 0x400 + val SHOW_NOTATION : Int = 0x800 + } } native trait DOMTokenList { var length : Int @@ -4645,11 +4645,11 @@ native open class WheelEvent(typeArg : String, wheelEventInitDict : WheelEventIn get() = noImpl set(value) = noImpl fun initWheelEvent(typeArg : String, bubblesArg : Boolean, cancelableArg : Boolean, viewArg : Window?, detailArg : Int, screenXArg : Int, screenYArg : Int, clientXArg : Int, clientYArg : Int, buttonArg : Short, relatedTargetArg : EventTarget?, modifiersListArg : String, deltaXArg : Double, deltaYArg : Double, deltaZArg : Double, deltaMode : Int) : Unit = noImpl -companion object { - val DOM_DELTA_PIXEL : Int = 0x00 - val DOM_DELTA_LINE : Int = 0x01 - val DOM_DELTA_PAGE : Int = 0x02 -} + companion object { + val DOM_DELTA_PIXEL : Int = 0x00 + val DOM_DELTA_LINE : Int = 0x01 + val DOM_DELTA_PAGE : Int = 0x02 + } } native open class WheelEventInit : MouseEventInit() { var deltaX : dynamic = 0.0 @@ -4696,12 +4696,12 @@ native open class KeyboardEvent(typeArg : String, keyboardEventInitDict : Keyboa set(value) = noImpl fun getModifierState(keyArg : String) : Boolean = noImpl fun initKeyboardEvent(typeArg : String, bubblesArg : Boolean, cancelableArg : Boolean, viewArg : Window?, keyArg : String, locationArg : Int, modifiersListArg : String, repeat : Boolean, locale : String) : Unit = noImpl -companion object { - val DOM_KEY_LOCATION_STANDARD : Int = 0x00 - val DOM_KEY_LOCATION_LEFT : Int = 0x01 - val DOM_KEY_LOCATION_RIGHT : Int = 0x02 - val DOM_KEY_LOCATION_NUMPAD : Int = 0x03 -} + companion object { + val DOM_KEY_LOCATION_STANDARD : Int = 0x00 + val DOM_KEY_LOCATION_LEFT : Int = 0x01 + val DOM_KEY_LOCATION_RIGHT : Int = 0x02 + val DOM_KEY_LOCATION_NUMPAD : Int = 0x03 + } } native open class KeyboardEventInit : EventModifierInit() { var key : dynamic = "" @@ -4736,11 +4736,11 @@ native open class MutationEvent : Event(noImpl, noImpl) { get() = noImpl set(value) = noImpl fun initMutationEvent(typeArg : String, bubblesArg : Boolean, cancelableArg : Boolean, relatedNodeArg : Node?, prevValueArg : String, newValueArg : String, attrNameArg : String, attrChangeArg : Short) : Unit = noImpl -companion object { - val MODIFICATION : Short = 1 - val ADDITION : Short = 2 - val REMOVAL : Short = 3 -} + companion object { + val MODIFICATION : Short = 1 + val ADDITION : Short = 2 + val REMOVAL : Short = 3 + } } native trait Selection { var anchorNode : Node? @@ -4866,13 +4866,13 @@ native open class XMLHttpRequest : XMLHttpRequestEventTarget { fun getResponseHeader(name : String) : String? = noImpl fun getAllResponseHeaders() : String = noImpl fun overrideMimeType(mime : String) : Unit = noImpl -companion object { - val UNSENT : Short = 0 - val OPENED : Short = 1 - val HEADERS_RECEIVED : Short = 2 - val LOADING : Short = 3 - val DONE : Short = 4 -} + companion object { + val UNSENT : Short = 0 + val OPENED : Short = 1 + val HEADERS_RECEIVED : Short = 2 + val LOADING : Short = 3 + val DONE : Short = 4 + } } native open class FormData(form : HTMLFormElement = noImpl) { fun append(name : String, value : Blob, filename : String = noImpl) : Unit = noImpl @@ -4900,7 +4900,7 @@ native open class ProgressEventInit : EventInit() { var loaded : dynamic = 0 var total : dynamic = 0 } -native open class Blob { +native open class Blob : ImageBitmapSource { var size : Long get() = noImpl set(value) = noImpl @@ -4967,11 +4967,11 @@ native open class FileReader : EventTarget { fun readAsText(blob : Blob, label : String = noImpl) : Unit = noImpl fun readAsDataURL(blob : Blob) : Unit = noImpl fun abort() : Unit = noImpl -companion object { - val EMPTY : Short = 0 - val LOADING : Short = 1 - val DONE : Short = 2 -} + companion object { + val EMPTY : Short = 0 + val LOADING : Short = 1 + val DONE : Short = 2 + } } native open class FileReaderSync { fun readAsArrayBuffer(blob : Blob) : dynamic = noImpl @@ -5395,16 +5395,16 @@ native trait CSSRule { var parentStyleSheet : CSSStyleSheet? get() = noImpl set(value) = noImpl -companion object { - val STYLE_RULE : Short = 1 - val CHARSET_RULE : Short = 2 - val IMPORT_RULE : Short = 3 - val MEDIA_RULE : Short = 4 - val FONT_FACE_RULE : Short = 5 - val PAGE_RULE : Short = 6 - val MARGIN_RULE : Short = 9 - val NAMESPACE_RULE : Short = 10 -} + companion object { + val STYLE_RULE : Short = 1 + val CHARSET_RULE : Short = 2 + val IMPORT_RULE : Short = 3 + val MEDIA_RULE : Short = 4 + val FONT_FACE_RULE : Short = 5 + val PAGE_RULE : Short = 6 + val MARGIN_RULE : Short = 9 + val NAMESPACE_RULE : Short = 10 + } } native trait CSSStyleRule : CSSRule { var selectorText : String @@ -5505,7 +5505,533 @@ native trait PseudoElement { } native trait CSS { } +native open class WebGLContextAttributes { + var alpha : dynamic = true + var depth : dynamic = true + var stencil : dynamic = false + var antialias : dynamic = true + var premultipliedAlpha : dynamic = true + var preserveDrawingBuffer : dynamic = false + var preferLowPowerToHighPerformance : dynamic = false + var failIfMajorPerformanceCaveat : dynamic = false +} +native trait WebGLObject { +} +native trait WebGLBuffer : WebGLObject { +} +native trait WebGLFramebuffer : WebGLObject { +} +native trait WebGLProgram : WebGLObject { +} +native trait WebGLRenderbuffer : WebGLObject { +} +native trait WebGLShader : WebGLObject { +} +native trait WebGLTexture : WebGLObject { +} +native trait WebGLUniformLocation { +} +native trait WebGLActiveInfo { + var size : Int + get() = noImpl + set(value) = noImpl + var type : Int + get() = noImpl + set(value) = noImpl + var name : String + get() = noImpl + set(value) = noImpl +} +native trait WebGLShaderPrecisionFormat { + var rangeMin : Int + get() = noImpl + set(value) = noImpl + var rangeMax : Int + get() = noImpl + set(value) = noImpl + var precision : Int + get() = noImpl + set(value) = noImpl +} +native trait WebGLRenderingContext : RenderingContext { + var canvas : HTMLCanvasElement + get() = noImpl + set(value) = noImpl + var drawingBufferWidth : Int + get() = noImpl + set(value) = noImpl + var drawingBufferHeight : Int + get() = noImpl + set(value) = noImpl + fun getContextAttributes() : WebGLContextAttributes? = noImpl + fun isContextLost() : Boolean = noImpl + fun getSupportedExtensions() : Any? = noImpl + fun getExtension(name : String) : dynamic = noImpl + fun activeTexture(texture : Int) : Unit = noImpl + fun attachShader(program : WebGLProgram?, shader : WebGLShader?) : Unit = noImpl + fun bindAttribLocation(program : WebGLProgram?, index : Int, name : String) : Unit = noImpl + fun bindBuffer(target : Int, buffer : WebGLBuffer?) : Unit = noImpl + fun bindFramebuffer(target : Int, framebuffer : WebGLFramebuffer?) : Unit = noImpl + fun bindRenderbuffer(target : Int, renderbuffer : WebGLRenderbuffer?) : Unit = noImpl + fun bindTexture(target : Int, texture : WebGLTexture?) : Unit = noImpl + fun blendColor(red : dynamic, green : dynamic, blue : dynamic, alpha : dynamic) : Unit = noImpl + fun blendEquation(mode : Int) : Unit = noImpl + fun blendEquationSeparate(modeRGB : Int, modeAlpha : Int) : Unit = noImpl + fun blendFunc(sfactor : Int, dfactor : Int) : Unit = noImpl + fun blendFuncSeparate(srcRGB : Int, dstRGB : Int, srcAlpha : Int, dstAlpha : Int) : Unit = noImpl + fun bufferData(target : Int, size : Long, usage : Int) : Unit = noImpl + fun bufferData(target : Int, data : dynamic, usage : Int) : Unit = noImpl + fun bufferSubData(target : Int, offset : Long, data : dynamic) : Unit = noImpl + fun checkFramebufferStatus(target : Int) : Int = noImpl + fun clear(mask : Int) : Unit = noImpl + fun clearColor(red : dynamic, green : dynamic, blue : dynamic, alpha : dynamic) : Unit = noImpl + fun clearDepth(depth : dynamic) : Unit = noImpl + fun clearStencil(s : Int) : Unit = noImpl + fun colorMask(red : Boolean, green : Boolean, blue : Boolean, alpha : Boolean) : Unit = noImpl + fun compileShader(shader : WebGLShader?) : Unit = noImpl + fun compressedTexImage2D(target : Int, level : Int, internalformat : Int, width : Int, height : Int, border : Int, data : dynamic) : Unit = noImpl + fun compressedTexSubImage2D(target : Int, level : Int, xoffset : Int, yoffset : Int, width : Int, height : Int, format : Int, data : dynamic) : Unit = noImpl + fun copyTexImage2D(target : Int, level : Int, internalformat : Int, x : Int, y : Int, width : Int, height : Int, border : Int) : Unit = noImpl + fun copyTexSubImage2D(target : Int, level : Int, xoffset : Int, yoffset : Int, x : Int, y : Int, width : Int, height : Int) : Unit = noImpl + fun createBuffer() : WebGLBuffer? = noImpl + fun createFramebuffer() : WebGLFramebuffer? = noImpl + fun createProgram() : WebGLProgram? = noImpl + fun createRenderbuffer() : WebGLRenderbuffer? = noImpl + fun createShader(type : Int) : WebGLShader? = noImpl + fun createTexture() : WebGLTexture? = noImpl + fun cullFace(mode : Int) : Unit = noImpl + fun deleteBuffer(buffer : WebGLBuffer?) : Unit = noImpl + fun deleteFramebuffer(framebuffer : WebGLFramebuffer?) : Unit = noImpl + fun deleteProgram(program : WebGLProgram?) : Unit = noImpl + fun deleteRenderbuffer(renderbuffer : WebGLRenderbuffer?) : Unit = noImpl + fun deleteShader(shader : WebGLShader?) : Unit = noImpl + fun deleteTexture(texture : WebGLTexture?) : Unit = noImpl + fun depthFunc(func : Int) : Unit = noImpl + fun depthMask(flag : Boolean) : Unit = noImpl + fun depthRange(zNear : dynamic, zFar : dynamic) : Unit = noImpl + fun detachShader(program : WebGLProgram?, shader : WebGLShader?) : Unit = noImpl + fun disable(cap : Int) : Unit = noImpl + fun disableVertexAttribArray(index : Int) : Unit = noImpl + fun drawArrays(mode : Int, first : Int, count : Int) : Unit = noImpl + fun drawElements(mode : Int, count : Int, type : Int, offset : Long) : Unit = noImpl + fun enable(cap : Int) : Unit = noImpl + fun enableVertexAttribArray(index : Int) : Unit = noImpl + fun finish() : Unit = noImpl + fun flush() : Unit = noImpl + fun framebufferRenderbuffer(target : Int, attachment : Int, renderbuffertarget : Int, renderbuffer : WebGLRenderbuffer?) : Unit = noImpl + fun framebufferTexture2D(target : Int, attachment : Int, textarget : Int, texture : WebGLTexture?, level : Int) : Unit = noImpl + fun frontFace(mode : Int) : Unit = noImpl + fun generateMipmap(target : Int) : Unit = noImpl + fun getActiveAttrib(program : WebGLProgram?, index : Int) : WebGLActiveInfo? = noImpl + fun getActiveUniform(program : WebGLProgram?, index : Int) : WebGLActiveInfo? = noImpl + fun getAttachedShaders(program : WebGLProgram?) : Any? = noImpl + fun getAttribLocation(program : WebGLProgram?, name : String) : Int = noImpl + fun getBufferParameter(target : Int, pname : Int) : Any = noImpl + fun getParameter(pname : Int) : Any = noImpl + fun getError() : Int = noImpl + fun getFramebufferAttachmentParameter(target : Int, attachment : Int, pname : Int) : Any = noImpl + fun getProgramParameter(program : WebGLProgram?, pname : Int) : Any = noImpl + fun getProgramInfoLog(program : WebGLProgram?) : String? = noImpl + fun getRenderbufferParameter(target : Int, pname : Int) : Any = noImpl + fun getShaderParameter(shader : WebGLShader?, pname : Int) : Any = noImpl + fun getShaderPrecisionFormat(shadertype : Int, precisiontype : Int) : WebGLShaderPrecisionFormat? = noImpl + fun getShaderInfoLog(shader : WebGLShader?) : String? = noImpl + fun getShaderSource(shader : WebGLShader?) : String? = noImpl + fun getTexParameter(target : Int, pname : Int) : Any = noImpl + fun getUniform(program : WebGLProgram?, location : WebGLUniformLocation?) : Any = noImpl + fun getUniformLocation(program : WebGLProgram?, name : String) : WebGLUniformLocation? = noImpl + fun getVertexAttrib(index : Int, pname : Int) : Any = noImpl + fun getVertexAttribOffset(index : Int, pname : Int) : Long = noImpl + fun hint(target : Int, mode : Int) : Unit = noImpl + fun isBuffer(buffer : WebGLBuffer?) : Boolean = noImpl + fun isEnabled(cap : Int) : Boolean = noImpl + fun isFramebuffer(framebuffer : WebGLFramebuffer?) : Boolean = noImpl + fun isProgram(program : WebGLProgram?) : Boolean = noImpl + fun isRenderbuffer(renderbuffer : WebGLRenderbuffer?) : Boolean = noImpl + fun isShader(shader : WebGLShader?) : Boolean = noImpl + fun isTexture(texture : WebGLTexture?) : Boolean = noImpl + fun lineWidth(width : dynamic) : Unit = noImpl + fun linkProgram(program : WebGLProgram?) : Unit = noImpl + fun pixelStorei(pname : Int, param : Int) : Unit = noImpl + fun polygonOffset(factor : dynamic, units : dynamic) : Unit = noImpl + fun readPixels(x : Int, y : Int, width : Int, height : Int, format : Int, type : Int, pixels : dynamic) : Unit = noImpl + fun renderbufferStorage(target : Int, internalformat : Int, width : Int, height : Int) : Unit = noImpl + fun sampleCoverage(value : dynamic, invert : Boolean) : Unit = noImpl + fun scissor(x : Int, y : Int, width : Int, height : Int) : Unit = noImpl + fun shaderSource(shader : WebGLShader?, source : String) : Unit = noImpl + fun stencilFunc(func : Int, ref : Int, mask : Int) : Unit = noImpl + fun stencilFuncSeparate(face : Int, func : Int, ref : Int, mask : Int) : Unit = noImpl + fun stencilMask(mask : Int) : Unit = noImpl + fun stencilMaskSeparate(face : Int, mask : Int) : Unit = noImpl + fun stencilOp(fail : Int, zfail : Int, zpass : Int) : Unit = noImpl + fun stencilOpSeparate(face : Int, fail : Int, zfail : Int, zpass : Int) : Unit = noImpl + fun texImage2D(target : Int, level : Int, internalformat : Int, width : Int, height : Int, border : Int, format : Int, type : Int, pixels : dynamic) : Unit = noImpl + fun texImage2D(target : Int, level : Int, internalformat : Int, format : Int, type : Int, source : dynamic) : Unit = noImpl + fun texParameterf(target : Int, pname : Int, param : dynamic) : Unit = noImpl + fun texParameteri(target : Int, pname : Int, param : Int) : Unit = noImpl + fun texSubImage2D(target : Int, level : Int, xoffset : Int, yoffset : Int, width : Int, height : Int, format : Int, type : Int, pixels : dynamic) : Unit = noImpl + fun texSubImage2D(target : Int, level : Int, xoffset : Int, yoffset : Int, format : Int, type : Int, source : dynamic) : Unit = noImpl + fun uniform1f(location : WebGLUniformLocation?, x : dynamic) : Unit = noImpl + fun uniform1fv(location : WebGLUniformLocation?, v : dynamic) : Unit = noImpl + fun uniform1fv(location : WebGLUniformLocation?, v : Any) : Unit = noImpl + fun uniform1i(location : WebGLUniformLocation?, x : Int) : Unit = noImpl + fun uniform1iv(location : WebGLUniformLocation?, v : dynamic) : Unit = noImpl + fun uniform1iv(location : WebGLUniformLocation?, v : Any) : Unit = noImpl + fun uniform2f(location : WebGLUniformLocation?, x : dynamic, y : dynamic) : Unit = noImpl + fun uniform2fv(location : WebGLUniformLocation?, v : dynamic) : Unit = noImpl + fun uniform2fv(location : WebGLUniformLocation?, v : Any) : Unit = noImpl + fun uniform2i(location : WebGLUniformLocation?, x : Int, y : Int) : Unit = noImpl + fun uniform2iv(location : WebGLUniformLocation?, v : dynamic) : Unit = noImpl + fun uniform2iv(location : WebGLUniformLocation?, v : Any) : Unit = noImpl + fun uniform3f(location : WebGLUniformLocation?, x : dynamic, y : dynamic, z : dynamic) : Unit = noImpl + fun uniform3fv(location : WebGLUniformLocation?, v : dynamic) : Unit = noImpl + fun uniform3fv(location : WebGLUniformLocation?, v : Any) : Unit = noImpl + fun uniform3i(location : WebGLUniformLocation?, x : Int, y : Int, z : Int) : Unit = noImpl + fun uniform3iv(location : WebGLUniformLocation?, v : dynamic) : Unit = noImpl + fun uniform3iv(location : WebGLUniformLocation?, v : Any) : Unit = noImpl + fun uniform4f(location : WebGLUniformLocation?, x : dynamic, y : dynamic, z : dynamic, w : dynamic) : Unit = noImpl + fun uniform4fv(location : WebGLUniformLocation?, v : dynamic) : Unit = noImpl + fun uniform4fv(location : WebGLUniformLocation?, v : Any) : Unit = noImpl + fun uniform4i(location : WebGLUniformLocation?, x : Int, y : Int, z : Int, w : Int) : Unit = noImpl + fun uniform4iv(location : WebGLUniformLocation?, v : dynamic) : Unit = noImpl + fun uniform4iv(location : WebGLUniformLocation?, v : Any) : Unit = noImpl + fun uniformMatrix2fv(location : WebGLUniformLocation?, transpose : Boolean, value : dynamic) : Unit = noImpl + fun uniformMatrix2fv(location : WebGLUniformLocation?, transpose : Boolean, value : Any) : Unit = noImpl + fun uniformMatrix3fv(location : WebGLUniformLocation?, transpose : Boolean, value : dynamic) : Unit = noImpl + fun uniformMatrix3fv(location : WebGLUniformLocation?, transpose : Boolean, value : Any) : Unit = noImpl + fun uniformMatrix4fv(location : WebGLUniformLocation?, transpose : Boolean, value : dynamic) : Unit = noImpl + fun uniformMatrix4fv(location : WebGLUniformLocation?, transpose : Boolean, value : Any) : Unit = noImpl + fun useProgram(program : WebGLProgram?) : Unit = noImpl + fun validateProgram(program : WebGLProgram?) : Unit = noImpl + fun vertexAttrib1f(indx : Int, x : dynamic) : Unit = noImpl + fun vertexAttrib1fv(indx : Int, values : dynamic) : Unit = noImpl + fun vertexAttrib1fv(indx : Int, values : Any) : Unit = noImpl + fun vertexAttrib2f(indx : Int, x : dynamic, y : dynamic) : Unit = noImpl + fun vertexAttrib2fv(indx : Int, values : dynamic) : Unit = noImpl + fun vertexAttrib2fv(indx : Int, values : Any) : Unit = noImpl + fun vertexAttrib3f(indx : Int, x : dynamic, y : dynamic, z : dynamic) : Unit = noImpl + fun vertexAttrib3fv(indx : Int, values : dynamic) : Unit = noImpl + fun vertexAttrib3fv(indx : Int, values : Any) : Unit = noImpl + fun vertexAttrib4f(indx : Int, x : dynamic, y : dynamic, z : dynamic, w : dynamic) : Unit = noImpl + fun vertexAttrib4fv(indx : Int, values : dynamic) : Unit = noImpl + fun vertexAttrib4fv(indx : Int, values : Any) : Unit = noImpl + fun vertexAttribPointer(indx : Int, size : Int, type : Int, normalized : Boolean, stride : Int, offset : Long) : Unit = noImpl + fun viewport(x : Int, y : Int, width : Int, height : Int) : Unit = noImpl + companion object { + val DEPTH_BUFFER_BIT : Int = 0x00000100 + val STENCIL_BUFFER_BIT : Int = 0x00000400 + val COLOR_BUFFER_BIT : Int = 0x00004000 + val POINTS : Int = 0x0000 + val LINES : Int = 0x0001 + val LINE_LOOP : Int = 0x0002 + val LINE_STRIP : Int = 0x0003 + val TRIANGLES : Int = 0x0004 + val TRIANGLE_STRIP : Int = 0x0005 + val TRIANGLE_FAN : Int = 0x0006 + val ZERO : Int = 0 + val ONE : Int = 1 + val SRC_COLOR : Int = 0x0300 + val ONE_MINUS_SRC_COLOR : Int = 0x0301 + val SRC_ALPHA : Int = 0x0302 + val ONE_MINUS_SRC_ALPHA : Int = 0x0303 + val DST_ALPHA : Int = 0x0304 + val ONE_MINUS_DST_ALPHA : Int = 0x0305 + val DST_COLOR : Int = 0x0306 + val ONE_MINUS_DST_COLOR : Int = 0x0307 + val SRC_ALPHA_SATURATE : Int = 0x0308 + val FUNC_ADD : Int = 0x8006 + val BLEND_EQUATION : Int = 0x8009 + val BLEND_EQUATION_RGB : Int = 0x8009 + val BLEND_EQUATION_ALPHA : Int = 0x883D + val FUNC_SUBTRACT : Int = 0x800A + val FUNC_REVERSE_SUBTRACT : Int = 0x800B + val BLEND_DST_RGB : Int = 0x80C8 + val BLEND_SRC_RGB : Int = 0x80C9 + val BLEND_DST_ALPHA : Int = 0x80CA + val BLEND_SRC_ALPHA : Int = 0x80CB + val CONSTANT_COLOR : Int = 0x8001 + val ONE_MINUS_CONSTANT_COLOR : Int = 0x8002 + val CONSTANT_ALPHA : Int = 0x8003 + val ONE_MINUS_CONSTANT_ALPHA : Int = 0x8004 + val BLEND_COLOR : Int = 0x8005 + val ARRAY_BUFFER : Int = 0x8892 + val ELEMENT_ARRAY_BUFFER : Int = 0x8893 + val ARRAY_BUFFER_BINDING : Int = 0x8894 + val ELEMENT_ARRAY_BUFFER_BINDING : Int = 0x8895 + val STREAM_DRAW : Int = 0x88E0 + val STATIC_DRAW : Int = 0x88E4 + val DYNAMIC_DRAW : Int = 0x88E8 + val BUFFER_SIZE : Int = 0x8764 + val BUFFER_USAGE : Int = 0x8765 + val CURRENT_VERTEX_ATTRIB : Int = 0x8626 + val FRONT : Int = 0x0404 + val BACK : Int = 0x0405 + val FRONT_AND_BACK : Int = 0x0408 + val CULL_FACE : Int = 0x0B44 + val BLEND : Int = 0x0BE2 + val DITHER : Int = 0x0BD0 + val STENCIL_TEST : Int = 0x0B90 + val DEPTH_TEST : Int = 0x0B71 + val SCISSOR_TEST : Int = 0x0C11 + val POLYGON_OFFSET_FILL : Int = 0x8037 + val SAMPLE_ALPHA_TO_COVERAGE : Int = 0x809E + val SAMPLE_COVERAGE : Int = 0x80A0 + val NO_ERROR : Int = 0 + val INVALID_ENUM : Int = 0x0500 + val INVALID_VALUE : Int = 0x0501 + val INVALID_OPERATION : Int = 0x0502 + val OUT_OF_MEMORY : Int = 0x0505 + val CW : Int = 0x0900 + val CCW : Int = 0x0901 + val LINE_WIDTH : Int = 0x0B21 + val ALIASED_POINT_SIZE_RANGE : Int = 0x846D + val ALIASED_LINE_WIDTH_RANGE : Int = 0x846E + val CULL_FACE_MODE : Int = 0x0B45 + val FRONT_FACE : Int = 0x0B46 + val DEPTH_RANGE : Int = 0x0B70 + val DEPTH_WRITEMASK : Int = 0x0B72 + val DEPTH_CLEAR_VALUE : Int = 0x0B73 + val DEPTH_FUNC : Int = 0x0B74 + val STENCIL_CLEAR_VALUE : Int = 0x0B91 + val STENCIL_FUNC : Int = 0x0B92 + val STENCIL_FAIL : Int = 0x0B94 + val STENCIL_PASS_DEPTH_FAIL : Int = 0x0B95 + val STENCIL_PASS_DEPTH_PASS : Int = 0x0B96 + val STENCIL_REF : Int = 0x0B97 + val STENCIL_VALUE_MASK : Int = 0x0B93 + val STENCIL_WRITEMASK : Int = 0x0B98 + val STENCIL_BACK_FUNC : Int = 0x8800 + val STENCIL_BACK_FAIL : Int = 0x8801 + val STENCIL_BACK_PASS_DEPTH_FAIL : Int = 0x8802 + val STENCIL_BACK_PASS_DEPTH_PASS : Int = 0x8803 + val STENCIL_BACK_REF : Int = 0x8CA3 + val STENCIL_BACK_VALUE_MASK : Int = 0x8CA4 + val STENCIL_BACK_WRITEMASK : Int = 0x8CA5 + val VIEWPORT : Int = 0x0BA2 + val SCISSOR_BOX : Int = 0x0C10 + val COLOR_CLEAR_VALUE : Int = 0x0C22 + val COLOR_WRITEMASK : Int = 0x0C23 + val UNPACK_ALIGNMENT : Int = 0x0CF5 + val PACK_ALIGNMENT : Int = 0x0D05 + val MAX_TEXTURE_SIZE : Int = 0x0D33 + val MAX_VIEWPORT_DIMS : Int = 0x0D3A + val SUBPIXEL_BITS : Int = 0x0D50 + val RED_BITS : Int = 0x0D52 + val GREEN_BITS : Int = 0x0D53 + val BLUE_BITS : Int = 0x0D54 + val ALPHA_BITS : Int = 0x0D55 + val DEPTH_BITS : Int = 0x0D56 + val STENCIL_BITS : Int = 0x0D57 + val POLYGON_OFFSET_UNITS : Int = 0x2A00 + val POLYGON_OFFSET_FACTOR : Int = 0x8038 + val TEXTURE_BINDING_2D : Int = 0x8069 + val SAMPLE_BUFFERS : Int = 0x80A8 + val SAMPLES : Int = 0x80A9 + val SAMPLE_COVERAGE_VALUE : Int = 0x80AA + val SAMPLE_COVERAGE_INVERT : Int = 0x80AB + val COMPRESSED_TEXTURE_FORMATS : Int = 0x86A3 + val DONT_CARE : Int = 0x1100 + val FASTEST : Int = 0x1101 + val NICEST : Int = 0x1102 + val GENERATE_MIPMAP_HINT : Int = 0x8192 + val BYTE : Int = 0x1400 + val UNSIGNED_BYTE : Int = 0x1401 + val SHORT : Int = 0x1402 + val UNSIGNED_SHORT : Int = 0x1403 + val INT : Int = 0x1404 + val UNSIGNED_INT : Int = 0x1405 + val FLOAT : Int = 0x1406 + val DEPTH_COMPONENT : Int = 0x1902 + val ALPHA : Int = 0x1906 + val RGB : Int = 0x1907 + val RGBA : Int = 0x1908 + val LUMINANCE : Int = 0x1909 + val LUMINANCE_ALPHA : Int = 0x190A + val UNSIGNED_SHORT_4_4_4_4 : Int = 0x8033 + val UNSIGNED_SHORT_5_5_5_1 : Int = 0x8034 + val UNSIGNED_SHORT_5_6_5 : Int = 0x8363 + val FRAGMENT_SHADER : Int = 0x8B30 + val VERTEX_SHADER : Int = 0x8B31 + val MAX_VERTEX_ATTRIBS : Int = 0x8869 + val MAX_VERTEX_UNIFORM_VECTORS : Int = 0x8DFB + val MAX_VARYING_VECTORS : Int = 0x8DFC + val MAX_COMBINED_TEXTURE_IMAGE_UNITS : Int = 0x8B4D + val MAX_VERTEX_TEXTURE_IMAGE_UNITS : Int = 0x8B4C + val MAX_TEXTURE_IMAGE_UNITS : Int = 0x8872 + val MAX_FRAGMENT_UNIFORM_VECTORS : Int = 0x8DFD + val SHADER_TYPE : Int = 0x8B4F + val DELETE_STATUS : Int = 0x8B80 + val LINK_STATUS : Int = 0x8B82 + val VALIDATE_STATUS : Int = 0x8B83 + val ATTACHED_SHADERS : Int = 0x8B85 + val ACTIVE_UNIFORMS : Int = 0x8B86 + val ACTIVE_ATTRIBUTES : Int = 0x8B89 + val SHADING_LANGUAGE_VERSION : Int = 0x8B8C + val CURRENT_PROGRAM : Int = 0x8B8D + val NEVER : Int = 0x0200 + val LESS : Int = 0x0201 + val EQUAL : Int = 0x0202 + val LEQUAL : Int = 0x0203 + val GREATER : Int = 0x0204 + val NOTEQUAL : Int = 0x0205 + val GEQUAL : Int = 0x0206 + val ALWAYS : Int = 0x0207 + val KEEP : Int = 0x1E00 + val REPLACE : Int = 0x1E01 + val INCR : Int = 0x1E02 + val DECR : Int = 0x1E03 + val INVERT : Int = 0x150A + val INCR_WRAP : Int = 0x8507 + val DECR_WRAP : Int = 0x8508 + val VENDOR : Int = 0x1F00 + val RENDERER : Int = 0x1F01 + val VERSION : Int = 0x1F02 + val NEAREST : Int = 0x2600 + val LINEAR : Int = 0x2601 + val NEAREST_MIPMAP_NEAREST : Int = 0x2700 + val LINEAR_MIPMAP_NEAREST : Int = 0x2701 + val NEAREST_MIPMAP_LINEAR : Int = 0x2702 + val LINEAR_MIPMAP_LINEAR : Int = 0x2703 + val TEXTURE_MAG_FILTER : Int = 0x2800 + val TEXTURE_MIN_FILTER : Int = 0x2801 + val TEXTURE_WRAP_S : Int = 0x2802 + val TEXTURE_WRAP_T : Int = 0x2803 + val TEXTURE_2D : Int = 0x0DE1 + val TEXTURE : Int = 0x1702 + val TEXTURE_CUBE_MAP : Int = 0x8513 + val TEXTURE_BINDING_CUBE_MAP : Int = 0x8514 + val TEXTURE_CUBE_MAP_POSITIVE_X : Int = 0x8515 + val TEXTURE_CUBE_MAP_NEGATIVE_X : Int = 0x8516 + val TEXTURE_CUBE_MAP_POSITIVE_Y : Int = 0x8517 + val TEXTURE_CUBE_MAP_NEGATIVE_Y : Int = 0x8518 + val TEXTURE_CUBE_MAP_POSITIVE_Z : Int = 0x8519 + val TEXTURE_CUBE_MAP_NEGATIVE_Z : Int = 0x851A + val MAX_CUBE_MAP_TEXTURE_SIZE : Int = 0x851C + val TEXTURE0 : Int = 0x84C0 + val TEXTURE1 : Int = 0x84C1 + val TEXTURE2 : Int = 0x84C2 + val TEXTURE3 : Int = 0x84C3 + val TEXTURE4 : Int = 0x84C4 + val TEXTURE5 : Int = 0x84C5 + val TEXTURE6 : Int = 0x84C6 + val TEXTURE7 : Int = 0x84C7 + val TEXTURE8 : Int = 0x84C8 + val TEXTURE9 : Int = 0x84C9 + val TEXTURE10 : Int = 0x84CA + val TEXTURE11 : Int = 0x84CB + val TEXTURE12 : Int = 0x84CC + val TEXTURE13 : Int = 0x84CD + val TEXTURE14 : Int = 0x84CE + val TEXTURE15 : Int = 0x84CF + val TEXTURE16 : Int = 0x84D0 + val TEXTURE17 : Int = 0x84D1 + val TEXTURE18 : Int = 0x84D2 + val TEXTURE19 : Int = 0x84D3 + val TEXTURE20 : Int = 0x84D4 + val TEXTURE21 : Int = 0x84D5 + val TEXTURE22 : Int = 0x84D6 + val TEXTURE23 : Int = 0x84D7 + val TEXTURE24 : Int = 0x84D8 + val TEXTURE25 : Int = 0x84D9 + val TEXTURE26 : Int = 0x84DA + val TEXTURE27 : Int = 0x84DB + val TEXTURE28 : Int = 0x84DC + val TEXTURE29 : Int = 0x84DD + val TEXTURE30 : Int = 0x84DE + val TEXTURE31 : Int = 0x84DF + val ACTIVE_TEXTURE : Int = 0x84E0 + val REPEAT : Int = 0x2901 + val CLAMP_TO_EDGE : Int = 0x812F + val MIRRORED_REPEAT : Int = 0x8370 + val FLOAT_VEC2 : Int = 0x8B50 + val FLOAT_VEC3 : Int = 0x8B51 + val FLOAT_VEC4 : Int = 0x8B52 + val INT_VEC2 : Int = 0x8B53 + val INT_VEC3 : Int = 0x8B54 + val INT_VEC4 : Int = 0x8B55 + val BOOL : Int = 0x8B56 + val BOOL_VEC2 : Int = 0x8B57 + val BOOL_VEC3 : Int = 0x8B58 + val BOOL_VEC4 : Int = 0x8B59 + val FLOAT_MAT2 : Int = 0x8B5A + val FLOAT_MAT3 : Int = 0x8B5B + val FLOAT_MAT4 : Int = 0x8B5C + val SAMPLER_2D : Int = 0x8B5E + val SAMPLER_CUBE : Int = 0x8B60 + val VERTEX_ATTRIB_ARRAY_ENABLED : Int = 0x8622 + val VERTEX_ATTRIB_ARRAY_SIZE : Int = 0x8623 + val VERTEX_ATTRIB_ARRAY_STRIDE : Int = 0x8624 + val VERTEX_ATTRIB_ARRAY_TYPE : Int = 0x8625 + val VERTEX_ATTRIB_ARRAY_NORMALIZED : Int = 0x886A + val VERTEX_ATTRIB_ARRAY_POINTER : Int = 0x8645 + val VERTEX_ATTRIB_ARRAY_BUFFER_BINDING : Int = 0x889F + val IMPLEMENTATION_COLOR_READ_TYPE : Int = 0x8B9A + val IMPLEMENTATION_COLOR_READ_FORMAT : Int = 0x8B9B + val COMPILE_STATUS : Int = 0x8B81 + val LOW_FLOAT : Int = 0x8DF0 + val MEDIUM_FLOAT : Int = 0x8DF1 + val HIGH_FLOAT : Int = 0x8DF2 + val LOW_INT : Int = 0x8DF3 + val MEDIUM_INT : Int = 0x8DF4 + val HIGH_INT : Int = 0x8DF5 + val FRAMEBUFFER : Int = 0x8D40 + val RENDERBUFFER : Int = 0x8D41 + val RGBA4 : Int = 0x8056 + val RGB5_A1 : Int = 0x8057 + val RGB565 : Int = 0x8D62 + val DEPTH_COMPONENT16 : Int = 0x81A5 + val STENCIL_INDEX : Int = 0x1901 + val STENCIL_INDEX8 : Int = 0x8D48 + val DEPTH_STENCIL : Int = 0x84F9 + val RENDERBUFFER_WIDTH : Int = 0x8D42 + val RENDERBUFFER_HEIGHT : Int = 0x8D43 + val RENDERBUFFER_INTERNAL_FORMAT : Int = 0x8D44 + val RENDERBUFFER_RED_SIZE : Int = 0x8D50 + val RENDERBUFFER_GREEN_SIZE : Int = 0x8D51 + val RENDERBUFFER_BLUE_SIZE : Int = 0x8D52 + val RENDERBUFFER_ALPHA_SIZE : Int = 0x8D53 + val RENDERBUFFER_DEPTH_SIZE : Int = 0x8D54 + val RENDERBUFFER_STENCIL_SIZE : Int = 0x8D55 + val FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE : Int = 0x8CD0 + val FRAMEBUFFER_ATTACHMENT_OBJECT_NAME : Int = 0x8CD1 + val FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL : Int = 0x8CD2 + val FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE : Int = 0x8CD3 + val COLOR_ATTACHMENT0 : Int = 0x8CE0 + val DEPTH_ATTACHMENT : Int = 0x8D00 + val STENCIL_ATTACHMENT : Int = 0x8D20 + val DEPTH_STENCIL_ATTACHMENT : Int = 0x821A + val NONE : Int = 0 + val FRAMEBUFFER_COMPLETE : Int = 0x8CD5 + val FRAMEBUFFER_INCOMPLETE_ATTACHMENT : Int = 0x8CD6 + val FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT : Int = 0x8CD7 + val FRAMEBUFFER_INCOMPLETE_DIMENSIONS : Int = 0x8CD9 + val FRAMEBUFFER_UNSUPPORTED : Int = 0x8CDD + val FRAMEBUFFER_BINDING : Int = 0x8CA6 + val RENDERBUFFER_BINDING : Int = 0x8CA7 + val MAX_RENDERBUFFER_SIZE : Int = 0x84E8 + val INVALID_FRAMEBUFFER_OPERATION : Int = 0x0506 + val UNPACK_FLIP_Y_WEBGL : Int = 0x9240 + val UNPACK_PREMULTIPLY_ALPHA_WEBGL : Int = 0x9241 + val CONTEXT_LOST_WEBGL : Int = 0x9242 + val UNPACK_COLORSPACE_CONVERSION_WEBGL : Int = 0x9243 + val BROWSER_DEFAULT_WEBGL : Int = 0x9244 + } +} +native open class WebGLContextEvent(type : String, eventInit : WebGLContextEventInit = noImpl) : Event(type, noImpl) { + var statusMessage : String + get() = noImpl + set(value) = noImpl +} +native open class WebGLContextEventInit : EventInit() { + var statusMessage : dynamic +} native marker trait UnionHTMLOptGroupElementOrHTMLOptionElement { } native marker trait UnionElementOrMouseEvent { } +native marker trait RenderingContext { +} +native marker trait CanvasImageSource { +} +native marker trait ImageBitmapSource { +} diff --git a/libraries/tools/idl2k/src/main/antlr4/org/antlr/webidl/WebIDL.g4 b/libraries/tools/idl2k/src/main/antlr4/org/antlr/webidl/WebIDL.g4 index d3e4b1e0f11..3ea1a61afd4 100644 --- a/libraries/tools/idl2k/src/main/antlr4/org/antlr/webidl/WebIDL.g4 +++ b/libraries/tools/idl2k/src/main/antlr4/org/antlr/webidl/WebIDL.g4 @@ -103,6 +103,7 @@ interfaceMember | readWriteAttribute | readWriteMaplike | readWriteSetlike + | typedef ; dictionary diff --git a/libraries/tools/idl2k/src/main/kotlin/gen.kt b/libraries/tools/idl2k/src/main/kotlin/gen.kt index 7463e6ebfbd..c814435ddd8 100644 --- a/libraries/tools/idl2k/src/main/kotlin/gen.kt +++ b/libraries/tools/idl2k/src/main/kotlin/gen.kt @@ -61,7 +61,11 @@ private fun handleSpecialTypes(repository: Repository, type: String): String { } else if (type.startsWith("sequence")) { return "Any" // TODO how do we handle sequences? } else if (type in repository.typeDefs) { - return "dynamic" + val typedef = repository.typeDefs[type]!! + + return if (!typedef.types.startsWith("Union<")) mapType(repository, typedef.types) + else if (splitUnionType(typedef.types).size() == 1) mapType(repository, splitUnionType(typedef.types).first()) + else typedef.name } else if (type in repository.enums) { return "String" } else if (type.endsWith("Callback")) { diff --git a/libraries/tools/idl2k/src/main/kotlin/gen2.kt b/libraries/tools/idl2k/src/main/kotlin/gen2.kt index c733c336247..f7b055168b7 100644 --- a/libraries/tools/idl2k/src/main/kotlin/gen2.kt +++ b/libraries/tools/idl2k/src/main/kotlin/gen2.kt @@ -89,7 +89,7 @@ fun generateTrait(repository: Repository, iface: InterfaceDefinition): GenerateT return GenerateTraitOrClass(iface.name, entityType, iface.superTypes, memberAttributes = (iface.mapAttributes(repository) + extensions.flatMap { it.mapAttributes(repository) }).distinct().toList(), memberFunctions = (iface.mapOperations(repository) + extensions.flatMap { it.mapOperations(repository) }).distinct().toList(), - constnats = iface.constants.map {it.mapConstant(repository)}, + constnats = (iface.constants.map {it.mapConstant(repository)} + extensions.flatMap { it.constants.map {it.mapConstant(repository)} }.distinct().toList()), constructor = constructorFunction, superConstructorCalls = constructorSuperCalls ) @@ -124,23 +124,31 @@ private fun collectUnionTypes(allTypes: Map) = .toSet() .map { UnionType(it) } -fun generateUnionTypeTraits(allUnionTypes : Iterable): List = - allUnionTypes.map { GenerateTraitOrClass( - name = it.name, - type = GenerateDefinitionType.TRAIT, - superTypes = emptyList(), - memberAttributes = emptyList(), - memberFunctions = emptyList(), - constnats = emptyList(), - constructor = null, - superConstructorCalls = emptyList() - ) } +fun mapUnionType(it : UnionType) = GenerateTraitOrClass( + name = it.name, + type = GenerateDefinitionType.TRAIT, + superTypes = emptyList(), + memberAttributes = emptyList(), + memberFunctions = emptyList(), + constnats = emptyList(), + constructor = null, + superConstructorCalls = emptyList() +) + +fun generateUnionTypeTraits(allUnionTypes : Iterable): List = allUnionTypes.map(::mapUnionType) fun mapDefinitions(repository: Repository, definitions: Iterable) = definitions.filter { "NoInterfaceObject" !in it.extendedAttributes.map { it.call } }.map { generateTrait(repository, it) } -private fun O.renderAttributeDeclaration(allTypes: Set, arg: GenerateAttribute, override: Boolean) { - append(" ") + +private fun O.indent(level : Int) { + for (i in 1..level) { + append(" ") + } +} + +private fun O.renderAttributeDeclaration(allTypes: Set, arg: GenerateAttribute, override: Boolean, level : Int = 1) { + indent(level) if (override) { append("override ") @@ -158,10 +166,12 @@ private fun O.renderAttributeDeclaration(allTypes: Set, appendln() if (arg.getterNoImpl) { - appendln(" get() = noImpl") + indent(level + 1) + appendln("get() = noImpl") } if (arg.setterNoImpl) { - appendln(" set(value) = noImpl") + indent(level + 1) + appendln("set(value) = noImpl") } } @@ -189,7 +199,7 @@ private fun O.renderArgumentsDeclaration(allTypes: Set, private fun renderCall(call: GenerateFunctionCall) = "${call.name}(${call.arguments.join(", ")})" private fun O.renderFunction(allTypes: Set, f: GenerateFunction, override: Boolean) { - append(" ") + indent(1) when (f.native) { NativeGetterOrSetter.GETTER -> append("nativeGetter ") @@ -205,7 +215,7 @@ private fun O.renderFunction(allTypes: Set, f: Generate appendln(") : ${f.returnType.mapUnknownType(allTypes)} = noImpl") } -fun O.render(allTypes: Map, classesToUnions : Map>, iface: GenerateTraitOrClass, markerAnnotation : Boolean = false) { +fun O.render(allTypes: Map, classesToUnions : Map>, iface: GenerateTraitOrClass, markerAnnotation : Boolean = false) { val superTypes = iface.allSuperTypes(allTypes).filter { it.name != "" } val superTypesNames = superTypes.map { it.name }.toSet() @@ -229,7 +239,7 @@ fun O.render(allTypes: Map, class val superTypesWithCalls = iface.superConstructorCalls.filter { it.name in superTypesNames }.map { renderCall(it) } + iface.superTypes.filter { it !in superCalls && it in superTypesNames } + - (classesToUnions[iface.name]?.map {it.name} ?: emptyList()) + (classesToUnions[iface.name] ?: emptyList()) if (superTypesWithCalls.isNotEmpty()) { superTypesWithCalls.joinTo(this, ", ", " : ") @@ -248,28 +258,41 @@ fun O.render(allTypes: Map, class renderFunction(allTypes.keySet(), it, it.proto in superProtos) } if (iface.constnats.isNotEmpty()) { + indent(1) appendln("companion object {") iface.constnats.forEach { - renderAttributeDeclaration(allTypes.keySet(), it, false) + renderAttributeDeclaration(allTypes.keySet(), it, override = false, level = 2) } + indent(1) appendln("}") } appendln("}") } -fun O.render(ifaces: List) { +fun O.render(ifaces: List, typedefs : Iterable) { val all = ifaces.groupBy { it.name }.mapValues { it.getValue().single() } val unionTypes = collectUnionTypes(all) val unionTypeTraits = generateUnionTypeTraits(unionTypes) val allUnions = unionTypeTraits.groupBy { it.name }.mapValues { it.getValue().single() } - val classesToUnions = unionTypes.flatMap { unionType -> unionType.types.map { it to unionType } }.groupBy { it.first }.mapValues { it.getValue().map { it.second } } + val typedefsToBeGenerated = typedefs.filter {it.types.startsWith("Union<")} + .map { UnionType(splitUnionType(it.types)) to it.name } + .filter { it.first.types.all { type -> type in all} } + val typedefsClasses = typedefsToBeGenerated.groupBy { it.second }.mapValues { mapUnionType(it.value.first().first).copy(name = it.key) } + val classesToUnions = unionTypes.flatMap { unionType -> unionType.types.map { it to unionType } }.groupBy { it.first }.mapValues { it.getValue().map { it.second.name} } + + typedefsToBeGenerated.flatMap { typedef -> typedef.first.types.map { it to typedef.second } }.groupBy { it.first }.mapValues { it.getValue().map {it.second} } + + val allTypes = all + allUnions + typedefsClasses ifaces.forEach { - render(all + allUnions, classesToUnions, it) + render(allTypes, classesToUnions, it) } unionTypeTraits.forEach { - render(all, emptyMap(), it, markerAnnotation = true) + render(allTypes, emptyMap(), it, markerAnnotation = true) } -} \ No newline at end of file + + typedefsClasses.values().forEach { + render(allTypes, emptyMap(), it, markerAnnotation = true) + } +} diff --git a/libraries/tools/idl2k/src/main/kotlin/htmls.kt b/libraries/tools/idl2k/src/main/kotlin/htmls.kt index e28dcb9f459..c0ee61f0b12 100644 --- a/libraries/tools/idl2k/src/main/kotlin/htmls.kt +++ b/libraries/tools/idl2k/src/main/kotlin/htmls.kt @@ -19,7 +19,8 @@ val urls = listOf( "http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html", "https://raw.githubusercontent.com/whatwg/fetch/master/Overview.src.html", "http://www.w3.org/TR/vibration/", - "http://dev.w3.org/csswg/cssom/" + "http://dev.w3.org/csswg/cssom/", + "https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl" ) private fun extractIDLText(url: String, out: StringBuilder) { @@ -45,9 +46,11 @@ private fun extractIDLText(url: String, out: StringBuilder) { fun getAllIDLs(): String = StringBuilder { urls.forEach { - extractIDLText(it, this) + if (it.endsWith(".idl")) { + appendln(URL(it).readText()) + } else { + extractIDLText(it, this) + } } - -// appendln(constantPart) }.toString() diff --git a/libraries/tools/idl2k/src/main/kotlin/idl.kt b/libraries/tools/idl2k/src/main/kotlin/idl.kt index fbf8287c795..00422fee4ea 100644 --- a/libraries/tools/idl2k/src/main/kotlin/idl.kt +++ b/libraries/tools/idl2k/src/main/kotlin/idl.kt @@ -46,7 +46,7 @@ enum class DefinitionType { DICTIONARY } trait Definition -data class TypedefDefinition(val from : String, val to : String) : Definition +data class TypedefDefinition(val types: String, val name: String) : Definition data class InterfaceDefinition(val name : String, val extendedAttributes: List, val operations : List, val attributes : List, val superTypes : List, val constants : List, val dictionary : Boolean = false) : Definition data class ExtensionInterfaceDefinition(val name : String, val implements : String) : Definition data class EnumDefinition(val name : String) : Definition @@ -256,7 +256,7 @@ class DefinitionVisitor(val extendedAttributes: List) : WebID private val attributes = ArrayList() private var readOnly : Boolean = false private val inherited = ArrayList() - private var singleType : String? = null + private var typedefType: String? = null private var implements : String? = null private val constants = ArrayList() @@ -264,7 +264,7 @@ class DefinitionVisitor(val extendedAttributes: List) : WebID DefinitionType.INTERFACE -> InterfaceDefinition(name, extendedAttributes, operations, attributes, inherited, constants) DefinitionType.DICTIONARY -> InterfaceDefinition(name, extendedAttributes, operations, attributes, inherited, constants, true) DefinitionType.EXTENSION_INTERFACE -> ExtensionInterfaceDefinition(name, implements ?: "") - DefinitionType.TYPEDEF -> TypedefDefinition(singleType ?: "", name) + DefinitionType.TYPEDEF -> TypedefDefinition(typedefType ?: "", name) DefinitionType.ENUM -> EnumDefinition(name) } @@ -281,9 +281,23 @@ class DefinitionVisitor(val extendedAttributes: List) : WebID } override fun visitTypedef(ctx: WebIDLParser.TypedefContext): Definition { + if (name != "") { // TODO temporary workaround for local typedefs + return defaultResult() + } + type = DefinitionType.TYPEDEF name = getName(ctx) - visitChildren(ctx) + + typedefType = ctx.accept(object : WebIDLBaseVisitor() { + private var foundType = "" + + override fun defaultResult() : String = foundType + + override fun visitType(ctx: WebIDLParser.TypeContext): String { + foundType = TypeVisitor().visit(ctx) + return defaultResult() + } + }) return defaultResult() } @@ -338,11 +352,6 @@ class DefinitionVisitor(val extendedAttributes: List) : WebID return defaultResult() } - override fun visitSingleType(ctx: SingleTypeContext): Definition { - singleType = ctx.getText() - return defaultResult() - } - override fun visitOperation(ctx: OperationContext) : Definition { with(OperationVisitor(memberAttributes.toList())) { operations.add(visit(ctx)) @@ -423,7 +432,7 @@ fun parseIDL(reader : Reader) : Repository { return Repository( declarations.filterIsInstance().filter {it.name.isEmpty().not()}.groupBy { it.name }.mapValues { it.getValue().reduce(::merge) }, - declarations.filterIsInstance().groupBy { it.to }.mapValues { it.getValue().first() }, + declarations.filterIsInstance().groupBy { it.name }.mapValues { it.getValue().first() }, declarations.filterIsInstance().groupBy { it.name }.mapValues { it.getValue().map {it.implements} }, declarations.filterIsInstance().groupBy { it.name }.mapValues { it.getValue().reduce {a, b -> a} } ) diff --git a/libraries/tools/idl2k/src/main/kotlin/main.kt b/libraries/tools/idl2k/src/main/kotlin/main.kt index e46145ddca0..713017dafe6 100644 --- a/libraries/tools/idl2k/src/main/kotlin/main.kt +++ b/libraries/tools/idl2k/src/main/kotlin/main.kt @@ -11,11 +11,15 @@ fun main(args: Array) { idl.lineSequence().forEachIndexed { i, line -> println("${i.toString().padStart(4, ' ')}: ${line}") } + println() + defs.typeDefs.values().forEach { typedef -> + println(typedef) + } val definitions = mapDefinitions(defs, defs.interfaces.values()) - File("../../../js/js.libraries/src/core/dom3.kt").writer().use { w -> + File("../../../js/js.libraries/src/core/dom.kt").writer().use { w -> w.appendln("/*") w.appendln(" * Generated file") w.appendln(" * DO NOT EDIT") @@ -27,6 +31,6 @@ fun main(args: Array) { w.appendln("package org.w3c.dom") w.appendln() - w.render(definitions) + w.render(definitions, defs.typeDefs.values()) } } diff --git a/libraries/tools/idl2k/src/main/kotlin/model.kt b/libraries/tools/idl2k/src/main/kotlin/model.kt index 62cb837fb57..4c088ddf36c 100644 --- a/libraries/tools/idl2k/src/main/kotlin/model.kt +++ b/libraries/tools/idl2k/src/main/kotlin/model.kt @@ -46,7 +46,7 @@ enum class GenerateDefinitionType { data class GenerateFunction(val name: String, val returnType: String, val arguments: List, val native : NativeGetterOrSetter) data class GenerateFunctionCall(val name: String, val arguments: List) -class GenerateTraitOrClass(val name: String, +data class GenerateTraitOrClass(val name: String, val type : GenerateDefinitionType, val superTypes: List, val memberAttributes: List,