Changeset 71274 in webkit


Ignore:
Timestamp:
Nov 3, 2010 3:06:52 PM (13 years ago)
Author:
kbr@google.com
Message:

2010-11-03 Adrienne Walker <enne@google.com>

Reviewed by Kenneth Russell.

Implement lost, restored, and creation failure context events for
WebGLRenderingContext. The lost and restored functions are not hooked
up yet, but the context now acts according to the spec as it should
during a lost context. Tested manually, as there's no programmatic
way to lose a context yet.
https://bugs.webkit.org/show_bug.cgi?id=35626

  • WebCore.gypi:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSWebGLRenderingContextCustom.cpp: (WebCore::JSWebGLRenderingContext::getAttachedShaders):
  • bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: (WebCore::V8WebGLRenderingContext::getAttachedShadersCallback):
  • dom/EventNames.h:
  • html/canvas/WebGLContextEvent.cpp: Added. (WebCore::WebGLContextEvent::WebGLContextEvent): (WebCore::WebGLContextEvent::~WebGLContextEvent): (WebCore::WebGLContextEvent::initEvent):
  • html/canvas/WebGLContextEvent.h: Added. (WebCore::WebGLContextEvent::create): (WebCore::WebGLContextEvent::statusMessage):
  • html/canvas/WebGLContextEvent.idl: Added.
  • html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::create): (WebCore::WebGLRenderingContext::WebGLRenderingContext): (WebCore::WebGLRenderingContext::initializeNewContext): (WebCore::WebGLRenderingContext::activeTexture): (WebCore::WebGLRenderingContext::attachShader): (WebCore::WebGLRenderingContext::bindAttribLocation): (WebCore::WebGLRenderingContext::bindBuffer): (WebCore::WebGLRenderingContext::bindFramebuffer): (WebCore::WebGLRenderingContext::bindRenderbuffer): (WebCore::WebGLRenderingContext::bindTexture): (WebCore::WebGLRenderingContext::blendColor): (WebCore::WebGLRenderingContext::blendEquation): (WebCore::WebGLRenderingContext::blendEquationSeparate): (WebCore::WebGLRenderingContext::blendFunc): (WebCore::WebGLRenderingContext::blendFuncSeparate): (WebCore::WebGLRenderingContext::bufferData): (WebCore::WebGLRenderingContext::bufferSubData): (WebCore::WebGLRenderingContext::checkFramebufferStatus): (WebCore::WebGLRenderingContext::clear): (WebCore::WebGLRenderingContext::clearColor): (WebCore::WebGLRenderingContext::clearDepth): (WebCore::WebGLRenderingContext::clearStencil): (WebCore::WebGLRenderingContext::colorMask): (WebCore::WebGLRenderingContext::compileShader): (WebCore::WebGLRenderingContext::copyTexImage2D): (WebCore::WebGLRenderingContext::copyTexSubImage2D): (WebCore::WebGLRenderingContext::createBuffer): (WebCore::WebGLRenderingContext::createFramebuffer): (WebCore::WebGLRenderingContext::createTexture): (WebCore::WebGLRenderingContext::createProgram): (WebCore::WebGLRenderingContext::createRenderbuffer): (WebCore::WebGLRenderingContext::createShader): (WebCore::WebGLRenderingContext::cullFace): (WebCore::WebGLRenderingContext::deleteBuffer): (WebCore::WebGLRenderingContext::deleteFramebuffer): (WebCore::WebGLRenderingContext::deleteProgram): (WebCore::WebGLRenderingContext::deleteRenderbuffer): (WebCore::WebGLRenderingContext::deleteShader): (WebCore::WebGLRenderingContext::deleteTexture): (WebCore::WebGLRenderingContext::depthFunc): (WebCore::WebGLRenderingContext::depthMask): (WebCore::WebGLRenderingContext::depthRange): (WebCore::WebGLRenderingContext::detachShader): (WebCore::WebGLRenderingContext::disable): (WebCore::WebGLRenderingContext::disableVertexAttribArray): (WebCore::WebGLRenderingContext::drawArrays): (WebCore::WebGLRenderingContext::drawElements): (WebCore::WebGLRenderingContext::enable): (WebCore::WebGLRenderingContext::enableVertexAttribArray): (WebCore::WebGLRenderingContext::finish): (WebCore::WebGLRenderingContext::flush): (WebCore::WebGLRenderingContext::framebufferRenderbuffer): (WebCore::WebGLRenderingContext::framebufferTexture2D): (WebCore::WebGLRenderingContext::frontFace): (WebCore::WebGLRenderingContext::generateMipmap): (WebCore::WebGLRenderingContext::getActiveAttrib): (WebCore::WebGLRenderingContext::getActiveUniform): (WebCore::WebGLRenderingContext::getAttachedShaders): (WebCore::WebGLRenderingContext::getAttribLocation): (WebCore::WebGLRenderingContext::getBufferParameter): (WebCore::WebGLRenderingContext::getContextAttributes): (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter): (WebCore::WebGLRenderingContext::getParameter): (WebCore::WebGLRenderingContext::getProgramParameter): (WebCore::WebGLRenderingContext::getProgramInfoLog): (WebCore::WebGLRenderingContext::getRenderbufferParameter): (WebCore::WebGLRenderingContext::getShaderParameter): (WebCore::WebGLRenderingContext::getShaderInfoLog): (WebCore::WebGLRenderingContext::getShaderSource): (WebCore::WebGLRenderingContext::getTexParameter): (WebCore::WebGLRenderingContext::getUniform): (WebCore::WebGLRenderingContext::getUniformLocation): (WebCore::WebGLRenderingContext::getVertexAttrib): (WebCore::WebGLRenderingContext::getVertexAttribOffset): (WebCore::WebGLRenderingContext::hint): (WebCore::WebGLRenderingContext::isBuffer): (WebCore::WebGLRenderingContext::isContextLost): (WebCore::WebGLRenderingContext::isEnabled): (WebCore::WebGLRenderingContext::isFramebuffer): (WebCore::WebGLRenderingContext::isProgram): (WebCore::WebGLRenderingContext::isRenderbuffer): (WebCore::WebGLRenderingContext::isShader): (WebCore::WebGLRenderingContext::isTexture): (WebCore::WebGLRenderingContext::lineWidth): (WebCore::WebGLRenderingContext::linkProgram): (WebCore::WebGLRenderingContext::pixelStorei): (WebCore::WebGLRenderingContext::polygonOffset): (WebCore::WebGLRenderingContext::readPixels): (WebCore::WebGLRenderingContext::releaseShaderCompiler): (WebCore::WebGLRenderingContext::renderbufferStorage): (WebCore::WebGLRenderingContext::sampleCoverage): (WebCore::WebGLRenderingContext::scissor): (WebCore::WebGLRenderingContext::shaderSource): (WebCore::WebGLRenderingContext::stencilFunc): (WebCore::WebGLRenderingContext::stencilFuncSeparate): (WebCore::WebGLRenderingContext::stencilMask): (WebCore::WebGLRenderingContext::stencilMaskSeparate): (WebCore::WebGLRenderingContext::stencilOp): (WebCore::WebGLRenderingContext::stencilOpSeparate): (WebCore::WebGLRenderingContext::texImage2D): (WebCore::WebGLRenderingContext::texParameter): (WebCore::WebGLRenderingContext::texSubImage2DBase): (WebCore::WebGLRenderingContext::texSubImage2DImpl): (WebCore::WebGLRenderingContext::texSubImage2D): (WebCore::WebGLRenderingContext::uniform1f): (WebCore::WebGLRenderingContext::uniform1fv): (WebCore::WebGLRenderingContext::uniform1i): (WebCore::WebGLRenderingContext::uniform1iv): (WebCore::WebGLRenderingContext::uniform2f): (WebCore::WebGLRenderingContext::uniform2fv): (WebCore::WebGLRenderingContext::uniform2i): (WebCore::WebGLRenderingContext::uniform2iv): (WebCore::WebGLRenderingContext::uniform3f): (WebCore::WebGLRenderingContext::uniform3fv): (WebCore::WebGLRenderingContext::uniform3i): (WebCore::WebGLRenderingContext::uniform3iv): (WebCore::WebGLRenderingContext::uniform4f): (WebCore::WebGLRenderingContext::uniform4fv): (WebCore::WebGLRenderingContext::uniform4i): (WebCore::WebGLRenderingContext::uniform4iv): (WebCore::WebGLRenderingContext::uniformMatrix2fv): (WebCore::WebGLRenderingContext::uniformMatrix3fv): (WebCore::WebGLRenderingContext::uniformMatrix4fv): (WebCore::WebGLRenderingContext::useProgram): (WebCore::WebGLRenderingContext::validateProgram): (WebCore::WebGLRenderingContext::vertexAttribPointer): (WebCore::WebGLRenderingContext::viewport): (WebCore::WebGLRenderingContext::loseContext): (WebCore::WebGLRenderingContext::restoreContext): (WebCore::WebGLRenderingContext::addObject): (WebCore::WebGLRenderingContext::vertexAttribfImpl): (WebCore::WebGLRenderingContext::vertexAttribfvImpl):
  • html/canvas/WebGLRenderingContext.h:
  • html/canvas/WebGLRenderingContext.idl:
  • platform/graphics/GraphicsContext3D.h:
Location:
trunk/WebCore
Files:
3 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r71272 r71274  
     12010-11-03  Adrienne Walker  <enne@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Implement lost, restored, and creation failure context events for
     6        WebGLRenderingContext.  The lost and restored functions are not hooked
     7        up yet, but the context now acts according to the spec as it should
     8        during a lost context.  Tested manually, as there's no programmatic
     9        way to lose a context yet.
     10        https://bugs.webkit.org/show_bug.cgi?id=35626
     11
     12        * WebCore.gypi:
     13        * WebCore.xcodeproj/project.pbxproj:
     14        * bindings/js/JSWebGLRenderingContextCustom.cpp:
     15        (WebCore::JSWebGLRenderingContext::getAttachedShaders):
     16        * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
     17        (WebCore::V8WebGLRenderingContext::getAttachedShadersCallback):
     18        * dom/EventNames.h:
     19        * html/canvas/WebGLContextEvent.cpp: Added.
     20        (WebCore::WebGLContextEvent::WebGLContextEvent):
     21        (WebCore::WebGLContextEvent::~WebGLContextEvent):
     22        (WebCore::WebGLContextEvent::initEvent):
     23        * html/canvas/WebGLContextEvent.h: Added.
     24        (WebCore::WebGLContextEvent::create):
     25        (WebCore::WebGLContextEvent::statusMessage):
     26        * html/canvas/WebGLContextEvent.idl: Added.
     27        * html/canvas/WebGLRenderingContext.cpp:
     28        (WebCore::WebGLRenderingContext::create):
     29        (WebCore::WebGLRenderingContext::WebGLRenderingContext):
     30        (WebCore::WebGLRenderingContext::initializeNewContext):
     31        (WebCore::WebGLRenderingContext::activeTexture):
     32        (WebCore::WebGLRenderingContext::attachShader):
     33        (WebCore::WebGLRenderingContext::bindAttribLocation):
     34        (WebCore::WebGLRenderingContext::bindBuffer):
     35        (WebCore::WebGLRenderingContext::bindFramebuffer):
     36        (WebCore::WebGLRenderingContext::bindRenderbuffer):
     37        (WebCore::WebGLRenderingContext::bindTexture):
     38        (WebCore::WebGLRenderingContext::blendColor):
     39        (WebCore::WebGLRenderingContext::blendEquation):
     40        (WebCore::WebGLRenderingContext::blendEquationSeparate):
     41        (WebCore::WebGLRenderingContext::blendFunc):
     42        (WebCore::WebGLRenderingContext::blendFuncSeparate):
     43        (WebCore::WebGLRenderingContext::bufferData):
     44        (WebCore::WebGLRenderingContext::bufferSubData):
     45        (WebCore::WebGLRenderingContext::checkFramebufferStatus):
     46        (WebCore::WebGLRenderingContext::clear):
     47        (WebCore::WebGLRenderingContext::clearColor):
     48        (WebCore::WebGLRenderingContext::clearDepth):
     49        (WebCore::WebGLRenderingContext::clearStencil):
     50        (WebCore::WebGLRenderingContext::colorMask):
     51        (WebCore::WebGLRenderingContext::compileShader):
     52        (WebCore::WebGLRenderingContext::copyTexImage2D):
     53        (WebCore::WebGLRenderingContext::copyTexSubImage2D):
     54        (WebCore::WebGLRenderingContext::createBuffer):
     55        (WebCore::WebGLRenderingContext::createFramebuffer):
     56        (WebCore::WebGLRenderingContext::createTexture):
     57        (WebCore::WebGLRenderingContext::createProgram):
     58        (WebCore::WebGLRenderingContext::createRenderbuffer):
     59        (WebCore::WebGLRenderingContext::createShader):
     60        (WebCore::WebGLRenderingContext::cullFace):
     61        (WebCore::WebGLRenderingContext::deleteBuffer):
     62        (WebCore::WebGLRenderingContext::deleteFramebuffer):
     63        (WebCore::WebGLRenderingContext::deleteProgram):
     64        (WebCore::WebGLRenderingContext::deleteRenderbuffer):
     65        (WebCore::WebGLRenderingContext::deleteShader):
     66        (WebCore::WebGLRenderingContext::deleteTexture):
     67        (WebCore::WebGLRenderingContext::depthFunc):
     68        (WebCore::WebGLRenderingContext::depthMask):
     69        (WebCore::WebGLRenderingContext::depthRange):
     70        (WebCore::WebGLRenderingContext::detachShader):
     71        (WebCore::WebGLRenderingContext::disable):
     72        (WebCore::WebGLRenderingContext::disableVertexAttribArray):
     73        (WebCore::WebGLRenderingContext::drawArrays):
     74        (WebCore::WebGLRenderingContext::drawElements):
     75        (WebCore::WebGLRenderingContext::enable):
     76        (WebCore::WebGLRenderingContext::enableVertexAttribArray):
     77        (WebCore::WebGLRenderingContext::finish):
     78        (WebCore::WebGLRenderingContext::flush):
     79        (WebCore::WebGLRenderingContext::framebufferRenderbuffer):
     80        (WebCore::WebGLRenderingContext::framebufferTexture2D):
     81        (WebCore::WebGLRenderingContext::frontFace):
     82        (WebCore::WebGLRenderingContext::generateMipmap):
     83        (WebCore::WebGLRenderingContext::getActiveAttrib):
     84        (WebCore::WebGLRenderingContext::getActiveUniform):
     85        (WebCore::WebGLRenderingContext::getAttachedShaders):
     86        (WebCore::WebGLRenderingContext::getAttribLocation):
     87        (WebCore::WebGLRenderingContext::getBufferParameter):
     88        (WebCore::WebGLRenderingContext::getContextAttributes):
     89        (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
     90        (WebCore::WebGLRenderingContext::getParameter):
     91        (WebCore::WebGLRenderingContext::getProgramParameter):
     92        (WebCore::WebGLRenderingContext::getProgramInfoLog):
     93        (WebCore::WebGLRenderingContext::getRenderbufferParameter):
     94        (WebCore::WebGLRenderingContext::getShaderParameter):
     95        (WebCore::WebGLRenderingContext::getShaderInfoLog):
     96        (WebCore::WebGLRenderingContext::getShaderSource):
     97        (WebCore::WebGLRenderingContext::getTexParameter):
     98        (WebCore::WebGLRenderingContext::getUniform):
     99        (WebCore::WebGLRenderingContext::getUniformLocation):
     100        (WebCore::WebGLRenderingContext::getVertexAttrib):
     101        (WebCore::WebGLRenderingContext::getVertexAttribOffset):
     102        (WebCore::WebGLRenderingContext::hint):
     103        (WebCore::WebGLRenderingContext::isBuffer):
     104        (WebCore::WebGLRenderingContext::isContextLost):
     105        (WebCore::WebGLRenderingContext::isEnabled):
     106        (WebCore::WebGLRenderingContext::isFramebuffer):
     107        (WebCore::WebGLRenderingContext::isProgram):
     108        (WebCore::WebGLRenderingContext::isRenderbuffer):
     109        (WebCore::WebGLRenderingContext::isShader):
     110        (WebCore::WebGLRenderingContext::isTexture):
     111        (WebCore::WebGLRenderingContext::lineWidth):
     112        (WebCore::WebGLRenderingContext::linkProgram):
     113        (WebCore::WebGLRenderingContext::pixelStorei):
     114        (WebCore::WebGLRenderingContext::polygonOffset):
     115        (WebCore::WebGLRenderingContext::readPixels):
     116        (WebCore::WebGLRenderingContext::releaseShaderCompiler):
     117        (WebCore::WebGLRenderingContext::renderbufferStorage):
     118        (WebCore::WebGLRenderingContext::sampleCoverage):
     119        (WebCore::WebGLRenderingContext::scissor):
     120        (WebCore::WebGLRenderingContext::shaderSource):
     121        (WebCore::WebGLRenderingContext::stencilFunc):
     122        (WebCore::WebGLRenderingContext::stencilFuncSeparate):
     123        (WebCore::WebGLRenderingContext::stencilMask):
     124        (WebCore::WebGLRenderingContext::stencilMaskSeparate):
     125        (WebCore::WebGLRenderingContext::stencilOp):
     126        (WebCore::WebGLRenderingContext::stencilOpSeparate):
     127        (WebCore::WebGLRenderingContext::texImage2D):
     128        (WebCore::WebGLRenderingContext::texParameter):
     129        (WebCore::WebGLRenderingContext::texSubImage2DBase):
     130        (WebCore::WebGLRenderingContext::texSubImage2DImpl):
     131        (WebCore::WebGLRenderingContext::texSubImage2D):
     132        (WebCore::WebGLRenderingContext::uniform1f):
     133        (WebCore::WebGLRenderingContext::uniform1fv):
     134        (WebCore::WebGLRenderingContext::uniform1i):
     135        (WebCore::WebGLRenderingContext::uniform1iv):
     136        (WebCore::WebGLRenderingContext::uniform2f):
     137        (WebCore::WebGLRenderingContext::uniform2fv):
     138        (WebCore::WebGLRenderingContext::uniform2i):
     139        (WebCore::WebGLRenderingContext::uniform2iv):
     140        (WebCore::WebGLRenderingContext::uniform3f):
     141        (WebCore::WebGLRenderingContext::uniform3fv):
     142        (WebCore::WebGLRenderingContext::uniform3i):
     143        (WebCore::WebGLRenderingContext::uniform3iv):
     144        (WebCore::WebGLRenderingContext::uniform4f):
     145        (WebCore::WebGLRenderingContext::uniform4fv):
     146        (WebCore::WebGLRenderingContext::uniform4i):
     147        (WebCore::WebGLRenderingContext::uniform4iv):
     148        (WebCore::WebGLRenderingContext::uniformMatrix2fv):
     149        (WebCore::WebGLRenderingContext::uniformMatrix3fv):
     150        (WebCore::WebGLRenderingContext::uniformMatrix4fv):
     151        (WebCore::WebGLRenderingContext::useProgram):
     152        (WebCore::WebGLRenderingContext::validateProgram):
     153        (WebCore::WebGLRenderingContext::vertexAttribPointer):
     154        (WebCore::WebGLRenderingContext::viewport):
     155        (WebCore::WebGLRenderingContext::loseContext):
     156        (WebCore::WebGLRenderingContext::restoreContext):
     157        (WebCore::WebGLRenderingContext::addObject):
     158        (WebCore::WebGLRenderingContext::vertexAttribfImpl):
     159        (WebCore::WebGLRenderingContext::vertexAttribfvImpl):
     160        * html/canvas/WebGLRenderingContext.h:
     161        * html/canvas/WebGLRenderingContext.idl:
     162        * platform/graphics/GraphicsContext3D.h:
     163
    11642010-11-03  Kenneth Russell  <kbr@google.com>
    2165
  • trunk/WebCore/WebCore.gypi

    r71272 r71274  
    217217            'html/canvas/WebGLBuffer.idl',
    218218            'html/canvas/WebGLContextAttributes.idl',
     219            'html/canvas/WebGLContextEvent.idl',
    219220            'html/canvas/WebGLFramebuffer.idl',
    220221            'html/canvas/WebGLProgram.idl',
     
    18701871            'html/canvas/WebGLContextAttributes.cpp',
    18711872            'html/canvas/WebGLContextAttributes.h',
     1873            'html/canvas/WebGLContextEvent.cpp',
     1874            'html/canvas/WebGLContextEvent.h',
    18721875            'html/canvas/WebGLFramebuffer.cpp',
    18731876            'html/canvas/WebGLFramebuffer.h',
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r71272 r71274  
    28852885                93F19B1608245E59001E9ABC /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8216299029F4FB501000131 /* JavaScriptCore.framework */; };
    28862886                93F19B1708245E59001E9ABC /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 93F1D31A0558CC5C00821BC0 /* libicucore.dylib */; };
     2887                93F6F1ED127F70B10055CB06 /* WebGLContextEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F6F1EA127F70B10055CB06 /* WebGLContextEvent.cpp */; };
     2888                93F6F1EE127F70B10055CB06 /* WebGLContextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F6F1EB127F70B10055CB06 /* WebGLContextEvent.h */; };
    28872889                93F925430F7EF5B8007E37C9 /* CheckedRadioButtons.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F925410F7EF5B8007E37C9 /* CheckedRadioButtons.h */; settings = {ATTRIBUTES = (Private, ); }; };
    28882890                93F925440F7EF5B8007E37C9 /* CheckedRadioButtons.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F925420F7EF5B8007E37C9 /* CheckedRadioButtons.cpp */; };
     
    89698971                93F19B1A08245E5A001E9ABC /* WebCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = WebCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
    89708972                93F1D31A0558CC5C00821BC0 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = /usr/lib/libicucore.dylib; sourceTree = "<absolute>"; };
     8973                93F6F1EA127F70B10055CB06 /* WebGLContextEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLContextEvent.cpp; path = canvas/WebGLContextEvent.cpp; sourceTree = "<group>"; };
     8974                93F6F1EB127F70B10055CB06 /* WebGLContextEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLContextEvent.h; path = canvas/WebGLContextEvent.h; sourceTree = "<group>"; };
     8975                93F6F1EC127F70B10055CB06 /* WebGLContextEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLContextEvent.idl; path = canvas/WebGLContextEvent.idl; sourceTree = "<group>"; };
    89718976                93F8B3050A300FE100F61AB8 /* CodeGenerator.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = CodeGenerator.pm; path = scripts/CodeGenerator.pm; sourceTree = "<group>"; };
    89728977                93F8B3060A300FEA00F61AB8 /* CodeGeneratorJS.pm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; name = CodeGeneratorJS.pm; path = ../scripts/CodeGeneratorJS.pm; sourceTree = "<group>"; wrapsLines = 0; };
     
    1258412589                                6E4E91AA10F7FB3100A2779C /* WebGLContextAttributes.h */,
    1258512590                                6E4E91AB10F7FB3100A2779C /* WebGLContextAttributes.idl */,
     12591                                93F6F1EA127F70B10055CB06 /* WebGLContextEvent.cpp */,
     12592                                93F6F1EB127F70B10055CB06 /* WebGLContextEvent.h */,
     12593                                93F6F1EC127F70B10055CB06 /* WebGLContextEvent.idl */,
    1258612594                                49C7B9AE1042D32E0009D447 /* WebGLFramebuffer.cpp */,
    1258712595                                49C7B9AF1042D32E0009D447 /* WebGLFramebuffer.h */,
     
    2127721285                                6E67D2A71280E8A4008758F7 /* Extensions3DOpenGL.h in Headers */,
    2127821286                                6E67D2A91280E8BD008758F7 /* Extensions3D.h in Headers */,
     21287                                93F6F1EE127F70B10055CB06 /* WebGLContextEvent.h in Headers */,
    2127921288                        );
    2128021289                        runOnlyForDeploymentPostprocessing = 0;
     
    2384023849                                97DD4D860FDF4D6E00ECF9A4 /* XSSAuditor.cpp in Sources */,
    2384123850                                6E67D2A61280E8A4008758F7 /* Extensions3DOpenGL.cpp in Sources */,
     23851                                93F6F1ED127F70B10055CB06 /* WebGLContextEvent.cpp in Sources */,
    2384223852                        );
    2384323853                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp

    r70496 r71274  
    172172    WebGLProgram* program = toWebGLProgram(exec->argument(0));
    173173    if (exec->hadException())
    174         return jsUndefined();
     174        return jsNull();
    175175    Vector<WebGLShader*> shaders;
    176176    bool succeed = context->getAttachedShaders(program, shaders, ec);
    177177    if (ec) {
    178178        setDOMException(exec, ec);
    179         return jsUndefined();
     179        return jsNull();
    180180    }
    181181    if (!succeed)
    182         return jsUndefined();
     182        return jsNull();
    183183    MarkedArgumentBuffer list;
    184184    for (size_t ii = 0; ii < shaders.size(); ++ii)
  • trunk/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp

    r65689 r71274  
    237237    if (ec) {
    238238        V8Proxy::setDOMException(ec);
    239         return v8::Undefined();
     239        return v8::Null();
    240240    }
    241241    if (!succeed)
    242         return v8::Undefined();
     242        return v8::Null();
    243243    v8::Local<v8::Array> array = v8::Array::New(shaders.size());
    244244    for (size_t ii = 0; ii < shaders.size(); ++ii)
  • trunk/WebCore/dom/EventNames.h

    r69100 r71274  
    169169    macro(webkitfullscreenchange) \
    170170    \
    171     macro(webkitspeechchange)
     171    macro(webkitspeechchange) \
     172    \
     173    macro(webglcontextlost) \
     174    macro(webglcontextrestored) \
     175    macro(webglcontextcreationerror) \
    172176    \
    173177// end of DOM_EVENT_NAMES_FOR_EACH
  • trunk/WebCore/html/canvas/WebGLRenderingContext.cpp

    r71190 r71274  
    4949#include "WebGLBuffer.h"
    5050#include "WebGLContextAttributes.h"
     51#include "WebGLContextEvent.h"
    5152#include "WebGLFramebuffer.h"
    5253#include "WebGLProgram.h"
     
    9192    RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(attrs ? attrs->attributes() : emptyAttributes, hostWindow));
    9293
    93     if (!context)
     94    if (!context) {
     95        canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Could not create a WebGL context."));
    9496        return 0;
     97    }
    9598       
    9699    return new WebGLRenderingContext(canvas, context);
     
    100103    : CanvasRenderingContext(passedCanvas)
    101104    , m_context(context)
    102     , m_needsUpdate(true)
    103     , m_markedCanvasDirty(false)
    104     , m_activeTextureUnit(0)
    105105    , m_videoCache(4)
    106     , m_packAlignment(4)
    107     , m_unpackAlignment(4)
    108     , m_unpackFlipY(false)
    109     , m_unpackPremultiplyAlpha(false)
     106    , m_contextLost(false)
    110107{
    111108    ASSERT(m_context);
     109    initializeNewContext();
     110}
     111
     112void WebGLRenderingContext::initializeNewContext()
     113{
     114    m_needsUpdate = true;
     115    m_markedCanvasDirty = false;
     116    m_activeTextureUnit = 0;
     117    m_packAlignment = 4;
     118    m_unpackAlignment = 4;
     119    m_unpackFlipY = false;
     120    m_unpackPremultiplyAlpha = false;
     121    m_boundArrayBuffer = 0;
     122    m_boundElementArrayBuffer = 0;
     123    m_currentProgram = 0;
     124    m_framebufferBinding = 0;
     125    m_renderbufferBinding = 0;
     126    m_vertexAttribState.clear();
    112127
    113128    int numCombinedTextureImageUnits = 0;
    114129    m_context->getIntegerv(GraphicsContext3D::MAX_COMBINED_TEXTURE_IMAGE_UNITS, &numCombinedTextureImageUnits);
     130    m_textureUnits.clear();
    115131    m_textureUnits.resize(numCombinedTextureImageUnits);
    116132
     
    200216{
    201217    UNUSED_PARAM(ec);
     218    if (isContextLost())
     219        return;
    202220    if (texture - GraphicsContext3D::TEXTURE0 >= m_textureUnits.size()) {
    203221        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
     
    212230{
    213231    UNUSED_PARAM(ec);
    214     if (!validateWebGLObject(program) || !validateWebGLObject(shader))
     232    if (isContextLost() || !validateWebGLObject(program) || !validateWebGLObject(shader))
    215233        return;
    216234    if (!program->attachShader(shader)) {
     
    226244{
    227245    UNUSED_PARAM(ec);
    228     if (!validateWebGLObject(program))
     246    if (isContextLost() || !validateWebGLObject(program))
    229247        return;
    230248    m_context->bindAttribLocation(objectOrZero(program), index, name);
     
    235253{
    236254    UNUSED_PARAM(ec);
     255    if (isContextLost())
     256        return;
    237257    if (buffer && buffer->context() != this) {
    238258        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
     
    263283{
    264284    UNUSED_PARAM(ec);
     285    if (isContextLost())
     286        return;
    265287    if (buffer && buffer->context() != this) {
    266288        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
     
    279301{
    280302    UNUSED_PARAM(ec);
     303    if (isContextLost())
     304        return;
    281305    if (renderBuffer && renderBuffer->context() != this) {
    282306        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
     
    296320{
    297321    UNUSED_PARAM(ec);
     322    if (isContextLost())
     323        return;
    298324    if (texture && texture->context() != this) {
    299325        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
     
    329355void WebGLRenderingContext::blendColor(double red, double green, double blue, double alpha)
    330356{
     357    if (isContextLost())
     358        return;
    331359    m_context->blendColor(red, green, blue, alpha);
    332360    cleanupAfterGraphicsCall(false);
     
    335363void WebGLRenderingContext::blendEquation(unsigned long mode)
    336364{
    337     if (!validateBlendEquation(mode))
     365    if (isContextLost() || !validateBlendEquation(mode))
    338366        return;
    339367    m_context->blendEquation(mode);
     
    343371void WebGLRenderingContext::blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha)
    344372{
    345     if (!validateBlendEquation(modeRGB) || !validateBlendEquation(modeAlpha))
     373    if (isContextLost() || !validateBlendEquation(modeRGB) || !validateBlendEquation(modeAlpha))
    346374        return;
    347375    m_context->blendEquationSeparate(modeRGB, modeAlpha);
     
    352380void WebGLRenderingContext::blendFunc(unsigned long sfactor, unsigned long dfactor)
    353381{
    354     if (!validateBlendFuncFactors(sfactor, dfactor))
     382    if (isContextLost() || !validateBlendFuncFactors(sfactor, dfactor))
    355383        return;
    356384    m_context->blendFunc(sfactor, dfactor);
     
    360388void WebGLRenderingContext::blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha)
    361389{
    362     if (!validateBlendFuncFactors(srcRGB, dstRGB))
     390    if (isContextLost() || !validateBlendFuncFactors(srcRGB, dstRGB))
    363391        return;
    364392    m_context->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
     
    369397{
    370398    UNUSED_PARAM(ec);
     399    if (isContextLost())
     400        return;
    371401    WebGLBuffer* buffer = validateBufferDataParameters(target, usage);
    372402    if (!buffer)
     
    386416{
    387417    UNUSED_PARAM(ec);
     418    if (isContextLost())
     419        return;
    388420    WebGLBuffer* buffer = validateBufferDataParameters(target, usage);
    389421    if (!buffer)
     
    403435{
    404436    UNUSED_PARAM(ec);
     437    if (isContextLost())
     438        return;
    405439    WebGLBuffer* buffer = validateBufferDataParameters(target, usage);
    406440    if (!buffer)
     
    420454{
    421455    UNUSED_PARAM(ec);
     456    if (isContextLost())
     457        return;
    422458    WebGLBuffer* buffer = validateBufferDataParameters(target, GraphicsContext3D::STATIC_DRAW);
    423459    if (!buffer)
     
    437473{
    438474    UNUSED_PARAM(ec);
     475    if (isContextLost())
     476        return;
    439477    WebGLBuffer* buffer = validateBufferDataParameters(target, GraphicsContext3D::STATIC_DRAW);
    440478    if (!buffer)
     
    453491unsigned long WebGLRenderingContext::checkFramebufferStatus(unsigned long target)
    454492{
     493    if (isContextLost())
     494        return GraphicsContext3D::FRAMEBUFFER_UNSUPPORTED;
    455495    if (target != GraphicsContext3D::FRAMEBUFFER) {
    456496        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
     
    467507void WebGLRenderingContext::clear(unsigned long mask)
    468508{
     509    if (isContextLost())
     510        return;
    469511    if (mask & ~(GraphicsContext3D::COLOR_BUFFER_BIT | GraphicsContext3D::DEPTH_BUFFER_BIT | GraphicsContext3D::STENCIL_BUFFER_BIT)) {
    470512        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
     
    481523void WebGLRenderingContext::clearColor(double r, double g, double b, double a)
    482524{
     525    if (isContextLost())
     526        return;
    483527    if (isnan(r))
    484528        r = 0;
     
    495539void WebGLRenderingContext::clearDepth(double depth)
    496540{
     541    if (isContextLost())
     542        return;
    497543    m_context->clearDepth(depth);
    498544    cleanupAfterGraphicsCall(false);
     
    501547void WebGLRenderingContext::clearStencil(long s)
    502548{
     549    if (isContextLost())
     550        return;
    503551    m_context->clearStencil(s);
    504552    cleanupAfterGraphicsCall(false);
     
    507555void WebGLRenderingContext::colorMask(bool red, bool green, bool blue, bool alpha)
    508556{
     557    if (isContextLost())
     558        return;
    509559    m_context->colorMask(red, green, blue, alpha);
    510560    cleanupAfterGraphicsCall(false);
     
    514564{
    515565    UNUSED_PARAM(ec);
    516     if (!validateWebGLObject(shader))
     566    if (isContextLost() || !validateWebGLObject(shader))
    517567        return;
    518568    m_context->compileShader(objectOrZero(shader));
     
    522572void WebGLRenderingContext::copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border)
    523573{
     574    if (isContextLost())
     575        return;
    524576    if (!validateTexFuncParameters(target, level, internalformat, width, height, border, internalformat, GraphicsContext3D::UNSIGNED_BYTE))
    525577        return;
     
    551603void WebGLRenderingContext::copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height)
    552604{
     605    if (isContextLost())
     606        return;
    553607    WebGLTexture* tex = validateTextureBinding(target, true);
    554608    if (!tex)
     
    572626PassRefPtr<WebGLBuffer> WebGLRenderingContext::createBuffer()
    573627{
     628    if (isContextLost())
     629        return 0;
    574630    RefPtr<WebGLBuffer> o = WebGLBuffer::create(this);
    575631    addObject(o.get());
     
    579635PassRefPtr<WebGLFramebuffer> WebGLRenderingContext::createFramebuffer()
    580636{
     637    if (isContextLost())
     638        return 0;
    581639    RefPtr<WebGLFramebuffer> o = WebGLFramebuffer::create(this);
    582640    addObject(o.get());
     
    586644PassRefPtr<WebGLTexture> WebGLRenderingContext::createTexture()
    587645{
     646    if (isContextLost())
     647        return 0;
    588648    RefPtr<WebGLTexture> o = WebGLTexture::create(this);
    589649    addObject(o.get());
     
    593653PassRefPtr<WebGLProgram> WebGLRenderingContext::createProgram()
    594654{
     655    if (isContextLost())
     656        return 0;
    595657    RefPtr<WebGLProgram> o = WebGLProgram::create(this);
    596658    addObject(o.get());
     
    600662PassRefPtr<WebGLRenderbuffer> WebGLRenderingContext::createRenderbuffer()
    601663{
     664    if (isContextLost())
     665        return 0;
    602666    RefPtr<WebGLRenderbuffer> o = WebGLRenderbuffer::create(this);
    603667    addObject(o.get());
     
    608672{
    609673    UNUSED_PARAM(ec);
     674    if (isContextLost())
     675        return 0;
    610676    if (type != GraphicsContext3D::VERTEX_SHADER && type != GraphicsContext3D::FRAGMENT_SHADER) {
    611677        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
     
    620686void WebGLRenderingContext::cullFace(unsigned long mode)
    621687{
     688    if (isContextLost())
     689        return;
    622690    m_context->cullFace(mode);
    623691    cleanupAfterGraphicsCall(false);
     
    626694void WebGLRenderingContext::deleteBuffer(WebGLBuffer* buffer)
    627695{
    628     if (!buffer)
     696    if (isContextLost() || !buffer)
    629697        return;
    630698   
     
    648716void WebGLRenderingContext::deleteFramebuffer(WebGLFramebuffer* framebuffer)
    649717{
    650     if (!framebuffer)
     718    if (isContextLost() || !framebuffer)
    651719        return;
    652720    if (framebuffer == m_framebufferBinding) {
     
    660728void WebGLRenderingContext::deleteProgram(WebGLProgram* program)
    661729{
    662     if (!program)
     730    if (isContextLost() || !program)
    663731        return;
    664732    if (program->context() != this) {
     
    673741void WebGLRenderingContext::deleteRenderbuffer(WebGLRenderbuffer* renderbuffer)
    674742{
    675     if (!renderbuffer)
     743    if (isContextLost() || !renderbuffer)
    676744        return;
    677745    if (renderbuffer == m_renderbufferBinding)
     
    684752void WebGLRenderingContext::deleteShader(WebGLShader* shader)
    685753{
    686     if (!shader)
     754    if (isContextLost() || !shader)
    687755        return;
    688756   
     
    692760void WebGLRenderingContext::deleteTexture(WebGLTexture* texture)
    693761{
    694     if (!texture)
     762    if (isContextLost() || !texture)
    695763        return;
    696764   
     
    702770void WebGLRenderingContext::depthFunc(unsigned long func)
    703771{
     772    if (isContextLost())
     773        return;
    704774    m_context->depthFunc(func);
    705775    cleanupAfterGraphicsCall(false);
     
    708778void WebGLRenderingContext::depthMask(bool flag)
    709779{
     780    if (isContextLost())
     781        return;
    710782    m_context->depthMask(flag);
    711783    cleanupAfterGraphicsCall(false);
     
    714786void WebGLRenderingContext::depthRange(double zNear, double zFar)
    715787{
     788    if (isContextLost())
     789        return;
    716790    m_context->depthRange(zNear, zFar);
    717791    cleanupAfterGraphicsCall(false);
     
    721795{
    722796    UNUSED_PARAM(ec);
    723     if (!validateWebGLObject(program) || !validateWebGLObject(shader))
     797    if (isContextLost() || !validateWebGLObject(program) || !validateWebGLObject(shader))
    724798        return;
    725799    if (!program->detachShader(shader)) {
     
    735809void WebGLRenderingContext::disable(unsigned long cap)
    736810{
    737     if (!validateCapability(cap))
     811    if (isContextLost() || !validateCapability(cap))
    738812        return;
    739813    m_context->disable(cap);
     
    744818{
    745819    UNUSED_PARAM(ec);
     820    if (isContextLost())
     821        return;
    746822    if (index >= m_maxVertexAttribs) {
    747823        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
     
    9401016    UNUSED_PARAM(ec);
    9411017
    942     if (!validateDrawMode(mode))
     1018    if (isContextLost() || !validateDrawMode(mode))
    9431019        return;
    9441020
     
    9891065    UNUSED_PARAM(ec);
    9901066
    991     if (!validateDrawMode(mode))
     1067    if (isContextLost() || !validateDrawMode(mode))
    9921068        return;
    9931069
     
    10541130void WebGLRenderingContext::enable(unsigned long cap)
    10551131{
    1056     if (!validateCapability(cap))
     1132    if (isContextLost() || !validateCapability(cap))
    10571133        return;
    10581134    m_context->enable(cap);
     
    10631139{
    10641140    UNUSED_PARAM(ec);
     1141    if (isContextLost())
     1142        return;
    10651143    if (index >= m_maxVertexAttribs) {
    10661144        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
     
    10791157void WebGLRenderingContext::finish()
    10801158{
     1159    if (isContextLost())
     1160        return;
    10811161    m_context->finish();
    10821162    cleanupAfterGraphicsCall(true);
     
    10861166void WebGLRenderingContext::flush()
    10871167{
     1168    if (isContextLost())
     1169        return;
    10881170    m_context->flush();
    10891171    cleanupAfterGraphicsCall(true);
     
    10931175{
    10941176    UNUSED_PARAM(ec);
    1095     if (!validateFramebufferFuncParameters(target, attachment))
     1177    if (isContextLost() || !validateFramebufferFuncParameters(target, attachment))
    10961178        return;
    10971179    if (renderbuffertarget != GraphicsContext3D::RENDERBUFFER) {
     
    11181200{
    11191201    UNUSED_PARAM(ec);
    1120     if (!validateFramebufferFuncParameters(target, attachment))
     1202    if (isContextLost() || !validateFramebufferFuncParameters(target, attachment))
    11211203        return;
    11221204    if (level) {
     
    11421224void WebGLRenderingContext::frontFace(unsigned long mode)
    11431225{
     1226    if (isContextLost())
     1227        return;
    11441228    m_context->frontFace(mode);
    11451229    cleanupAfterGraphicsCall(false);
     
    11481232void WebGLRenderingContext::generateMipmap(unsigned long target)
    11491233{
     1234    if (isContextLost())
     1235        return;
    11501236    WebGLTexture* tex = validateTextureBinding(target, false);
    11511237    if (!tex)
     
    11761262{
    11771263    UNUSED_PARAM(ec);
     1264    if (isContextLost() || !validateWebGLObject(program))
     1265        return 0;
    11781266    ActiveInfo info;
    1179     if (!validateWebGLObject(program))
    1180         return 0;
    11811267    if (!m_context->getActiveAttrib(objectOrZero(program), index, info))
    11821268        return 0;
     
    11871273{
    11881274    UNUSED_PARAM(ec);
     1275    if (isContextLost() || !validateWebGLObject(program))
     1276        return 0;
    11891277    ActiveInfo info;
    1190     if (!validateWebGLObject(program))
    1191         return 0;
    11921278    if (!m_context->getActiveUniform(objectOrZero(program), index, info))
    11931279        return 0;
     
    12021288    UNUSED_PARAM(ec);
    12031289    shaderObjects.clear();
    1204     if (!validateWebGLObject(program))
     1290    if (isContextLost() || !validateWebGLObject(program))
    12051291        return false;
    12061292    int numShaders = 0;
     
    12271313int WebGLRenderingContext::getAttribLocation(WebGLProgram* program, const String& name)
    12281314{
     1315    if (isContextLost())
     1316        return -1;
    12291317    return m_context->getAttribLocation(objectOrZero(program), name);
    12301318}
     
    12331321{
    12341322    UNUSED_PARAM(ec);
     1323    if (isContextLost())
     1324        return WebGLGetInfo();
    12351325    if (target != GraphicsContext3D::ARRAY_BUFFER && target != GraphicsContext3D::ELEMENT_ARRAY_BUFFER) {
    12361326        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
     
    12531343PassRefPtr<WebGLContextAttributes> WebGLRenderingContext::getContextAttributes()
    12541344{
     1345    if (isContextLost())
     1346        return 0;
    12551347    // We always need to return a new WebGLContextAttributes object to
    12561348    // prevent the user from mutating any cached version.
     
    12661358{
    12671359    UNUSED_PARAM(ec);
    1268     if (!validateFramebufferFuncParameters(target, attachment))
     1360    if (isContextLost() || !validateFramebufferFuncParameters(target, attachment))
    12691361        return WebGLGetInfo();
    12701362    switch (pname) {
     
    13141406{
    13151407    UNUSED_PARAM(ec);
     1408    if (isContextLost())
     1409        return WebGLGetInfo();
    13161410    WebGLStateRestorer(this, false);
    13171411    switch (pname) {
     
    15051599{
    15061600    UNUSED_PARAM(ec);
    1507     if (!validateWebGLObject(program))
     1601    if (isContextLost() || !validateWebGLObject(program))
    15081602        return WebGLGetInfo();
    15091603
     
    15341628{
    15351629    UNUSED_PARAM(ec);
    1536     if (!validateWebGLObject(program))
    1537         return "";
     1630    if (isContextLost() || !validateWebGLObject(program))
     1631        return String();
    15381632    WebGLStateRestorer(this, false);
    15391633    return m_context->getProgramInfoLog(objectOrZero(program));
     
    15431637{
    15441638    UNUSED_PARAM(ec);
     1639    if (isContextLost())
     1640        return WebGLGetInfo();
    15451641    if (target != GraphicsContext3D::RENDERBUFFER) {
    15461642        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
     
    15761672{
    15771673    UNUSED_PARAM(ec);
    1578     if (!validateWebGLObject(shader))
     1674    if (isContextLost() || !validateWebGLObject(shader))
    15791675        return WebGLGetInfo();
    15801676    WebGLStateRestorer(this, false);
     
    16011697{
    16021698    UNUSED_PARAM(ec);
    1603     if (!validateWebGLObject(shader))
    1604         return "";
     1699    if (isContextLost() || !validateWebGLObject(shader))
     1700        return String();
    16051701    WebGLStateRestorer(this, false);
    16061702    return m_context->getShaderInfoLog(objectOrZero(shader));
     
    16101706{
    16111707    UNUSED_PARAM(ec);
    1612     if (!validateWebGLObject(shader))
    1613         return "";
     1708    if (isContextLost() || !validateWebGLObject(shader))
     1709        return String();
    16141710    WebGLStateRestorer(this, false);
    16151711    return m_context->getShaderSource(objectOrZero(shader));
     
    16191715{
    16201716    UNUSED_PARAM(ec);
     1717    if (isContextLost())
     1718        return WebGLGetInfo();
    16211719    WebGLTexture* tex = validateTextureBinding(target, false);
    16221720    if (!tex)
     
    16401738{
    16411739    UNUSED_PARAM(ec);
    1642     if (!validateWebGLObject(program))
     1740    if (isContextLost() || !validateWebGLObject(program))
    16431741        return WebGLGetInfo();
    16441742    if (!uniformLocation) {
     
    17841882{
    17851883    UNUSED_PARAM(ec);
    1786     if (!validateWebGLObject(program))
     1884    if (isContextLost() || !validateWebGLObject(program))
    17871885        return 0;
    17881886    WebGLStateRestorer(this, false);
     
    17961894{
    17971895    UNUSED_PARAM(ec);
     1896    if (isContextLost())
     1897        return WebGLGetInfo();
    17981898    WebGLStateRestorer(this, false);
    17991899    if (index >= m_maxVertexAttribs) {
     
    18431943long WebGLRenderingContext::getVertexAttribOffset(unsigned long index, unsigned long pname)
    18441944{
     1945    if (isContextLost())
     1946        return 0;
    18451947    long result = m_context->getVertexAttribOffset(index, pname);
    18461948    cleanupAfterGraphicsCall(false);
     
    18501952void WebGLRenderingContext::hint(unsigned long target, unsigned long mode)
    18511953{
     1954    if (isContextLost())
     1955        return;
    18521956    if (target != GraphicsContext3D::GENERATE_MIPMAP_HINT) {
    18531957        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
     
    18601964bool WebGLRenderingContext::isBuffer(WebGLBuffer* buffer)
    18611965{
    1862     if (!buffer)
     1966    if (!buffer || isContextLost())
    18631967        return false;
    18641968
     
    18661970}
    18671971
     1972bool WebGLRenderingContext::isContextLost() const
     1973{
     1974    return m_contextLost;
     1975}
     1976
    18681977bool WebGLRenderingContext::isEnabled(unsigned long cap)
    18691978{
    1870     if (!validateCapability(cap))
     1979    if (!validateCapability(cap) || isContextLost())
    18711980        return false;
    18721981    return m_context->isEnabled(cap);
     
    18751984bool WebGLRenderingContext::isFramebuffer(WebGLFramebuffer* framebuffer)
    18761985{
    1877     if (!framebuffer)
     1986    if (!framebuffer || isContextLost())
    18781987        return false;
    18791988
     
    18831992bool WebGLRenderingContext::isProgram(WebGLProgram* program)
    18841993{
    1885     if (!program)
     1994    if (!program || isContextLost())
    18861995        return false;
    18871996
     
    18912000bool WebGLRenderingContext::isRenderbuffer(WebGLRenderbuffer* renderbuffer)
    18922001{
    1893     if (!renderbuffer)
     2002    if (!renderbuffer || isContextLost())
    18942003        return false;
    18952004
     
    18992008bool WebGLRenderingContext::isShader(WebGLShader* shader)
    19002009{
    1901     if (!shader)
     2010    if (!shader || isContextLost())
    19022011        return false;
    19032012
     
    19072016bool WebGLRenderingContext::isTexture(WebGLTexture* texture)
    19082017{
    1909     if (!texture)
     2018    if (!texture || isContextLost())
    19102019        return false;
    19112020
     
    19152024void WebGLRenderingContext::lineWidth(double width)
    19162025{
     2026    if (isContextLost())
     2027        return;
    19172028    m_context->lineWidth((float) width);
    19182029    cleanupAfterGraphicsCall(false);
     
    19222033{
    19232034    UNUSED_PARAM(ec);
    1924     if (!validateWebGLObject(program))
     2035    if (isContextLost() || !validateWebGLObject(program))
    19252036        return;
    19262037    if (!isGLES2Compliant()) {
     
    19422053void WebGLRenderingContext::pixelStorei(unsigned long pname, long param)
    19432054{
     2055    if (isContextLost())
     2056        return;
    19442057    switch (pname) {
    19452058    case GraphicsContext3D::UNPACK_FLIP_Y_WEBGL:
     
    19682081void WebGLRenderingContext::polygonOffset(double factor, double units)
    19692082{
     2083    if (isContextLost())
     2084        return;
    19702085    m_context->polygonOffset((float) factor, (float) units);
    19712086    cleanupAfterGraphicsCall(false);
     
    19742089void WebGLRenderingContext::readPixels(long x, long y, long width, long height, unsigned long format, unsigned long type, ArrayBufferView* pixels, ExceptionCode& ec)
    19752090{
     2091    if (isContextLost())
     2092        return;
    19762093    if (!canvas()->originClean()) {
    19772094        ec = SECURITY_ERR;
     
    20452162void WebGLRenderingContext::releaseShaderCompiler()
    20462163{
     2164    if (isContextLost())
     2165        return;
    20472166    m_context->releaseShaderCompiler();
    20482167    cleanupAfterGraphicsCall(false);
     
    20512170void WebGLRenderingContext::renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height)
    20522171{
     2172    if (isContextLost())
     2173        return;
    20532174    switch (internalformat) {
    20542175    case GraphicsContext3D::DEPTH_COMPONENT16:
     
    20702191void WebGLRenderingContext::sampleCoverage(double value, bool invert)
    20712192{
     2193    if (isContextLost())
     2194        return;
    20722195    m_context->sampleCoverage((float) value, invert);
    20732196    cleanupAfterGraphicsCall(false);
     
    20762199void WebGLRenderingContext::scissor(long x, long y, unsigned long width, unsigned long height)
    20772200{
     2201    if (isContextLost())
     2202        return;
    20782203    m_context->scissor(x, y, width, height);
    20792204    cleanupAfterGraphicsCall(false);
     
    20832208{
    20842209    UNUSED_PARAM(ec);
    2085     if (!validateWebGLObject(shader))
     2210    if (isContextLost() || !validateWebGLObject(shader))
    20862211        return;
    20872212    m_context->shaderSource(objectOrZero(shader), string);
     
    20912216void WebGLRenderingContext::stencilFunc(unsigned long func, long ref, unsigned long mask)
    20922217{
     2218    if (isContextLost())
     2219        return;
    20932220    m_context->stencilFunc(func, ref, mask);
    20942221    cleanupAfterGraphicsCall(false);
     
    20972224void WebGLRenderingContext::stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask)
    20982225{
     2226    if (isContextLost())
     2227        return;
    20992228    m_context->stencilFuncSeparate(face, func, ref, mask);
    21002229    cleanupAfterGraphicsCall(false);
     
    21032232void WebGLRenderingContext::stencilMask(unsigned long mask)
    21042233{
     2234    if (isContextLost())
     2235        return;
    21052236    m_context->stencilMask(mask);
    21062237    cleanupAfterGraphicsCall(false);
     
    21092240void WebGLRenderingContext::stencilMaskSeparate(unsigned long face, unsigned long mask)
    21102241{
     2242    if (isContextLost())
     2243        return;
    21112244    m_context->stencilMaskSeparate(face, mask);
    21122245    cleanupAfterGraphicsCall(false);
     
    21152248void WebGLRenderingContext::stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass)
    21162249{
     2250    if (isContextLost())
     2251        return;
    21172252    m_context->stencilOp(fail, zfail, zpass);
    21182253    cleanupAfterGraphicsCall(false);
     
    21212256void WebGLRenderingContext::stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass)
    21222257{
     2258    if (isContextLost())
     2259        return;
    21232260    m_context->stencilOpSeparate(face, fail, zfail, zpass);
    21242261    cleanupAfterGraphicsCall(false);
     
    21702307                                       unsigned format, unsigned type, ArrayBufferView* pixels, ExceptionCode& ec)
    21712308{
    2172     if (!validateTexFuncData(width, height, format, type, pixels))
     2309    if (isContextLost() || !validateTexFuncData(width, height, format, type, pixels))
    21732310        return;
    21742311    void* data = pixels ? pixels->baseAddress() : 0;
     
    21972334{
    21982335    ec = 0;
     2336    if (isContextLost())
     2337        return;
    21992338    Vector<uint8_t> data;
    22002339    if (!m_context->extractImageData(pixels, format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) {
     
    22142353{
    22152354    ec = 0;
     2355    if (isContextLost())
     2356        return;
    22162357    if (!image || !image->cachedImage()) {
    22172358        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
     
    22272368{
    22282369    ec = 0;
     2370    if (isContextLost())
     2371        return;
    22292372    if (!canvas || !canvas->buffer()) {
    22302373        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
     
    22592402{
    22602403    ec = 0;
     2404    if (isContextLost())
     2405        return;
    22612406    RefPtr<Image> image = videoFrameToImage(video);
    22622407    if (!video)
     
    22672412void WebGLRenderingContext::texParameter(unsigned long target, unsigned long pname, float paramf, int parami, bool isFloat)
    22682413{
     2414    if (isContextLost())
     2415        return;
    22692416    WebGLTexture* tex = validateTextureBinding(target, false);
    22702417    if (!tex)
     
    23122459    // FIXME: For now we ignore any errors returned
    23132460    ec = 0;
     2461    if (isContextLost())
     2462        return;
    23142463    if (!validateTexFuncFormatAndType(format, type))
    23152464        return;
     
    23252474{
    23262475    ec = 0;
     2476    if (isContextLost())
     2477        return;
    23272478    Vector<uint8_t> data;
    23282479    if (!m_context->extractImageData(image, format, type, flipY, premultiplyAlpha, data)) {
     
    23382489                                          unsigned format, unsigned type, ArrayBufferView* pixels, ExceptionCode& ec)
    23392490{
    2340     if (!validateTexFuncData(width, height, format, type, pixels))
     2491    if (isContextLost() || !validateTexFuncData(width, height, format, type, pixels))
    23412492        return;
    23422493    void* data = pixels ? pixels->baseAddress() : 0;
     
    23642515{
    23652516    ec = 0;
     2517    if (isContextLost())
     2518        return;
    23662519    Vector<uint8_t> data;
    23672520    if (!m_context->extractImageData(pixels, format, type, m_unpackFlipY, m_unpackPremultiplyAlpha, data)) {
     
    23772530{
    23782531    ec = 0;
     2532    if (isContextLost())
     2533        return;
    23792534    if (!image || !image->cachedImage()) {
    23802535        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
     
    23902545{
    23912546    ec = 0;
     2547    if (isContextLost())
     2548        return;
    23922549    if (!canvas || !canvas->buffer()) {
    23932550        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
     
    24032560{
    24042561    ec = 0;
     2562    if (isContextLost())
     2563        return;
    24052564    RefPtr<Image> image = videoFrameToImage(video);
    24062565    if (!video)
     
    24122571{
    24132572    UNUSED_PARAM(ec);
    2414     if (!location)
     2573    if (isContextLost() || !location)
    24152574        return;
    24162575
     
    24272586{
    24282587    UNUSED_PARAM(ec);
    2429     if (!validateUniformParameters(location, v, 1))
     2588    if (isContextLost() || !validateUniformParameters(location, v, 1))
    24302589        return;
    24312590
     
    24372596{
    24382597    UNUSED_PARAM(ec);
    2439     if (!validateUniformParameters(location, v, size, 1))
     2598    if (isContextLost() || !validateUniformParameters(location, v, size, 1))
    24402599        return;
    24412600
     
    24472606{
    24482607    UNUSED_PARAM(ec);
    2449     if (!location)
     2608    if (isContextLost() || !location)
    24502609        return;
    24512610
     
    24622621{
    24632622    UNUSED_PARAM(ec);
    2464     if (!validateUniformParameters(location, v, 1))
     2623    if (isContextLost() || !validateUniformParameters(location, v, 1))
    24652624        return;
    24662625
     
    24722631{
    24732632    UNUSED_PARAM(ec);
    2474     if (!validateUniformParameters(location, v, size, 1))
     2633    if (isContextLost() || !validateUniformParameters(location, v, size, 1))
    24752634        return;
    24762635
     
    24822641{
    24832642    UNUSED_PARAM(ec);
    2484     if (!location)
     2643    if (isContextLost() || !location)
    24852644        return;
    24862645
     
    24972656{
    24982657    UNUSED_PARAM(ec);
    2499     if (!validateUniformParameters(location, v, 2))
     2658    if (isContextLost() || !validateUniformParameters(location, v, 2))
    25002659        return;
    25012660
     
    25072666{
    25082667    UNUSED_PARAM(ec);
    2509     if (!validateUniformParameters(location, v, size, 2))
     2668    if (isContextLost() || !validateUniformParameters(location, v, size, 2))
    25102669        return;
    25112670
     
    25172676{
    25182677    UNUSED_PARAM(ec);
    2519     if (!location)
     2678    if (isContextLost() || !location)
    25202679        return;
    25212680
     
    25322691{
    25332692    UNUSED_PARAM(ec);
    2534     if (!validateUniformParameters(location, v, 2))
     2693    if (isContextLost() || !validateUniformParameters(location, v, 2))
    25352694        return;
    25362695
     
    25422701{
    25432702    UNUSED_PARAM(ec);
    2544     if (!validateUniformParameters(location, v, size, 2))
     2703    if (isContextLost() || !validateUniformParameters(location, v, size, 2))
    25452704        return;
    25462705
     
    25522711{
    25532712    UNUSED_PARAM(ec);
    2554     if (!location)
     2713    if (isContextLost() || !location)
    25552714        return;
    25562715
     
    25672726{
    25682727    UNUSED_PARAM(ec);
    2569     if (!validateUniformParameters(location, v, 3))
     2728    if (isContextLost() || !validateUniformParameters(location, v, 3))
    25702729        return;
    25712730
     
    25772736{
    25782737    UNUSED_PARAM(ec);
    2579     if (!validateUniformParameters(location, v, size, 3))
     2738    if (isContextLost() || !validateUniformParameters(location, v, size, 3))
    25802739        return;
    25812740
     
    25872746{
    25882747    UNUSED_PARAM(ec);
    2589     if (!location)
     2748    if (isContextLost() || !location)
    25902749        return;
    25912750
     
    26022761{
    26032762    UNUSED_PARAM(ec);
    2604     if (!validateUniformParameters(location, v, 3))
     2763    if (isContextLost() || !validateUniformParameters(location, v, 3))
    26052764        return;
    26062765
     
    26122771{
    26132772    UNUSED_PARAM(ec);
    2614     if (!validateUniformParameters(location, v, size, 3))
     2773    if (isContextLost() || !validateUniformParameters(location, v, size, 3))
    26152774        return;
    26162775
     
    26222781{
    26232782    UNUSED_PARAM(ec);
    2624     if (!location)
     2783    if (isContextLost() || !location)
    26252784        return;
    26262785
     
    26372796{
    26382797    UNUSED_PARAM(ec);
    2639     if (!validateUniformParameters(location, v, 4))
     2798    if (isContextLost() || !validateUniformParameters(location, v, 4))
    26402799        return;
    26412800
     
    26472806{
    26482807    UNUSED_PARAM(ec);
    2649     if (!validateUniformParameters(location, v, size, 4))
     2808    if (isContextLost() || !validateUniformParameters(location, v, size, 4))
    26502809        return;
    26512810
     
    26572816{
    26582817    UNUSED_PARAM(ec);
    2659     if (!location)
     2818    if (isContextLost() || !location)
    26602819        return;
    26612820
     
    26722831{
    26732832    UNUSED_PARAM(ec);
    2674     if (!validateUniformParameters(location, v, 4))
     2833    if (isContextLost() || !validateUniformParameters(location, v, 4))
    26752834        return;
    26762835
     
    26822841{
    26832842    UNUSED_PARAM(ec);
    2684     if (!validateUniformParameters(location, v, size, 4))
     2843    if (isContextLost() || !validateUniformParameters(location, v, size, 4))
    26852844        return;
    26862845
     
    26922851{
    26932852    UNUSED_PARAM(ec);
    2694     if (!validateUniformMatrixParameters(location, transpose, v, 4))
     2853    if (isContextLost() || !validateUniformMatrixParameters(location, transpose, v, 4))
    26952854        return;
    26962855    m_context->uniformMatrix2fv(location->location(), transpose, v->data(), v->length() / 4);
     
    27012860{
    27022861    UNUSED_PARAM(ec);
    2703     if (!validateUniformMatrixParameters(location, transpose, v, size, 4))
     2862    if (isContextLost() || !validateUniformMatrixParameters(location, transpose, v, size, 4))
    27042863        return;
    27052864    m_context->uniformMatrix2fv(location->location(), transpose, v, size / 4);
     
    27102869{
    27112870    UNUSED_PARAM(ec);
    2712     if (!validateUniformMatrixParameters(location, transpose, v, 9))
     2871    if (isContextLost() || !validateUniformMatrixParameters(location, transpose, v, 9))
    27132872        return;
    27142873    m_context->uniformMatrix3fv(location->location(), transpose, v->data(), v->length() / 9);
     
    27192878{
    27202879    UNUSED_PARAM(ec);
    2721     if (!validateUniformMatrixParameters(location, transpose, v, size, 9))
     2880    if (isContextLost() || !validateUniformMatrixParameters(location, transpose, v, size, 9))
    27222881        return;
    27232882    m_context->uniformMatrix3fv(location->location(), transpose, v, size / 9);
     
    27282887{
    27292888    UNUSED_PARAM(ec);
    2730     if (!validateUniformMatrixParameters(location, transpose, v, 16))
     2889    if (isContextLost() || !validateUniformMatrixParameters(location, transpose, v, 16))
    27312890        return;
    27322891    m_context->uniformMatrix4fv(location->location(), transpose, v->data(), v->length() / 16);
     
    27372896{
    27382897    UNUSED_PARAM(ec);
    2739     if (!validateUniformMatrixParameters(location, transpose, v, size, 16))
     2898    if (isContextLost() || !validateUniformMatrixParameters(location, transpose, v, size, 16))
    27402899        return;
    27412900    m_context->uniformMatrix4fv(location->location(), transpose, v, size / 16);
     
    27462905{
    27472906    UNUSED_PARAM(ec);
     2907    if (isContextLost())
     2908        return;
    27482909    if (program && program->context() != this) {
    27492910        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
     
    27692930{
    27702931    UNUSED_PARAM(ec);
    2771     if (!validateWebGLObject(program))
     2932    if (isContextLost() || !validateWebGLObject(program))
    27722933        return;
    27732934    m_context->validateProgram(objectOrZero(program));
     
    28382999{
    28393000    UNUSED_PARAM(ec);
     3001    if (isContextLost())
     3002        return;
    28403003    if (index >= m_maxVertexAttribs) {
    28413004        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
     
    28823045void WebGLRenderingContext::viewport(long x, long y, unsigned long width, unsigned long height)
    28833046{
     3047    if (isContextLost())
     3048        return;
    28843049    if (isnan(x))
    28853050        x = 0;
     
    28943059}
    28953060
     3061void WebGLRenderingContext::loseContext()
     3062{
     3063    if (isContextLost())
     3064        return;
     3065
     3066    m_contextLost = true;
     3067
     3068    detachAndRemoveAllObjects();
     3069
     3070    // There is no direct way to clear errors from a GL implementation and
     3071    // looping until getError() becomes NO_ERROR might cause an infinite loop if
     3072    // the driver or context implementation had a bug.  So, loop a reasonably
     3073    // large number of times to clear any existing errors.
     3074    for (int i = 0; i < 100; ++i) {
     3075        if (m_context->getError() == GraphicsContext3D::NO_ERROR)
     3076            break;
     3077    }
     3078    m_context->synthesizeGLError(GraphicsContext3D::CONTEXT_LOST_WEBGL);
     3079
     3080    canvas()->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextlostEvent, false, true, ""));
     3081}
     3082
     3083void WebGLRenderingContext::restoreContext()
     3084{
     3085    if (!isContextLost())
     3086        return;
     3087
     3088    // The rendering context is not restored if there is no handler for
     3089    // the context restored event.
     3090    if (!canvas()->hasEventListeners(eventNames().webglcontextrestoredEvent))
     3091        return;
     3092
     3093    m_contextLost = false;
     3094    initializeNewContext();
     3095
     3096    canvas()->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextrestoredEvent, false, true, ""));
     3097}
     3098
    28963099void WebGLRenderingContext::removeObject(WebGLObject* object)
    28973100{
     
    29013104void WebGLRenderingContext::addObject(WebGLObject* object)
    29023105{
     3106    ASSERT(!isContextLost());
    29033107    removeObject(object);
    29043108    m_canvasObjects.add(object);
     
    35063710void WebGLRenderingContext::vertexAttribfImpl(unsigned long index, int expectedSize, float v0, float v1, float v2, float v3)
    35073711{
     3712    if (isContextLost())
     3713        return;
    35083714    if (index >= m_maxVertexAttribs) {
    35093715        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
     
    35383744void WebGLRenderingContext::vertexAttribfvImpl(unsigned long index, Float32Array* v, int expectedSize)
    35393745{
     3746    if (isContextLost())
     3747        return;
    35403748    if (!v) {
    35413749        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
     
    35473755void WebGLRenderingContext::vertexAttribfvImpl(unsigned long index, float* v, int size, int expectedSize)
    35483756{
     3757    if (isContextLost())
     3758        return;
    35493759    if (!v) {
    35503760        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
  • trunk/WebCore/html/canvas/WebGLRenderingContext.h

    r71185 r71274  
    177177    void hint(unsigned long target, unsigned long mode);
    178178    bool isBuffer(WebGLBuffer*);
     179    bool isContextLost() const;
    179180    bool isEnabled(unsigned long cap);
    180181    bool isFramebuffer(WebGLFramebuffer*);
     
    278279    void viewport(long x, long y, unsigned long width, unsigned long height);
    279280
     281    void loseContext();
     282    void restoreContext();
     283
    280284    GraphicsContext3D* graphicsContext3D() const { return m_context.get(); }
    281285#if USE(ACCELERATED_COMPOSITING)
     
    293297
    294298    WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>);
     299    void initializeNewContext();
    295300
    296301    void addObject(WebGLObject*);
     
    334339    bool m_needsUpdate;
    335340    bool m_markedCanvasDirty;
    336     // FIXME: I think this is broken -- it does not increment any
    337     // reference counts, so may refer to destroyed objects.
    338341    HashSet<RefPtr<WebGLObject> > m_canvasObjects;
    339342
     
    422425    bool m_unpackFlipY;
    423426    bool m_unpackPremultiplyAlpha;
     427    bool m_contextLost;
    424428
    425429    // Helpers for getParameter and others
  • trunk/WebCore/html/canvas/WebGLRenderingContext.idl

    r68460 r71274  
    464464        const unsigned int UNPACK_FLIP_Y_WEBGL            = 0x9240;
    465465        const unsigned int UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241;
     466        const unsigned int CONTEXT_LOST_WEBGL             = 0x9242;
    466467
    467468        [StrictTypeChecking] void         activeTexture(in unsigned long texture) raises(DOMException);
     
    552553        // any getProgramParameter(in WebGLProgram program, in unsigned long pname) raises(DOMException);
    553554        [StrictTypeChecking, Custom] void getProgramParameter();
    554         [StrictTypeChecking] DOMString getProgramInfoLog(in WebGLProgram program) raises(DOMException);
     555        [StrictTypeChecking, ConvertNullStringTo=Null] DOMString getProgramInfoLog(in WebGLProgram program) raises(DOMException);
    555556        // any getRenderbufferParameter(in unsigned long target, in unsigned long pname) raises(DOMException);
    556557        [StrictTypeChecking, Custom] void getRenderbufferParameter();
     
    558559        [StrictTypeChecking, Custom] void getShaderParameter() raises(DOMException);
    559560
    560         [StrictTypeChecking] DOMString    getShaderInfoLog(in WebGLShader shader) raises(DOMException);
     561        [StrictTypeChecking, ConvertNullStringTo=Null] DOMString    getShaderInfoLog(in WebGLShader shader) raises(DOMException);
    561562
    562563        // TBD
    563564        // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
    564565
    565         [StrictTypeChecking] DOMString    getShaderSource(in WebGLShader shader) raises(DOMException);
     566        [StrictTypeChecking, ConvertNullStringTo=Null] DOMString    getShaderSource(in WebGLShader shader) raises(DOMException);
    566567
    567568        // any getTexParameter(in unsigned long target, in unsigned long pname) raises(DOMException);
     
    580581        [StrictTypeChecking] void         hint(in unsigned long target, in unsigned long mode);
    581582        [StrictTypeChecking] boolean      isBuffer(in WebGLBuffer buffer);
     583        [StrictTypeChecking] boolean      isContextLost();
    582584        [StrictTypeChecking] boolean      isEnabled(in unsigned long cap);
    583585        [StrictTypeChecking] boolean      isFramebuffer(in WebGLFramebuffer framebuffer);
  • trunk/WebCore/platform/graphics/GraphicsContext3D.h

    r71272 r71274  
    406406        UNPACK_FLIP_Y_WEBGL = 0x9240,
    407407        UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241,
     408        CONTEXT_LOST_WEBGL = 0x9242,
    408409    };
    409410
Note: See TracChangeset for help on using the changeset viewer.