[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 01:05:06 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 70260e12f4b9b113569bcb60a0045fa29531ddf4
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 14 05:50:45 2010 +0000

    2010-01-13  Kenneth Russell  <kbr at google.com>
    
            Reviewed by Oliver Hunt.
    
            Need to implement WebGLContextAttributes
            https://bugs.webkit.org/show_bug.cgi?id=31169
    
            Added the WebGLContextAttributes class and custom JavaScript
            bindings to accept a native object as the second argument to
            getContext("experimental-webgl") per the WebGL specification.
            Added GraphicsContext3D::Attributes struct to isolate DOM and
            graphics layers. Added getContextAttributes() to
            WebGLRenderingContext. Added test case ensuring that context
            attributes can be passed down and returned. Tested in Safari and
            Chromium. The attributes will be hooked up to the creation of the
            OpenGL context in bug 33416.
    
            * fast/canvas/webgl/context-attributes-expected.txt: Added.
            * fast/canvas/webgl/context-attributes.html: Added.
            * fast/canvas/webgl/resources/webgl-test.js:
            (create3DContext):
    2010-01-13  Kenneth Russell  <kbr at google.com>
    
            Reviewed by Oliver Hunt.
    
            Need to implement WebGLContextAttributes
            https://bugs.webkit.org/show_bug.cgi?id=31169
    
            Added the WebGLContextAttributes class and custom JavaScript
            bindings to accept a native object as the second argument to
            getContext("experimental-webgl") per the WebGL specification.
            Added GraphicsContext3D::Attributes struct to isolate DOM and
            graphics layers. Added getContextAttributes() to
            WebGLRenderingContext. Added test case ensuring that context
            attributes can be passed down and returned. Tested in Safari and
            Chromium. The attributes will be hooked up to the creation of the
            OpenGL context in bug 33416.
    
            Test: fast/canvas/webgl/context-attributes.html
    
            * DerivedSources.make:
            * WebCore.gypi:
            * WebCore.xcodeproj/project.pbxproj:
            * bindings/js/JSHTMLCanvasElementCustom.cpp:
            (WebCore::JSHTMLCanvasElement::getContext):
            * bindings/scripts/CodeGeneratorV8.pm:
            * bindings/scripts/IDLParser.pm:
            * bindings/v8/DOMData.cpp:
            * bindings/v8/DerivedSourcesAllInOne.cpp:
            * bindings/v8/V8DOMWrapper.cpp:
            * bindings/v8/V8Index.cpp:
            * bindings/v8/V8Index.h:
            * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
            (WebCore::V8HTMLCanvasElement::getContextCallback):
            * html/HTMLCanvasElement.cpp:
            (WebCore::HTMLCanvasElement::getContext):
            * html/HTMLCanvasElement.h:
            * html/HTMLCanvasElement.idl:
            * html/canvas/CanvasContextAttributes.cpp: Added.
            (WebCore::CanvasContextAttributes::CanvasContextAttributes):
            (WebCore::CanvasContextAttributes::~CanvasContextAttributes):
            * html/canvas/CanvasContextAttributes.h: Added.
            * html/canvas/WebGLContextAttributes.cpp: Added.
            (WebCore::WebGLContextAttributes::create):
            (WebCore::WebGLContextAttributes::WebGLContextAttributes):
            (WebCore::WebGLContextAttributes::~WebGLContextAttributes):
            (WebCore::WebGLContextAttributes::alpha):
            (WebCore::WebGLContextAttributes::setAlpha):
            (WebCore::WebGLContextAttributes::depth):
            (WebCore::WebGLContextAttributes::setDepth):
            (WebCore::WebGLContextAttributes::stencil):
            (WebCore::WebGLContextAttributes::setStencil):
            (WebCore::WebGLContextAttributes::antialias):
            (WebCore::WebGLContextAttributes::setAntialias):
            (WebCore::WebGLContextAttributes::premultipliedAlpha):
            (WebCore::WebGLContextAttributes::setPremultipliedAlpha):
            (WebCore::WebGLContextAttributes::attributes):
            * html/canvas/WebGLContextAttributes.h: Added.
            * html/canvas/WebGLContextAttributes.idl: Added.
            * html/canvas/WebGLRenderingContext.cpp:
            (WebCore::WebGLRenderingContext::create):
            (WebCore::WebGLRenderingContext::getContextAttributes):
            * html/canvas/WebGLRenderingContext.h:
            * html/canvas/WebGLRenderingContext.idl:
            * platform/graphics/GraphicsContext3D.h:
            * platform/graphics/mac/GraphicsContext3DMac.cpp:
            (WebCore::GraphicsContext3D::create):
            (WebCore::GraphicsContext3D::GraphicsContext3D):
            (WebCore::GraphicsContext3D::getContextAttributes):
    2010-01-13  Kenneth Russell  <kbr at google.com>
    
            Reviewed by Oliver Hunt.
    
            Need to implement WebGLContextAttributes
            https://bugs.webkit.org/show_bug.cgi?id=31169
    
            Added the WebGLContextAttributes class and custom JavaScript
            bindings to accept a native object as the second argument to
            getContext("experimental-webgl") per the WebGL specification.
            Added GraphicsContext3D::Attributes struct to isolate DOM and
            graphics layers. Added getContextAttributes() to
            WebGLRenderingContext. Added test case ensuring that context
            attributes can be passed down and returned. Tested in Safari and
            Chromium. The attributes will be hooked up to the creation of the
            OpenGL context in bug 33416.
    
            * src/GraphicsContext3D.cpp:
            (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
            (WebCore::GraphicsContext3DInternal::getContextAttributes):
            (WebCore::GraphicsContext3D::create):
            (WebCore::GraphicsContext3D::GraphicsContext3D):
            (WebCore::GraphicsContext3D::getContextAttributes):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53238 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 902ff3a..1047eef 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,25 @@
+2010-01-13  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Oliver Hunt.
+
+        Need to implement WebGLContextAttributes
+        https://bugs.webkit.org/show_bug.cgi?id=31169
+
+        Added the WebGLContextAttributes class and custom JavaScript
+        bindings to accept a native object as the second argument to
+        getContext("experimental-webgl") per the WebGL specification.
+        Added GraphicsContext3D::Attributes struct to isolate DOM and
+        graphics layers. Added getContextAttributes() to
+        WebGLRenderingContext. Added test case ensuring that context
+        attributes can be passed down and returned. Tested in Safari and
+        Chromium. The attributes will be hooked up to the creation of the
+        OpenGL context in bug 33416.
+
+        * fast/canvas/webgl/context-attributes-expected.txt: Added.
+        * fast/canvas/webgl/context-attributes.html: Added.
+        * fast/canvas/webgl/resources/webgl-test.js:
+        (create3DContext):
+
 2010-01-13  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/LayoutTests/fast/canvas/webgl/context-attributes-expected.txt b/LayoutTests/fast/canvas/webgl/context-attributes-expected.txt
new file mode 100644
index 0000000..d963c65
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/context-attributes-expected.txt
@@ -0,0 +1,24 @@
+Test passing down and fetching of WebGLContextAttributes
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+Test default values
+PASS context = create3DContext() is non-null.
+PASS attribs = context.getContextAttributes() is non-null.
+PASS attribs.depth is true
+PASS attribs.alpha is true
+PASS (attribs.stencil == true || attribs.stencil == false) is true
+PASS (attribs.antialias == true || attribs.antialias == false) is true
+PASS attribs.premultipliedAlpha is true
+Test customized values
+PASS context = create3DContext({ stencil: false, antialias: false }) is non-null.
+PASS attribs = context.getContextAttributes() is non-null.
+PASS attribs.depth is true
+PASS attribs.alpha is true
+PASS attribs.stencil is false
+PASS attribs.antialias is false
+PASS attribs.premultipliedAlpha is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/webgl/context-attributes.html b/LayoutTests/fast/canvas/webgl/context-attributes.html
new file mode 100644
index 0000000..7e3949a
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/context-attributes.html
@@ -0,0 +1,40 @@
+<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>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+
+<script>
+description("Test passing down and fetching of WebGLContextAttributes");
+
+debug("Test default values");
+var context;
+var attribs;
+shouldBeNonNull("context = create3DContext()");
+shouldBeNonNull("attribs = context.getContextAttributes()");
+shouldBe("attribs.depth", "true");
+shouldBe("attribs.alpha", "true");
+// The following two depend on whether the implementation actually supports them
+shouldBe("(attribs.stencil == true || attribs.stencil == false)", "true");
+shouldBe("(attribs.antialias == true || attribs.antialias == false)", "true");
+shouldBe("attribs.premultipliedAlpha", "true");
+
+debug ("Test customized values");
+shouldBeNonNull("context = create3DContext({ stencil: false, antialias: false })");
+shouldBeNonNull("attribs = context.getContextAttributes()");
+shouldBe("attribs.depth", "true");
+shouldBe("attribs.alpha", "true");
+shouldBe("attribs.stencil", "false");
+shouldBe("attribs.antialias", "false");
+shouldBe("attribs.premultipliedAlpha", "true");
+
+successfullyParsed = true;
+</script>
+
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/canvas/webgl/resources/webgl-test.js b/LayoutTests/fast/canvas/webgl/resources/webgl-test.js
index 4af528c..1540422 100644
--- a/LayoutTests/fast/canvas/webgl/resources/webgl-test.js
+++ b/LayoutTests/fast/canvas/webgl/resources/webgl-test.js
@@ -8,12 +8,12 @@ function getShaderSource(file) {
     return xhr.responseText;
 }
 
-function create3DContext() {
+function create3DContext(attrs) {
     var canvas = document.createElement("canvas");
     try {
-        return canvas.getContext("experimental-webgl");
+        return canvas.getContext("experimental-webgl", attrs);
     } catch(e) {}
-    return canvas.getContext("moz-webgl");
+    return canvas.getContext("moz-webgl", attrs);
 }
 
 function createGLErrorWrapper(context, fname) {
@@ -26,8 +26,8 @@ function createGLErrorWrapper(context, fname) {
     };
 }
 
-function create3DDebugContext() {
-    var context = create3DContext();
+function create3DDebugContext(attrs) {
+    var context = create3DContext(attrs);
     // Thanks to Ilmari Heikkinen for the idea on how to implement this so elegantly.
     var wrap = {};
     for (var i in context) {
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 5af6909..56ed207 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,72 @@
+2010-01-13  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Oliver Hunt.
+
+        Need to implement WebGLContextAttributes
+        https://bugs.webkit.org/show_bug.cgi?id=31169
+
+        Added the WebGLContextAttributes class and custom JavaScript
+        bindings to accept a native object as the second argument to
+        getContext("experimental-webgl") per the WebGL specification.
+        Added GraphicsContext3D::Attributes struct to isolate DOM and
+        graphics layers. Added getContextAttributes() to
+        WebGLRenderingContext. Added test case ensuring that context
+        attributes can be passed down and returned. Tested in Safari and
+        Chromium. The attributes will be hooked up to the creation of the
+        OpenGL context in bug 33416.
+
+        Test: fast/canvas/webgl/context-attributes.html
+
+        * DerivedSources.make:
+        * WebCore.gypi:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSHTMLCanvasElementCustom.cpp:
+        (WebCore::JSHTMLCanvasElement::getContext):
+        * bindings/scripts/CodeGeneratorV8.pm:
+        * bindings/scripts/IDLParser.pm:
+        * bindings/v8/DOMData.cpp:
+        * bindings/v8/DerivedSourcesAllInOne.cpp:
+        * bindings/v8/V8DOMWrapper.cpp:
+        * bindings/v8/V8Index.cpp:
+        * bindings/v8/V8Index.h:
+        * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
+        (WebCore::V8HTMLCanvasElement::getContextCallback):
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::getContext):
+        * html/HTMLCanvasElement.h:
+        * html/HTMLCanvasElement.idl:
+        * html/canvas/CanvasContextAttributes.cpp: Added.
+        (WebCore::CanvasContextAttributes::CanvasContextAttributes):
+        (WebCore::CanvasContextAttributes::~CanvasContextAttributes):
+        * html/canvas/CanvasContextAttributes.h: Added.
+        * html/canvas/WebGLContextAttributes.cpp: Added.
+        (WebCore::WebGLContextAttributes::create):
+        (WebCore::WebGLContextAttributes::WebGLContextAttributes):
+        (WebCore::WebGLContextAttributes::~WebGLContextAttributes):
+        (WebCore::WebGLContextAttributes::alpha):
+        (WebCore::WebGLContextAttributes::setAlpha):
+        (WebCore::WebGLContextAttributes::depth):
+        (WebCore::WebGLContextAttributes::setDepth):
+        (WebCore::WebGLContextAttributes::stencil):
+        (WebCore::WebGLContextAttributes::setStencil):
+        (WebCore::WebGLContextAttributes::antialias):
+        (WebCore::WebGLContextAttributes::setAntialias):
+        (WebCore::WebGLContextAttributes::premultipliedAlpha):
+        (WebCore::WebGLContextAttributes::setPremultipliedAlpha):
+        (WebCore::WebGLContextAttributes::attributes):
+        * html/canvas/WebGLContextAttributes.h: Added.
+        * html/canvas/WebGLContextAttributes.idl: Added.
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::create):
+        (WebCore::WebGLRenderingContext::getContextAttributes):
+        * html/canvas/WebGLRenderingContext.h:
+        * html/canvas/WebGLRenderingContext.idl:
+        * platform/graphics/GraphicsContext3D.h:
+        * platform/graphics/mac/GraphicsContext3DMac.cpp:
+        (WebCore::GraphicsContext3D::create):
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        (WebCore::GraphicsContext3D::getContextAttributes):
+
 2010-01-13  Simon Fraser  <simon.fraser at apple.com>
 
         Fix Windows build.
diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make
index 6bc4542..d8dc976 100644
--- a/WebCore/DerivedSources.make
+++ b/WebCore/DerivedSources.make
@@ -75,6 +75,7 @@ DOM_CLASSES = \
     WebGLArrayBuffer \
     WebGLBuffer \
     WebGLByteArray \
+    WebGLContextAttributes \
     WebGLFloatArray \
     WebGLFramebuffer \
     CanvasGradient \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 6601347..3ba8dcd 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -83,6 +83,7 @@
             'html/canvas/WebGLArrayBuffer.idl',
             'html/canvas/WebGLBuffer.idl',
             'html/canvas/WebGLByteArray.idl',
+            'html/canvas/WebGLContextAttributes.idl',
             'html/canvas/WebGLFloatArray.idl',
             'html/canvas/WebGLFramebuffer.idl',
             'html/canvas/CanvasGradient.idl',
@@ -1302,12 +1303,16 @@
             'html/canvas/WebGLBuffer.h',
             'html/canvas/WebGLByteArray.cpp',
             'html/canvas/WebGLByteArray.h',
+            'html/canvas/WebGLContextAttributes.cpp',
+            'html/canvas/WebGLContextAttributes.h',
             'html/canvas/WebGLFloatArray.cpp',
             'html/canvas/WebGLFloatArray.h',
             'html/canvas/WebGLFramebuffer.cpp',
             'html/canvas/WebGLFramebuffer.h',
             'html/canvas/WebGLGetInfo.cpp',
             'html/canvas/WebGLGetInfo.h',
+            'html/canvas/CanvasContextAttributes.cpp',
+            'html/canvas/CanvasContextAttributes.h',
             'html/canvas/CanvasGradient.cpp',
             'html/canvas/CanvasGradient.h',
             'html/canvas/WebGLIntArray.cpp',
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 312b75b..14c4257 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -1224,6 +1224,13 @@
 		65FEA86909833ADE00BED4AB /* Page.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FEA86809833ADE00BED4AB /* Page.cpp */; };
 		6E47E66010B7944B00B186C8 /* WebGLGetInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */; };
 		6E47E66110B7944B00B186C8 /* WebGLGetInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */; };
+		6E4E91AC10F7FB3100A2779C /* CanvasContextAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E4E91A710F7FB3100A2779C /* CanvasContextAttributes.cpp */; };
+		6E4E91AD10F7FB3100A2779C /* CanvasContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E4E91A810F7FB3100A2779C /* CanvasContextAttributes.h */; };
+		6E4E91AE10F7FB3100A2779C /* WebGLContextAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E4E91A910F7FB3100A2779C /* WebGLContextAttributes.cpp */; };
+		6E4E91AF10F7FB3100A2779C /* WebGLContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E4E91AA10F7FB3100A2779C /* WebGLContextAttributes.h */; };
+		6E4E91B010F7FB3100A2779C /* WebGLContextAttributes.idl in Resources */ = {isa = PBXBuildFile; fileRef = 6E4E91AB10F7FB3100A2779C /* WebGLContextAttributes.idl */; };
+		6EE8A77210F803F3005A4A24 /* JSWebGLContextAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */; };
+		6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */; };
 		72626E020EF022FE00A07E20 /* FontFastPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72626E010EF022FE00A07E20 /* FontFastPath.cpp */; };
 		754133A8102E00E800075D00 /* InspectorTimelineAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 754133A7102E00E800075D00 /* InspectorTimelineAgent.h */; };
 		754133AA102E00F400075D00 /* InspectorTimelineAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */; };
@@ -6579,6 +6586,13 @@
 		65FEA86809833ADE00BED4AB /* Page.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Page.cpp; sourceTree = "<group>"; };
 		6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLGetInfo.cpp; path = canvas/WebGLGetInfo.cpp; sourceTree = "<group>"; };
 		6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLGetInfo.h; path = canvas/WebGLGetInfo.h; sourceTree = "<group>"; };
+		6E4E91A710F7FB3100A2779C /* CanvasContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CanvasContextAttributes.cpp; path = canvas/CanvasContextAttributes.cpp; sourceTree = "<group>"; };
+		6E4E91A810F7FB3100A2779C /* CanvasContextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CanvasContextAttributes.h; path = canvas/CanvasContextAttributes.h; sourceTree = "<group>"; };
+		6E4E91A910F7FB3100A2779C /* WebGLContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLContextAttributes.cpp; path = canvas/WebGLContextAttributes.cpp; sourceTree = "<group>"; };
+		6E4E91AA10F7FB3100A2779C /* WebGLContextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLContextAttributes.h; path = canvas/WebGLContextAttributes.h; sourceTree = "<group>"; };
+		6E4E91AB10F7FB3100A2779C /* WebGLContextAttributes.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLContextAttributes.idl; path = canvas/WebGLContextAttributes.idl; sourceTree = "<group>"; };
+		6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLContextAttributes.cpp; sourceTree = "<group>"; };
+		6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLContextAttributes.h; sourceTree = "<group>"; };
 		72626E010EF022FE00A07E20 /* FontFastPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFastPath.cpp; sourceTree = "<group>"; };
 		754133A7102E00E800075D00 /* InspectorTimelineAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorTimelineAgent.h; sourceTree = "<group>"; };
 		754133A9102E00F400075D00 /* InspectorTimelineAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorTimelineAgent.cpp; sourceTree = "<group>"; };
@@ -10734,6 +10748,8 @@
 		49484FAE102CF01E00187DD3 /* canvas */ = {
 			isa = PBXGroup;
 			children = (
+				6E4E91A710F7FB3100A2779C /* CanvasContextAttributes.cpp */,
+				6E4E91A810F7FB3100A2779C /* CanvasContextAttributes.h */,
 				A7D20F6B107F438B00A80392 /* WebGLActiveInfo.h */,
 				A7D20F3B107F373800A80392 /* WebGLActiveInfo.idl */,
 				49EECDC710503C2300099FAB /* WebGLArray.cpp */,
@@ -10748,6 +10764,9 @@
 				49C7B9AB1042D32E0009D447 /* WebGLByteArray.cpp */,
 				49C7B9AC1042D32E0009D447 /* WebGLByteArray.h */,
 				49C7B9AD1042D32E0009D447 /* WebGLByteArray.idl */,
+				6E4E91A910F7FB3100A2779C /* WebGLContextAttributes.cpp */,
+				6E4E91AA10F7FB3100A2779C /* WebGLContextAttributes.h */,
+				6E4E91AB10F7FB3100A2779C /* WebGLContextAttributes.idl */,
 				49EECDCD10503C2300099FAB /* WebGLFloatArray.cpp */,
 				49EECDCE10503C2300099FAB /* WebGLFloatArray.h */,
 				49EECDCF10503C2300099FAB /* WebGLFloatArray.idl */,
@@ -12947,6 +12966,8 @@
 				49C7B9811042D2D30009D447 /* JSWebGLBuffer.h */,
 				49C7B9821042D2D30009D447 /* JSWebGLByteArray.cpp */,
 				49C7B9831042D2D30009D447 /* JSWebGLByteArray.h */,
+				6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */,
+				6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */,
 				49EECEF4105070C400099FAB /* JSWebGLFloatArray.cpp */,
 				49EECEF5105070C400099FAB /* JSWebGLFloatArray.h */,
 				49C7B9841042D2D30009D447 /* JSWebGLFramebuffer.cpp */,
@@ -18325,6 +18346,9 @@
 				0F5B7A5510F65D7A00376302 /* RenderEmbeddedObject.h in Headers */,
 				CE4C00E610F6F7C100CA38F5 /* HTMLNoScriptElement.h in Headers */,
 				087D97BF10FB8D7700C00874 /* JSSVGPODListCustom.h in Headers */,
+				6E4E91AD10F7FB3100A2779C /* CanvasContextAttributes.h in Headers */,
+				6E4E91AF10F7FB3100A2779C /* WebGLContextAttributes.h in Headers */,
+				6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -18425,6 +18449,7 @@
 				85136CA80AED665900F90A3D /* westResizeCursor.png in Resources */,
 				1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */,
 				1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */,
+				6E4E91B010F7FB3100A2779C /* WebGLContextAttributes.idl in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -20485,6 +20510,9 @@
 				5112247810CFB8F4008099D7 /* WorkerThreadableWebSocketChannel.cpp in Sources */,
 				0F5B7A5410F65D7A00376302 /* RenderEmbeddedObject.cpp in Sources */,
 				CE4C00E410F6F7BA00CA38F5 /* HTMLNoScriptElement.cpp in Sources */,
+				6E4E91AC10F7FB3100A2779C /* CanvasContextAttributes.cpp in Sources */,
+				6E4E91AE10F7FB3100A2779C /* WebGLContextAttributes.cpp in Sources */,
+				6EE8A77210F803F3005A4A24 /* JSWebGLContextAttributes.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp b/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
index 751e7de..80634f7 100644
--- a/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
+++ b/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
@@ -26,10 +26,12 @@
 #include "config.h"
 #include "JSHTMLCanvasElement.h"
 
+#include "CanvasContextAttributes.h"
 #include "HTMLCanvasElement.h"
 #include "JSCanvasRenderingContext2D.h"
 #if ENABLE(3D_CANVAS)
 #include "JSWebGLRenderingContext.h"
+#include "WebGLContextAttributes.h"
 #endif
 #include <wtf/GetPtr.h>
 
@@ -47,4 +49,36 @@ void JSHTMLCanvasElement::markChildren(MarkStack& markStack)
     markDOMObjectWrapper(markStack, globalData, canvas->renderingContext());
 }
 
+JSValue JSHTMLCanvasElement::getContext(ExecState* exec, const ArgList& args)
+{
+    HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl());
+    const UString& contextId = args.at(0).toString(exec);
+    RefPtr<CanvasContextAttributes> attrs;
+#if ENABLE(3D_CANVAS)
+    if (contextId == "experimental-webgl" || contextId == "webkit-3d") {
+        attrs = WebGLContextAttributes::create();
+        WebGLContextAttributes* webGLAttrs = static_cast<WebGLContextAttributes*>(attrs.get());
+        if (args.size() > 1 && args.at(1).isObject()) {
+            JSObject* jsAttrs = args.at(1).getObject();
+            Identifier alpha(exec, "alpha");
+            if (jsAttrs->hasProperty(exec, alpha))
+                webGLAttrs->setAlpha(jsAttrs->get(exec, alpha).toBoolean(exec));
+            Identifier depth(exec, "depth");
+            if (jsAttrs->hasProperty(exec, depth))
+                webGLAttrs->setDepth(jsAttrs->get(exec, depth).toBoolean(exec));
+            Identifier stencil(exec, "stencil");
+            if (jsAttrs->hasProperty(exec, stencil))
+                webGLAttrs->setStencil(jsAttrs->get(exec, stencil).toBoolean(exec));
+            Identifier antialias(exec, "antialias");
+            if (jsAttrs->hasProperty(exec, antialias))
+                webGLAttrs->setAntialias(jsAttrs->get(exec, antialias).toBoolean(exec));
+            Identifier premultipliedAlpha(exec, "premultipliedAlpha");
+            if (jsAttrs->hasProperty(exec, premultipliedAlpha))
+                webGLAttrs->setPremultipliedAlpha(jsAttrs->get(exec, premultipliedAlpha).toBoolean(exec));
+        }
+    }
+#endif
+    return toJS(exec, globalObject(), WTF::getPtr(canvas->getContext(contextId, attrs.get())));
+}
+
 } // namespace WebCore
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index ff24086..0915522 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -2181,6 +2181,7 @@ my %typeCanFailConversion = (
     "WebGLArray" => 0,
     "WebGLBuffer" => 0,
     "WebGLByteArray" => 0,
+    "WebGLContextAttributes" => 0,
     "WebGLFloatArray" => 0,
     "WebGLFramebuffer" => 0,
     "CanvasGradient" => 0,
diff --git a/WebCore/bindings/scripts/IDLParser.pm b/WebCore/bindings/scripts/IDLParser.pm
index 74be8a4..b2577d2 100644
--- a/WebCore/bindings/scripts/IDLParser.pm
+++ b/WebCore/bindings/scripts/IDLParser.pm
@@ -371,7 +371,9 @@ sub DetermineParseMode
         $mode = MODE_INTERFACE;
     } elsif ($_ =~ /exception/) {
         $mode = MODE_EXCEPTION;
-    } elsif ($_ =~ /alias/) {
+    } elsif ($_ =~ /(\A|\b)alias/) {
+        # The (\A|\b) above is needed so we don't match attributes
+        # whose names contain the substring "alias".
         $mode = MODE_ALIAS;
     }
 
diff --git a/WebCore/bindings/v8/DOMData.cpp b/WebCore/bindings/v8/DOMData.cpp
index ec9a938..417426f 100644
--- a/WebCore/bindings/v8/DOMData.cpp
+++ b/WebCore/bindings/v8/DOMData.cpp
@@ -33,6 +33,7 @@
 
 #include "ChildThreadDOMData.h"
 #include "MainThreadDOMData.h"
+#include "WebGLContextAttributes.h"
 #include "WebGLUniformLocation.h"
 
 namespace WebCore {
diff --git a/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp b/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp
index 007e0bb..6654412 100644
--- a/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp
+++ b/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp
@@ -43,6 +43,7 @@
 #include "bindings/V8WebGLArrayBuffer.cpp"
 #include "bindings/V8WebGLBuffer.cpp"
 #include "bindings/V8WebGLByteArray.cpp"
+#include "bindings/V8WebGLContextAttributes.cpp"
 #include "bindings/V8WebGLFloatArray.cpp"
 #include "bindings/V8WebGLFramebuffer.cpp"
 #include "bindings/V8CanvasGradient.cpp"
diff --git a/WebCore/bindings/v8/V8DOMWrapper.cpp b/WebCore/bindings/v8/V8DOMWrapper.cpp
index 87926c5..b3bdcfa 100644
--- a/WebCore/bindings/v8/V8DOMWrapper.cpp
+++ b/WebCore/bindings/v8/V8DOMWrapper.cpp
@@ -58,6 +58,7 @@
 #include "V8Proxy.h"
 #include "V8StyleSheet.h"
 #include "WebGLArray.h"
+#include "WebGLContextAttributes.h"
 #include "WebGLUniformLocation.h"
 #include "WorkerContextExecutionProxy.h"
 
diff --git a/WebCore/bindings/v8/V8Index.cpp b/WebCore/bindings/v8/V8Index.cpp
index 3089f8e..69290af 100644
--- a/WebCore/bindings/v8/V8Index.cpp
+++ b/WebCore/bindings/v8/V8Index.cpp
@@ -403,6 +403,7 @@
 #include "V8WebGLArray.h"
 #include "V8WebGLByteArray.h"
 #include "V8WebGLBuffer.h"
+#include "V8WebGLContextAttributes.h"
 #include "V8WebGLFloatArray.h"
 #include "V8WebGLFramebuffer.h"
 #include "V8WebGLIntArray.h"
diff --git a/WebCore/bindings/v8/V8Index.h b/WebCore/bindings/v8/V8Index.h
index 8cacd7a..7fec667 100644
--- a/WebCore/bindings/v8/V8Index.h
+++ b/WebCore/bindings/v8/V8Index.h
@@ -458,6 +458,7 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)();
     V(WEBGLARRAYBUFFER, WebGLArrayBuffer)                               \
     V(WEBGLBUFFER, WebGLBuffer)                                         \
     V(WEBGLBYTEARRAY, WebGLByteArray)                                   \
+    V(WEBGLCONTEXTATTRIBUTES, WebGLContextAttributes)                   \
     V(WEBGLFLOATARRAY, WebGLFloatArray)                                 \
     V(WEBGLFRAMEBUFFER, WebGLFramebuffer)                               \
     V(WEBGLINTARRAY, WebGLIntArray)                                     \
diff --git a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
index 0751b90..9bdaef5 100644
--- a/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
@@ -31,8 +31,10 @@
 #include "config.h"
 #include "V8HTMLCanvasElement.h"
 
+#include "CanvasContextAttributes.h"
 #include "CanvasRenderingContext.h"
 #include "HTMLCanvasElement.h"
+#include "WebGLContextAttributes.h"
 #include "V8Binding.h"
 #include "V8CustomBinding.h"
 #include "V8Node.h"
@@ -46,7 +48,32 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument
     v8::Handle<v8::Object> holder = args.Holder();
     HTMLCanvasElement* imp = V8DOMWrapper::convertDOMWrapperToNode<HTMLCanvasElement>(holder);
     String contextId = toWebCoreString(args[0]);
-    CanvasRenderingContext* result = imp->getContext(contextId);
+    RefPtr<CanvasContextAttributes> attrs;
+#if ENABLE(3D_CANVAS)
+    if (contextId == "experimental-webgl" || contextId == "webkit-3d") {
+        attrs = WebGLContextAttributes::create();
+        WebGLContextAttributes* webGLAttrs = static_cast<WebGLContextAttributes*>(attrs.get());
+        if (args.Length() > 1 && args[0]->IsObject()) {
+            v8::Handle<v8::Object> jsAttrs = args[1]->ToObject();
+            v8::Handle<v8::String> alpha = v8::String::New("alpha");
+            if (jsAttrs->Has(alpha))
+                webGLAttrs->setAlpha(jsAttrs->Get(alpha)->BooleanValue());
+            v8::Handle<v8::String> depth = v8::String::New("depth");
+            if (jsAttrs->Has(depth))
+                webGLAttrs->setDepth(jsAttrs->Get(depth)->BooleanValue());
+            v8::Handle<v8::String> stencil = v8::String::New("stencil");
+            if (jsAttrs->Has(stencil))
+                webGLAttrs->setStencil(jsAttrs->Get(stencil)->BooleanValue());
+            v8::Handle<v8::String> antialias = v8::String::New("antialias");
+            if (jsAttrs->Has(antialias))
+                webGLAttrs->setAntialias(jsAttrs->Get(antialias)->BooleanValue());
+            v8::Handle<v8::String> premultipliedAlpha = v8::String::New("premultipliedAlpha");
+            if (jsAttrs->Has(premultipliedAlpha))
+                webGLAttrs->setPremultipliedAlpha(jsAttrs->Get(premultipliedAlpha)->BooleanValue());
+        }
+    }
+#endif
+    CanvasRenderingContext* result = imp->getContext(contextId, attrs.get());
     if (!result)
         return v8::Undefined();
     if (result->is2d())
@@ -60,4 +87,3 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument
 }
 
 } // namespace WebCore
-
diff --git a/WebCore/html/HTMLCanvasElement.cpp b/WebCore/html/HTMLCanvasElement.cpp
index 1937b67..fd483b0 100644
--- a/WebCore/html/HTMLCanvasElement.cpp
+++ b/WebCore/html/HTMLCanvasElement.cpp
@@ -27,10 +27,12 @@
 #include "config.h"
 #include "HTMLCanvasElement.h"
 
+#include "CanvasContextAttributes.h"
 #include "CanvasGradient.h"
 #include "CanvasPattern.h"
 #include "CanvasRenderingContext2D.h"
 #if ENABLE(3D_CANVAS)    
+#include "WebGLContextAttributes.h"
 #include "WebGLRenderingContext.h"
 #endif
 #include "CanvasStyle.h"
@@ -147,7 +149,7 @@ String HTMLCanvasElement::toDataURL(const String& mimeType, ExceptionCode& ec)
     return buffer()->toDataURL(mimeType);
 }
 
-CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type)
+CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type, CanvasContextAttributes* attrs)
 {
     // A Canvas can either be "2D" or "webgl" but never both. If you request a 2D canvas and the existing
     // context is already 2D, just return that. If the existing context is WebGL, then destroy it
@@ -174,7 +176,7 @@ CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type)
             if (m_context && !m_context->is3d())
                 return 0;
             if (!m_context) {
-                m_context = WebGLRenderingContext::create(this);
+                m_context = WebGLRenderingContext::create(this, static_cast<WebGLContextAttributes*>(attrs));
                 if (m_context) {
                     // Need to make sure a RenderLayer and compositing layer get created for the Canvas
                     setNeedsStyleRecalc(SyntheticStyleChange);
diff --git a/WebCore/html/HTMLCanvasElement.h b/WebCore/html/HTMLCanvasElement.h
index edae9e5..db80396 100644
--- a/WebCore/html/HTMLCanvasElement.h
+++ b/WebCore/html/HTMLCanvasElement.h
@@ -37,6 +37,7 @@
 
 namespace WebCore {
 
+class CanvasContextAttributes;
 class CanvasRenderingContext;
 class FloatPoint;
 class FloatRect;
@@ -68,7 +69,7 @@ public:
 
     String toDataURL(const String& mimeType, ExceptionCode&);
 
-    CanvasRenderingContext* getContext(const String&);
+    CanvasRenderingContext* getContext(const String&, CanvasContextAttributes* attributes = 0);
 
     const IntSize& size() const { return m_size; }
     void setSize(const IntSize& size)
diff --git a/WebCore/html/HTMLCanvasElement.idl b/WebCore/html/HTMLCanvasElement.idl
index 108daf8..ea7f982 100644
--- a/WebCore/html/HTMLCanvasElement.idl
+++ b/WebCore/html/HTMLCanvasElement.idl
@@ -36,7 +36,8 @@ module html {
             raises(DOMException);
 
 #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
-        [V8Custom] DOMObject getContext(in DOMString contextId);
+        // The custom binding is needed to handle context creation attributes.
+        [Custom] DOMObject getContext(in DOMString contextId);
 #endif
 
     };
diff --git a/WebCore/html/canvas/CanvasContextAttributes.cpp b/WebCore/html/canvas/CanvasContextAttributes.cpp
new file mode 100644
index 0000000..d3d0398
--- /dev/null
+++ b/WebCore/html/canvas/CanvasContextAttributes.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "CanvasContextAttributes.h"
+
+namespace WebCore {
+
+CanvasContextAttributes::CanvasContextAttributes()
+{
+}
+
+CanvasContextAttributes::~CanvasContextAttributes()
+{
+}
+
+} // namespace WebCore
diff --git a/WebCore/html/canvas/CanvasContextAttributes.h b/WebCore/html/canvas/CanvasContextAttributes.h
new file mode 100644
index 0000000..97483b3
--- /dev/null
+++ b/WebCore/html/canvas/CanvasContextAttributes.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CanvasContextAttributes_h
+#define CanvasContextAttributes_h
+
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+// A base class for any attributes that are needed which would affect
+// the creation of the Canvas's rendering context. Currently only the
+// WebGLRenderingContext uses this mechanism.
+
+class CanvasContextAttributes : public RefCounted<CanvasContextAttributes> {
+  public:
+    virtual ~CanvasContextAttributes();
+
+  protected:
+    CanvasContextAttributes();
+};
+
+} // namespace WebCore
+
+#endif // CanvasContextAttributes_h
diff --git a/WebCore/html/canvas/WebGLContextAttributes.cpp b/WebCore/html/canvas/WebGLContextAttributes.cpp
new file mode 100644
index 0000000..a0725ca
--- /dev/null
+++ b/WebCore/html/canvas/WebGLContextAttributes.cpp
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(3D_CANVAS)
+
+#include "WebGLContextAttributes.h"
+
+namespace WebCore {
+
+PassRefPtr<WebGLContextAttributes> WebGLContextAttributes::create()
+{
+    return adoptRef(new WebGLContextAttributes());
+}
+
+PassRefPtr<WebGLContextAttributes> WebGLContextAttributes::create(GraphicsContext3D::Attributes attributes)
+{
+    return adoptRef(new WebGLContextAttributes(attributes));
+}
+
+WebGLContextAttributes::WebGLContextAttributes()
+    : CanvasContextAttributes()
+{
+}
+
+WebGLContextAttributes::WebGLContextAttributes(GraphicsContext3D::Attributes attributes)
+    : CanvasContextAttributes()
+    , m_attrs(attributes)
+{
+}
+
+WebGLContextAttributes::~WebGLContextAttributes()
+{
+}
+
+bool WebGLContextAttributes::alpha() const
+{
+    return m_attrs.alpha;
+}
+
+void WebGLContextAttributes::setAlpha(bool alpha)
+{
+    m_attrs.alpha = alpha;
+}
+
+bool WebGLContextAttributes::depth() const
+{
+    return m_attrs.depth;
+}
+
+void WebGLContextAttributes::setDepth(bool depth)
+{
+    m_attrs.depth = depth;
+}
+
+bool WebGLContextAttributes::stencil() const
+{
+    return m_attrs.stencil;
+}
+
+void WebGLContextAttributes::setStencil(bool stencil)
+{
+    m_attrs.stencil = stencil;
+}
+
+bool WebGLContextAttributes::antialias() const
+{
+    return m_attrs.antialias;
+}
+
+void WebGLContextAttributes::setAntialias(bool antialias)
+{
+    m_attrs.antialias = antialias;
+}
+
+bool WebGLContextAttributes::premultipliedAlpha() const
+{
+    return m_attrs.premultipliedAlpha;
+}
+
+void WebGLContextAttributes::setPremultipliedAlpha(bool premultipliedAlpha)
+{
+    m_attrs.premultipliedAlpha = premultipliedAlpha;
+}
+
+GraphicsContext3D::Attributes WebGLContextAttributes::attributes() const
+{
+    return m_attrs;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(3D_CANVAS)
diff --git a/WebCore/html/canvas/WebGLContextAttributes.h b/WebCore/html/canvas/WebGLContextAttributes.h
new file mode 100644
index 0000000..a108605
--- /dev/null
+++ b/WebCore/html/canvas/WebGLContextAttributes.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebGLContextAttributes_h
+#define WebGLContextAttributes_h
+
+#include "CanvasContextAttributes.h"
+#include "GraphicsContext3D.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebCore {
+
+class WebGLContextAttributes : public CanvasContextAttributes {
+  public:
+    virtual ~WebGLContextAttributes();
+
+    // Create a new attributes object
+    static PassRefPtr<WebGLContextAttributes> create();
+
+    // Create a new attributes object initialized with preexisting attributes
+    static PassRefPtr<WebGLContextAttributes> create(GraphicsContext3D::Attributes attributes);
+
+    // Whether or not the drawing buffer has an alpha channel; default=true
+    bool alpha() const;
+    void setAlpha(bool alpha);
+
+    // Whether or not the drawing buffer has a depth buffer; default=true
+    bool depth() const;
+    void setDepth(bool depth);
+
+    // Whether or not the drawing buffer has a stencil buffer; default=true
+    bool stencil() const;
+    void setStencil(bool stencil);
+
+    // Whether or not the drawing buffer is antialiased; default=true
+    bool antialias() const;
+    void setAntialias(bool antialias);
+
+    // Whether or not to treat the values in the drawing buffer as
+    // though their alpha channel has already been multiplied into the
+    // color channels; default=true
+    bool premultipliedAlpha() const;
+    void setPremultipliedAlpha(bool premultipliedAlpha);
+
+    // Fetches a copy of the attributes stored in this object in a
+    // form that can be used to initialize a GraphicsContext3D.
+    GraphicsContext3D::Attributes attributes() const;
+
+  protected:
+    WebGLContextAttributes();
+    WebGLContextAttributes(GraphicsContext3D::Attributes attributes);
+
+  private:
+    GraphicsContext3D::Attributes m_attrs;
+};
+
+} // namespace WebCore
+
+#endif // WebGLContextAttributes_h
diff --git a/WebCore/html/canvas/WebGLContextAttributes.idl b/WebCore/html/canvas/WebGLContextAttributes.idl
new file mode 100644
index 0000000..be2b20c
--- /dev/null
+++ b/WebCore/html/canvas/WebGLContextAttributes.idl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module html {
+    interface [
+        Conditional=3D_CANVAS,
+        OmitConstructor
+    ] WebGLContextAttributes {
+        attribute boolean alpha;
+        attribute boolean depth;
+        attribute boolean stencil;
+        attribute boolean antialias;
+        attribute boolean premultipliedAlpha;
+    };
+}
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index edcd671..6cb3348 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -39,6 +39,7 @@
 #include "RenderLayer.h"
 #include "WebGLActiveInfo.h"
 #include "WebGLBuffer.h"
+#include "WebGLContextAttributes.h"
 #include "WebGLFramebuffer.h"
 #include "WebGLProgram.h"
 #include "WebGLRenderbuffer.h"
@@ -75,9 +76,9 @@ private:
     bool m_changed;
 };
 
-PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElement* canvas)
+PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElement* canvas, WebGLContextAttributes* attrs)
 {
-    OwnPtr<GraphicsContext3D> context(GraphicsContext3D::create());
+    OwnPtr<GraphicsContext3D> context(GraphicsContext3D::create(attrs->attributes()));
     if (!context)
         return 0;
         
@@ -877,6 +878,13 @@ WebGLGetInfo WebGLRenderingContext::getBufferParameter(unsigned long target, uns
         return WebGLGetInfo(static_cast<unsigned long>(value));
 }
 
+PassRefPtr<WebGLContextAttributes> WebGLRenderingContext::getContextAttributes()
+{
+    // We always need to return a new WebGLContextAttributes object to
+    // prevent the user from mutating any cached version.
+    return WebGLContextAttributes::create(m_context->getContextAttributes());
+}
+
 unsigned long WebGLRenderingContext::getError()
 {
     return m_context->getError();
diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h
index 2b3d593..90d4fab 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.h
+++ b/WebCore/html/canvas/WebGLRenderingContext.h
@@ -39,6 +39,7 @@ namespace WebCore {
 
 class WebGLActiveInfo;
 class WebGLBuffer;
+class WebGLContextAttributes;
 class WebGLFramebuffer;
 class CanvasObject;
 class WebGLProgram;
@@ -53,7 +54,7 @@ class WebKitCSSMatrix;
 
     class WebGLRenderingContext : public CanvasRenderingContext {
     public:
-        static PassOwnPtr<WebGLRenderingContext> create(HTMLCanvasElement*);
+        static PassOwnPtr<WebGLRenderingContext> create(HTMLCanvasElement*, WebGLContextAttributes*);
         virtual ~WebGLRenderingContext();
 
         virtual bool is3d() const { return true; }
@@ -134,6 +135,8 @@ class WebKitCSSMatrix;
 
         WebGLGetInfo getBufferParameter(unsigned long target, unsigned long pname, ExceptionCode&);
 
+        PassRefPtr<WebGLContextAttributes> getContextAttributes();
+
         unsigned long getError();
 
         WebGLGetInfo getFramebufferAttachmentParameter(unsigned long target, unsigned long attachment, unsigned long pname, ExceptionCode&);
diff --git a/WebCore/html/canvas/WebGLRenderingContext.idl b/WebCore/html/canvas/WebGLRenderingContext.idl
index 4ede52d..ce01f43 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.idl
+++ b/WebCore/html/canvas/WebGLRenderingContext.idl
@@ -541,6 +541,8 @@ module html {
         // any getBufferParameter(in unsigned long target, in unsigned long pname) raises(DOMException);
         [Custom] void getBufferParameter();
 
+        WebGLContextAttributes getContextAttributes();
+
         unsigned long getError();
 
         // any getFramebufferAttachmentParameter(in unsigned long target, in unsigned long attachment, in unsigned long pname) raises(DOMException);
diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h
index 8d5a35d..d7406c9 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/WebCore/platform/graphics/GraphicsContext3D.h
@@ -382,7 +382,25 @@ namespace WebCore {
             INVALID_FRAMEBUFFER_OPERATION = 0x0506
         };
         
-        static PassOwnPtr<GraphicsContext3D> create();
+        // Context creation attributes.
+        struct Attributes {
+            Attributes()
+                : alpha(true)
+                , depth(true)
+                , stencil(true)
+                , antialias(true)
+                , premultipliedAlpha(true)
+            {
+            }
+
+            bool alpha;
+            bool depth;
+            bool stencil;
+            bool antialias;
+            bool premultipliedAlpha;
+        };
+
+        static PassOwnPtr<GraphicsContext3D> create(Attributes attrs);
         virtual ~GraphicsContext3D();
 
 #if PLATFORM(MAC)
@@ -459,6 +477,8 @@ namespace WebCore {
 
         void getBufferParameteriv(unsigned long target, unsigned long pname, int* value);
 
+        Attributes getContextAttributes();
+
         unsigned long getError();
 
         void getFloatv(unsigned long pname, float* value);
@@ -602,11 +622,12 @@ namespace WebCore {
         void synthesizeGLError(unsigned long error);
 
     private:        
-        GraphicsContext3D();
+        GraphicsContext3D(Attributes attrs);
 
         int m_currentWidth, m_currentHeight;
         
 #if PLATFORM(MAC)
+        Attributes m_attrs;
         Vector<Vector<float> > m_vertexArray;
         
         CGLContextObj m_contextObj;
diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
index fc5b883..5e5e1f4 100644
--- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
+++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
@@ -75,18 +75,29 @@ static void setPixelFormat(Vector<CGLPixelFormatAttribute>& attribs, int colorBi
     attribs.append(static_cast<CGLPixelFormatAttribute>(0));
 }
 
-PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create()
+PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs)
 {
-    OwnPtr<GraphicsContext3D> context(new GraphicsContext3D());
+    OwnPtr<GraphicsContext3D> context(new GraphicsContext3D(attrs));
     return context->m_contextObj ? context.release() : 0;
 }
 
-GraphicsContext3D::GraphicsContext3D()
-    : m_contextObj(0)
+GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs)
+    : m_attrs(attrs)
+    , m_contextObj(0)
     , m_texture(0)
     , m_fbo(0)
     , m_depthBuffer(0)
 {
+    // FIXME: we need to take into account the user's requested
+    // context creation attributes, in particular stencil and
+    // antialias, and determine which could and could not be honored
+    // based on the capabilities of the OpenGL implementation.
+    m_attrs.alpha = true;
+    m_attrs.depth = true;
+    m_attrs.stencil = false;
+    m_attrs.antialias = false;
+    m_attrs.premultipliedAlpha = true;
+
     Vector<CGLPixelFormatAttribute> attribs;
     CGLPixelFormatObj pixelFormatObj = 0;
     GLint numPixelFormats = 0;
@@ -540,6 +551,11 @@ int GraphicsContext3D::getAttribLocation(WebGLProgram* program, const String& na
     return ::glGetAttribLocation((GLuint) program->object(), name.utf8().data());
 }
 
+GraphicsContext3D::Attributes GraphicsContext3D::getContextAttributes()
+{
+    return m_attrs;
+}
+
 unsigned long GraphicsContext3D::getError()
 {
     if (m_syntheticErrors.size() > 0) {
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 54d07e0..132eee9 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,27 @@
+2010-01-13  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Oliver Hunt.
+
+        Need to implement WebGLContextAttributes
+        https://bugs.webkit.org/show_bug.cgi?id=31169
+
+        Added the WebGLContextAttributes class and custom JavaScript
+        bindings to accept a native object as the second argument to
+        getContext("experimental-webgl") per the WebGL specification.
+        Added GraphicsContext3D::Attributes struct to isolate DOM and
+        graphics layers. Added getContextAttributes() to
+        WebGLRenderingContext. Added test case ensuring that context
+        attributes can be passed down and returned. Tested in Safari and
+        Chromium. The attributes will be hooked up to the creation of the
+        OpenGL context in bug 33416.
+
+        * src/GraphicsContext3D.cpp:
+        (WebCore::GraphicsContext3DInternal::GraphicsContext3DInternal):
+        (WebCore::GraphicsContext3DInternal::getContextAttributes):
+        (WebCore::GraphicsContext3D::create):
+        (WebCore::GraphicsContext3D::GraphicsContext3D):
+        (WebCore::GraphicsContext3D::getContextAttributes):
+
 2010-01-13  Jon Honeycutt  <jhoneycutt at apple.com>
 
         MSAA: selected, selectable, extended selectable, and multiple
diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp
index fd79975..c6c1892 100644
--- a/WebKit/chromium/src/GraphicsContext3D.cpp
+++ b/WebKit/chromium/src/GraphicsContext3D.cpp
@@ -98,7 +98,7 @@ namespace WebCore {
 
 class GraphicsContext3DInternal {
 public:
-    GraphicsContext3DInternal();
+    GraphicsContext3DInternal(GraphicsContext3D::Attributes attrs);
     ~GraphicsContext3DInternal();
 
     bool makeContextCurrent();
@@ -124,6 +124,7 @@ public:
     void disableVertexAttribArray(unsigned long index);
     void enableVertexAttribArray(unsigned long index);
     unsigned long getError();
+    GraphicsContext3D::Attributes getContextAttributes();
     void vertexAttribPointer(unsigned long indx, int size, int type, bool normalized,
                              unsigned long stride, unsigned long offset);
     void viewportImpl(long x, long y, unsigned long width, unsigned long height);
@@ -131,6 +132,8 @@ public:
     void synthesizeGLError(unsigned long error);
 
 private:
+    GraphicsContext3D::Attributes m_attrs;
+
     unsigned int m_texture;
     unsigned int m_fbo;
     unsigned int m_depthBuffer;
@@ -366,8 +369,9 @@ GraphicsContext3DInternal::VertexAttribPointerState::VertexAttribPointerState()
 {
 }
 
-GraphicsContext3DInternal::GraphicsContext3DInternal()
-    : m_texture(0)
+GraphicsContext3DInternal::GraphicsContext3DInternal(GraphicsContext3D::Attributes attrs)
+    : m_attrs(attrs)
+    , m_texture(0)
     , m_fbo(0)
     , m_depthBuffer(0)
     , m_boundFBO(0)
@@ -393,6 +397,16 @@ GraphicsContext3DInternal::GraphicsContext3DInternal()
 #error Must port to your platform
 #endif
 {
+    // FIXME: we need to take into account the user's requested
+    // context creation attributes, in particular stencil and
+    // antialias, and determine which could and could not be honored
+    // based on the capabilities of the OpenGL implementation.
+    m_attrs.alpha = true;
+    m_attrs.depth = true;
+    m_attrs.stencil = false;
+    m_attrs.antialias = false;
+    m_attrs.premultipliedAlpha = true;
+
 #if OS(WINDOWS)
     WNDCLASS wc;
     if (!GetClassInfo(GetModuleHandle(0), L"CANVASGL", &wc)) {
@@ -982,6 +996,11 @@ unsigned long GraphicsContext3DInternal::getError()
     return glGetError();
 }
 
+GraphicsContext3D::Attributes GraphicsContext3DInternal::getContextAttributes()
+{
+    return m_attrs;
+}
+
 void GraphicsContext3DInternal::vertexAttribPointer(unsigned long indx, int size, int type, bool normalized,
                                                     unsigned long stride, unsigned long offset)
 {
@@ -1130,17 +1149,17 @@ void GraphicsContext3D::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6, t7 a7, t8
     gl##glname(a1, a2, a3, a4, a5, a6, a7, a8);                                \
 }
 
-PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create()
+PassOwnPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs)
 {
-    PassOwnPtr<GraphicsContext3D> context = new GraphicsContext3D();
+    PassOwnPtr<GraphicsContext3D> context = new GraphicsContext3D(attrs);
     // FIXME: add error checking
     return context;
 }
 
-GraphicsContext3D::GraphicsContext3D()
+GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs)
     : m_currentWidth(0)
     , m_currentHeight(0)
-    , m_internal(new GraphicsContext3DInternal())
+    , m_internal(new GraphicsContext3DInternal(attrs))
 {
 }
 
@@ -1569,6 +1588,11 @@ void GraphicsContext3D::getBufferParameteriv(unsigned long target, unsigned long
     glGetBufferParameteriv(target, pname, value);
 }
 
+GraphicsContext3D::Attributes GraphicsContext3D::getContextAttributes()
+{
+    return m_internal->getContextAttributes();
+}
+
 unsigned long GraphicsContext3D::getError()
 {
     return m_internal->getError();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list