Title: [146795] trunk
Revision
146795
Author
commit-qu...@webkit.org
Date
2013-03-25 12:05:57 -0700 (Mon, 25 Mar 2013)

Log Message

Enabled canvas.getContext("webgl") on Desktop Chrome
https://bugs.webkit.org/show_bug.cgi?id=113079

Patch by Brandon Jones <bajo...@chromium.org> on 2013-03-25
Reviewed by Dean Jackson.

Test: fast/canvas/webgl/webgl-unprefixed-context-id.html

* bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
(WebCore::V8HTMLCanvasElement::getContextMethodCustom):
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getContext):

Modified Paths

Added Paths

Diff

Added: trunk/LayoutTests/fast/canvas/webgl/webgl-unprefixed-context-id-expected.txt (0 => 146795)


--- trunk/LayoutTests/fast/canvas/webgl/webgl-unprefixed-context-id-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl-unprefixed-context-id-expected.txt	2013-03-25 19:05:57 UTC (rev 146795)
@@ -0,0 +1,10 @@
+This test checks to ensure that a webgl context can be created with the 'webgl' context ID
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+FAIL context does not exist
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/canvas/webgl/webgl-unprefixed-context-id.html (0 => 146795)


--- trunk/LayoutTests/fast/canvas/webgl/webgl-unprefixed-context-id.html	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/webgl-unprefixed-context-id.html	2013-03-25 19:05:57 UTC (rev 146795)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<canvas id="c"></canvas>
+<script>
+description("This test checks to ensure that a webgl context can be created with the 'webgl' context ID");
+var c = document.getElementById("c");
+var gl = c.getContext("webgl");
+if (!gl)
+  testFailed("context does not exist");
+else
+  testPassed("context exists");
+</script>
+</body>
+<script src=""
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/platform/chromium/fast/canvas/webgl/webgl-unprefixed-context-id-expected.txt (0 => 146795)


--- trunk/LayoutTests/platform/chromium/fast/canvas/webgl/webgl-unprefixed-context-id-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/chromium/fast/canvas/webgl/webgl-unprefixed-context-id-expected.txt	2013-03-25 19:05:57 UTC (rev 146795)
@@ -0,0 +1,10 @@
+This test checks to ensure that a webgl context can be created with the 'webgl' context ID
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS context exists
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/Source/WebCore/ChangeLog (146794 => 146795)


--- trunk/Source/WebCore/ChangeLog	2013-03-25 18:51:52 UTC (rev 146794)
+++ trunk/Source/WebCore/ChangeLog	2013-03-25 19:05:57 UTC (rev 146795)
@@ -1,3 +1,17 @@
+2013-03-25  Brandon Jones  <bajo...@chromium.org>
+
+        Enabled canvas.getContext("webgl") on Desktop Chrome
+        https://bugs.webkit.org/show_bug.cgi?id=113079
+
+        Reviewed by Dean Jackson.
+
+        Test: fast/canvas/webgl/webgl-unprefixed-context-id.html
+
+        * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
+        (WebCore::V8HTMLCanvasElement::getContextMethodCustom):
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::getContext):
+
 2013-03-25  Roger Fong  <roger_f...@apple.com>
 
         Unreviewed. Remove some suspicious looking code in an attempt to fix EWS bots.

Modified: trunk/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp (146794 => 146795)


--- trunk/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp	2013-03-25 18:51:52 UTC (rev 146794)
+++ trunk/Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp	2013-03-25 19:05:57 UTC (rev 146795)
@@ -55,7 +55,7 @@
     String contextId = toWebCoreString(args[0]);
     RefPtr<CanvasContextAttributes> attrs;
 #if ENABLE(WEBGL)
-    if (contextId == "experimental-webgl" || contextId == "webkit-3d") {
+    if (contextId == "webgl" || contextId == "experimental-webgl" || contextId == "webkit-3d") {
         attrs = WebGLContextAttributes::create();
         WebGLContextAttributes* webGLAttrs = static_cast<WebGLContextAttributes*>(attrs.get());
         if (args.Length() > 1 && args[1]->IsObject()) {

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (146794 => 146795)


--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2013-03-25 18:51:52 UTC (rev 146794)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2013-03-25 19:05:57 UTC (rev 146795)
@@ -193,10 +193,16 @@
         && settings->acceleratedCompositingEnabled()
 #endif
         ) {
+
         // Accept the legacy "webkit-3d" name as well as the provisional "experimental-webgl" name.
-        // Once ratified, we will also accept "webgl" as the context name.
-        if ((type == "webkit-3d") ||
-            (type == "experimental-webgl")) {
+        bool is3dContext = (type == "webkit-3d") || (type == "experimental-webgl");
+
+#if PLATFORM(CHROMIUM) && !OS(ANDROID)
+        // Now that WebGL is ratified, we will also accept "webgl" as the context name in Chrome.
+        is3dContext |= (type == "webgl");
+#endif
+
+        if (is3dContext) {
             if (m_context && !m_context->is3d())
                 return 0;
             if (!m_context) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to