WebGLContextEvent should have its own JS wrapper
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Sep 2011 18:20:45 +0000 (18:20 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Sep 2011 18:20:45 +0000 (18:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=67352

Reviewed by Anders Carlsson.

Source/WebCore:

The WebGLContextEvent was missing a proper JS wrapper, and thus
anyone using one in an EventListener was actually just getting
a plain old Event. Rectify this by generating the wrapper and
wrapping it on creating.

Test: fast/canvas/webgl/WebGLContextEvent.html

* CodeGenerators.pri:
Add WebGLContextEvent.idl

* DerivedSources.make:
Add WebGLContextEvent and sort.

* WebCore.xcodeproj/project.pbxproj:
Add generated JSWebGLContextEvent.h/cpp.

* bindings/js/JSEventCustom.cpp:
(WebCore::toJS):
Wrap WebGLContextEvents as JSWebGLContextEvents.

* dom/Event.cpp:
(WebCore::Event::isWebGLContextEvent):
* dom/Event.h:
* html/canvas/WebGLContextEvent.cpp:
(WebCore::WebGLContextEvent::isWebGLContextEvent):
* html/canvas/WebGLContextEvent.h:
Add predicate for WebGLContextEvent.

LayoutTests:

* fast/canvas/webgl/WebGLContextEvent-expected.txt: Added.
* fast/canvas/webgl/WebGLContextEvent.html: Added.
Add a test that shows that WebGLContextEvents are not just base Events.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@94319 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/WebGLContextEvent-expected.txt [new file with mode: 0644]
LayoutTests/fast/canvas/webgl/WebGLContextEvent.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/CodeGenerators.pri
Source/WebCore/DerivedSources.make
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSEventCustom.cpp
Source/WebCore/dom/Event.cpp
Source/WebCore/dom/Event.h
Source/WebCore/html/canvas/WebGLContextEvent.cpp
Source/WebCore/html/canvas/WebGLContextEvent.h

index 7633ffe..b27f21b 100644 (file)
@@ -1,3 +1,14 @@
+2011-09-01  Sam Weinig  <sam@webkit.org>
+
+        WebGLContextEvent should have its own JS wrapper
+        https://bugs.webkit.org/show_bug.cgi?id=67352
+
+        Reviewed by Anders Carlsson.
+
+        * fast/canvas/webgl/WebGLContextEvent-expected.txt: Added.
+        * fast/canvas/webgl/WebGLContextEvent.html: Added.
+        Add a test that shows that WebGLContextEvents are not just base Events.
+
 2011-09-01  Eric Carlson  <eric.carlson@apple.com>
 
         Add 'muted' content attribute to HTMLMediaElement
diff --git a/LayoutTests/fast/canvas/webgl/WebGLContextEvent-expected.txt b/LayoutTests/fast/canvas/webgl/WebGLContextEvent-expected.txt
new file mode 100644 (file)
index 0000000..763008f
--- /dev/null
@@ -0,0 +1,8 @@
+Test that the event passed to a listener of webglcontextlost is a WebGLContextEvent.
+PASS evt.toString() is '[object WebGLContextEvent]'
+PASS evt.statusMessage is ''
+Test that the event passed to a listener of webglcontextrestored is a WebGLContextEvent.
+PASS evt.toString() is '[object WebGLContextEvent]'
+PASS evt.statusMessage is ''
+PASS extension.restoreContext() was expected value: NO_ERROR.
+
diff --git a/LayoutTests/fast/canvas/webgl/WebGLContextEvent.html b/LayoutTests/fast/canvas/webgl/WebGLContextEvent.html
new file mode 100644 (file)
index 0000000..3598f8e
--- /dev/null
@@ -0,0 +1,75 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css"/>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/webgl-test.js"></script>
+<script src="resources/webgl-test-utils.js"></script>
+<script>
+
+var evt;
+var canvas;
+var context;
+var extension;
+
+function createNewCanvas()
+{
+    canvas = document.createElement("canvas");
+    canvas.width = 1;
+    canvas.height = 1;
+
+    context = WebGLTestUtils.create3DContext(canvas);
+    extension = context.getExtension("WEBKIT_lose_context");
+    if (!extension) {
+        debug("Could not find the WEBKIT_lose_context extension.");
+        return;
+    }
+}
+
+function runTest()
+{
+    createNewCanvas();
+    canvas.addEventListener("webglcontextlost", function(e) {
+        evt = e;
+        debug("Test that the event passed to a listener of webglcontextlost is a WebGLContextEvent.")
+        shouldBe("evt.toString()", "'[object WebGLContextEvent]'");
+        shouldBe("evt.statusMessage", "''");
+    }, false);
+    extension.loseContext();
+
+
+    createNewCanvas();
+    canvas.addEventListener("webglcontextlost", function(e) {
+        e.preventDefault();
+    }, false);
+    canvas.addEventListener("webglcontextrestored", function(e) {
+        evt = e;
+        debug("Test that the event passed to a listener of webglcontextrestored is a WebGLContextEvent.")
+        shouldBe("evt.toString()", "'[object WebGLContextEvent]'");
+        shouldBe("evt.statusMessage", "''");
+    }, false);
+    extension.loseContext();
+    WebGLTestUtils.shouldGenerateGLError(context, context.NO_ERROR, "extension.restoreContext()");
+
+    finish();
+}
+
+function finish() {
+    successfullyParsed = true;
+    var epilogue = document.createElement("script");
+    epilogue.onload = function() {
+        if (window.nonKhronosFrameworkNotifyDone)
+            window.nonKhronosFrameworkNotifyDone();
+    };
+    epilogue.src = "../../js/resources/js-test-post.js";
+    document.body.appendChild(epilogue);
+}
+
+</script>
+
+</head>
+<body onload="runTest()">
+<div id="description"></div>
+<div id="console"></div>
+<canvas id="canvas">
+</body>
+</html>
index b7abee4..16d4b7a 100644 (file)
@@ -1,3 +1,38 @@
+2011-09-01  Sam Weinig  <sam@webkit.org>
+
+        WebGLContextEvent should have its own JS wrapper
+        https://bugs.webkit.org/show_bug.cgi?id=67352
+
+        Reviewed by Anders Carlsson.
+
+        The WebGLContextEvent was missing a proper JS wrapper, and thus
+        anyone using one in an EventListener was actually just getting
+        a plain old Event. Rectify this by generating the wrapper and 
+        wrapping it on creating.
+
+        Test: fast/canvas/webgl/WebGLContextEvent.html
+
+        * CodeGenerators.pri:
+        Add WebGLContextEvent.idl
+
+        * DerivedSources.make:
+        Add WebGLContextEvent and sort.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Add generated JSWebGLContextEvent.h/cpp.
+
+        * bindings/js/JSEventCustom.cpp:
+        (WebCore::toJS):
+        Wrap WebGLContextEvents as JSWebGLContextEvents.
+
+        * dom/Event.cpp:
+        (WebCore::Event::isWebGLContextEvent):
+        * dom/Event.h:
+        * html/canvas/WebGLContextEvent.cpp:
+        (WebCore::WebGLContextEvent::isWebGLContextEvent):
+        * html/canvas/WebGLContextEvent.h:
+        Add predicate for WebGLContextEvent.
+
 2011-09-01  Eric Carlson  <eric.carlson@apple.com>
 
         Add 'muted' content attribute to HTMLMediaElement
index 6b15598..0c7196a 100644 (file)
@@ -226,6 +226,7 @@ IDL_BINDINGS += \
     html/canvas/WebGLActiveInfo.idl \
     html/canvas/WebGLBuffer.idl \
     html/canvas/WebGLContextAttributes.idl \
+    html/canvas/WebGLContextEvent.idl \
     html/canvas/WebGLFramebuffer.idl \
     html/canvas/WebGLProgram.idl \
     html/canvas/WebGLRenderbuffer.idl \
index d06658f..8267fa8 100644 (file)
@@ -54,12 +54,14 @@ VPATH = \
 DOM_CLASSES = \
     AbstractView \
     AbstractWorker \
+    ArrayBuffer \
+    ArrayBufferView \
     Attr \
     AudioBuffer \
     AudioBufferCallback \
     AudioBufferSourceNode \
-    AudioChannelSplitter \
     AudioChannelMerger \
+    AudioChannelSplitter \
     AudioContext \
     AudioDestinationNode \
     AudioGain \
@@ -70,22 +72,11 @@ DOM_CLASSES = \
     AudioParam \
     AudioProcessingEvent \
     AudioSourceNode \
-    BiquadFilterNode \
-    ConvolverNode \
-    DelayNode \
-    DynamicsCompressorNode \
-    HighPass2FilterNode \
-    JavaScriptAudioNode \
-    LowPass2FilterNode \
-    MediaElementAudioSourceNode \
-    OfflineAudioCompletionEvent \
-    RealtimeAnalyserNode \
-    WaveShaperNode \
     BarInfo \
     BeforeLoadEvent \
     BeforeProcessEvent \
+    BiquadFilterNode \
     Blob \
-    WebKitBlobBuilder \
     CDATASection \
     CSSCharsetRule \
     CSSFontFaceRule \
@@ -101,31 +92,10 @@ DOM_CLASSES = \
     CSSUnknownRule \
     CSSValue \
     CSSValueList \
-    WebGLActiveInfo \
-    ArrayBufferView \
-    ArrayBuffer \
-    DataView \
-    WebGLBuffer \
-    Int8Array \
-    WebGLContextAttributes \
-    Float32Array \
-    Float64Array \
-    WebGLFramebuffer \
     CanvasGradient \
-    Int32Array \
     CanvasPattern \
-    WebGLProgram \
-    WebGLRenderbuffer \
     CanvasRenderingContext \
     CanvasRenderingContext2D \
-    WebGLRenderingContext \
-    WebGLShader \
-    Int16Array \
-    WebGLTexture \
-    WebGLUniformLocation \
-    Uint8Array \
-    Uint32Array \
-    Uint16Array \
     CharacterData \
     ClientRect \
     ClientRectList \
@@ -134,13 +104,11 @@ DOM_CLASSES = \
     Comment \
     CompositionEvent \
     Console \
+    ConvolverNode \
     Coordinates \
     Counter \
     Crypto \
     CustomEvent \
-    DataTransferItem \
-    DataTransferItems \
-    DedicatedWorkerContext \
     DOMApplicationCache \
     DOMCoreException \
     DOMFileSystem \
@@ -153,17 +121,22 @@ DOM_CLASSES = \
     DOMPlugin \
     DOMPluginArray \
     DOMSelection \
+    DOMSettableTokenList \
     DOMStringList \
     DOMStringMap \
-    DOMSettableTokenList \
     DOMTokenList \
     DOMURL \
     DOMWindow \
     DataTransferItem \
+    DataTransferItem \
+    DataTransferItems \
     DataTransferItems \
+    DataView \
     Database \
     DatabaseCallback \
     DatabaseSync \
+    DedicatedWorkerContext \
+    DelayNode \
     DeviceMotionEvent \
     DeviceOrientationEvent \
     DirectoryEntry \
@@ -173,16 +146,17 @@ DOM_CLASSES = \
     Document \
     DocumentFragment \
     DocumentType \
+    DynamicsCompressorNode \
     Element \
     ElementTimeControl \
     Entity \
     EntityReference \
     EntriesCallback \
     Entry \
-    EntrySync \
     EntryArray \
     EntryArraySync \
     EntryCallback \
+    EntrySync \
     ErrorCallback \
     ErrorEvent \
     Event \
@@ -194,20 +168,19 @@ DOM_CLASSES = \
     FileCallback \
     FileEntry \
     FileEntrySync \
-    FileException \
     FileError \
+    FileException \
     FileList \
     FileReader \
     FileReaderSync \
+    FileSystemCallback \
     FileWriter \
     FileWriterCallback \
     FileWriterSync \
-    FileSystemCallback \
-    WebKitFlags \
+    Float32Array \
+    Float64Array \
     Geolocation \
     Geoposition \
-    HashChangeEvent \
-    History \
     HTMLAllCollection \
     HTMLAnchorElement \
     HTMLAppletElement \
@@ -221,9 +194,9 @@ DOM_CLASSES = \
     HTMLButtonElement \
     HTMLCanvasElement \
     HTMLCollection \
+    HTMLDListElement \
     HTMLDataListElement \
     HTMLDetailsElement \
-    HTMLDListElement \
     HTMLDirectoryElement \
     HTMLDivElement \
     HTMLDocument \
@@ -281,11 +254,14 @@ DOM_CLASSES = \
     HTMLUListElement \
     HTMLUnknownElement \
     HTMLVideoElement \
+    HashChangeEvent \
+    HighPass2FilterNode \
+    History \
     IDBAny \
     IDBCursor \
+    IDBDatabase \
     IDBDatabaseError \
     IDBDatabaseException \
-    IDBDatabase \
     IDBFactory \
     IDBIndex \
     IDBKey \
@@ -296,10 +272,16 @@ DOM_CLASSES = \
     ImageData \
     InjectedScriptHost \
     InspectorFrontendHost \
+    Int16Array \
+    Int32Array \
+    Int8Array \
     Internals \
+    JavaScriptAudioNode \
     KeyboardEvent \
     LocalMediaStream \
     Location \
+    LowPass2FilterNode \
+    MediaElementAudioSourceNode \
     MediaError \
     MediaList \
     MediaQueryList \
@@ -331,8 +313,8 @@ DOM_CLASSES = \
     NotificationCenter \
     OESStandardDerivatives \
     OESTextureFloat \
-     OESVertexArrayObject \
-     WebGLVertexArrayObjectOES \
+    OESVertexArrayObject \
+    OfflineAudioCompletionEvent \
     OperationNotAllowedException \
     OverflowEvent \
     PageTransitionEvent \
@@ -349,16 +331,9 @@ DOM_CLASSES = \
     RGBColor \
     Range \
     RangeException \
+    RealtimeAnalyserNode \
     Rect \
     RequestAnimationFrameCallback \
-    SharedWorker \
-    SharedWorkerContext \
-    ScriptProfile \
-    ScriptProfileNode \
-    SignalingCallback \
-    SpeechInputEvent \
-    SpeechInputResult \
-    SpeechInputResultList \
     SQLError \
     SQLException \
     SQLResultSet \
@@ -370,13 +345,6 @@ DOM_CLASSES = \
     SQLTransactionErrorCallback \
     SQLTransactionSync \
     SQLTransactionSyncCallback \
-    Storage \
-    StorageEvent \
-    StorageInfo \
-    StorageInfoErrorCallback \
-    StorageInfoQuotaCallback \
-    StorageInfoUsageCallback \
-    StringCallback \
     SVGAElement \
     SVGAltGlyphDefElement \
     SVGAltGlyphElement \
@@ -460,12 +428,12 @@ DOM_CLASSES = \
     SVGLineElement \
     SVGLinearGradientElement \
     SVGLocatable \
+    SVGMPathElement \
     SVGMarkerElement \
     SVGMaskElement \
     SVGMatrix \
     SVGMetadataElement \
     SVGMissingGlyphElement \
-    SVGMPathElement \
     SVGNumber \
     SVGNumberList \
     SVGPaint \
@@ -524,11 +492,26 @@ DOM_CLASSES = \
     SVGURIReference \
     SVGUnitTypes \
     SVGUseElement \
-    SVGViewElement \
     SVGVKernElement \
+    SVGViewElement \
     SVGZoomAndPan \
     SVGZoomEvent \
     Screen \
+    ScriptProfile \
+    ScriptProfileNode \
+    SharedWorker \
+    SharedWorkerContext \
+    SignalingCallback \
+    SpeechInputEvent \
+    SpeechInputResult \
+    SpeechInputResultList \
+    Storage \
+    StorageEvent \
+    StorageInfo \
+    StorageInfoErrorCallback \
+    StorageInfoQuotaCallback \
+    StorageInfoUsageCallback \
+    StringCallback \
     StringCallback \
     StyleMedia \
     StyleSheet \
@@ -542,14 +525,32 @@ DOM_CLASSES = \
     TouchList \
     TreeWalker \
     UIEvent \
+    Uint16Array \
+    Uint32Array \
+    Uint8Array \
     ValidityState \
+    WaveShaperNode \
+    WebGLActiveInfo \
+    WebGLBuffer \
+    WebGLContextAttributes \
+    WebGLContextEvent \
+    WebGLFramebuffer \
+    WebGLProgram \
+    WebGLRenderbuffer \
+    WebGLRenderingContext \
+    WebGLShader \
+    WebGLTexture \
+    WebGLUniformLocation \
+    WebGLVertexArrayObjectOES \
     WebKitAnimation \
     WebKitAnimationEvent \
     WebKitAnimationList \
+    WebKitBlobBuilder \
     WebKitCSSKeyframeRule \
     WebKitCSSKeyframesRule \
     WebKitCSSMatrix \
     WebKitCSSTransformValue \
+    WebKitFlags \
     WebKitLoseContext \
     WebKitPoint \
     WebKitTransitionEvent \
index 6294aa7..0498b99 100644 (file)
                BC275B7D11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC275B7C11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp */; };
                BC275B8111C5D2B400C9206C /* JSEventSourceCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC275B8011C5D2B400C9206C /* JSEventSourceCustom.cpp */; };
                BC275CB311C5E85C00C9206C /* JSArrayBufferCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC275CB211C5E85C00C9206C /* JSArrayBufferCustom.cpp */; };
+               BC2CBF4E140F1ABD003879BE /* JSWebGLContextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2CBF4B140F1A65003879BE /* JSWebGLContextEvent.h */; };
+               BC2CBF7B140F1D58003879BE /* JSWebGLContextEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2CBF7A140F1D58003879BE /* JSWebGLContextEvent.cpp */; };
                BC2CC8DF0F32881000A9DF26 /* RenderObjectChildList.h in Headers */ = {isa = PBXBuildFile; fileRef = BC2CC8DE0F32881000A9DF26 /* RenderObjectChildList.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC2ED5550C6B9BD300920BFF /* JSElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */; };
                BC2ED6BC0C6BD2F000920BFF /* JSAttrCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */; };
                BC275B7C11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSMatrixCustom.cpp; sourceTree = "<group>"; };
                BC275B8011C5D2B400C9206C /* JSEventSourceCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSourceCustom.cpp; sourceTree = "<group>"; };
                BC275CB211C5E85C00C9206C /* JSArrayBufferCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSArrayBufferCustom.cpp; sourceTree = "<group>"; };
+               BC2CBF4B140F1A65003879BE /* JSWebGLContextEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLContextEvent.h; sourceTree = "<group>"; };
+               BC2CBF7A140F1D58003879BE /* JSWebGLContextEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLContextEvent.cpp; sourceTree = "<group>"; };
                BC2CC8DE0F32881000A9DF26 /* RenderObjectChildList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderObjectChildList.h; sourceTree = "<group>"; };
                BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSElementCustom.cpp; sourceTree = "<group>"; };
                BC2ED6BB0C6BD2F000920BFF /* JSAttrCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAttrCustom.cpp; sourceTree = "<group>"; };
                                49C7B9811042D2D30009D447 /* JSWebGLBuffer.h */,
                                6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */,
                                6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */,
+                               BC2CBF7A140F1D58003879BE /* JSWebGLContextEvent.cpp */,
+                               BC2CBF4B140F1A65003879BE /* JSWebGLContextEvent.h */,
                                49C7B9841042D2D30009D447 /* JSWebGLFramebuffer.cpp */,
                                49C7B9851042D2D30009D447 /* JSWebGLFramebuffer.h */,
                                49C7B9881042D2D30009D447 /* JSWebGLProgram.cpp */,
                                B10B6980140C174000BC1C26 /* WebVTTToken.h in Headers */,
                                B10B6982140C174000BC1C26 /* WebVTTTokenizer.h in Headers */,
                                9B0FB192140DB5790022588F /* HTTPValidation.h in Headers */,
+                               BC2CBF4E140F1ABD003879BE /* JSWebGLContextEvent.h in Headers */,
                                BC274B2F140EBEB200EADFA6 /* CSSBorderImageSliceValue.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                                E45322AB140CE267005A0F92 /* SelectorQuery.cpp in Sources */,
                                B10B6981140C174000BC1C26 /* WebVTTTokenizer.cpp in Sources */,
                                9B0FB191140DB5790022588F /* HTTPValidation.cpp in Sources */,
+                               BC2CBF7B140F1D58003879BE /* JSWebGLContextEvent.cpp in Sources */,
                                BC274B31140EBED800EADFA6 /* CSSBorderImageSliceValue.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
index da62a67..9958cb6 100644 (file)
 #include "MediaStreamEvent.h"
 #endif
 
+#if ENABLE(WEBGL)
+#include "JSWebGLContextEvent.h"
+#include "WebGLContextEvent.h"
+#endif
+
 using namespace JSC;
 
 namespace WebCore {
@@ -217,6 +222,10 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Event* event)
     else if (event->isMediaStreamEvent())
         wrapper = CREATE_DOM_WRAPPER(exec, globalObject, MediaStreamEvent, event);
 #endif
+#if ENABLE(WEBGL)
+    else if (event->isWebGLContextEvent())
+        wrapper = CREATE_DOM_WRAPPER(exec, globalObject, WebGLContextEvent, event);
+#endif
     else
         wrapper = CREATE_DOM_WRAPPER(exec, globalObject, Event, event);
 
index f323a64..ffd04de 100644 (file)
@@ -279,6 +279,14 @@ bool Event::isMediaStreamEvent() const
 }
 #endif
 
+#if ENABLE(WEBGL)
+bool Event::isWebGLContextEvent() const
+{
+    return false;
+}
+#endif
+
+
 bool Event::storesResultAsString() const
 {
     return false;
index 157659d..0ad7913 100644 (file)
@@ -163,6 +163,10 @@ namespace WebCore {
 #if ENABLE(MEDIA_STREAM)
         virtual bool isMediaStreamEvent() const;
 #endif
+#if ENABLE(WEBGL)
+        virtual bool isWebGLContextEvent() const;
+#endif
+
         bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; }
         bool immediatePropagationStopped() const { return m_immediatePropagationStopped; }
 
index b7a277f..b09de63 100644 (file)
@@ -51,4 +51,9 @@ void WebGLContextEvent::initEvent(const AtomicString& type, bool canBubble, bool
     m_statusMessage = statusMessage;
 }
 
+bool WebGLContextEvent::isWebGLContextEvent() const
+{
+    return true;
+}
+
 } // namespace WebCore
index 348769b..ac82d5e 100644 (file)
@@ -44,6 +44,8 @@ public:
 
     void initEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& statusMessage);
 
+    virtual bool isWebGLContextEvent() const;
+
     const String& statusMessage() const { return m_statusMessage; }
 
 private: