[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
cmarrin at apple.com
cmarrin at apple.com
Wed Dec 22 12:43:36 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 788ca8d3f6696cc070edba7c7173e93396683d97
Author: cmarrin at apple.com <cmarrin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Aug 27 21:35:30 2010 +0000
2010-08-27 Chris Marrin <cmarrin at apple.com>
Reviewed by Simon Fraser.
https://bugs.webkit.org/show_bug.cgi?id=42862
WebGL in CSS Canvas crashes
This fixes the crash, which was a simple null pointer deref. But this
revealed that -webkit-canvas no longer works for WebGL. I believe this
is due to the recent ImageBuffer optimizations done by Dave Hyatt
(https://bugs.webkit.org/show_bug.cgi?id=43507). This changed ImageBuffer
from always keeping a copy of the pixels to doing a copy to get them
when needed. Since We need to get pixels out of the WebGL drawing buffer
to use them as a CSS background, I had to change when I return those
pixels to the ImageBuffer.
Tests: fast/canvas/webgl/css-webkit-canvas-repaint.html
fast/canvas/webgl/css-webkit-canvas.html
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::copiedImage): Add logic to get image from WebGL so it works with new ImageBuffer logic (see above)
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::create): Fixed null pointer deref
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66258 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index d21cd0b..c074437 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,24 @@
+2010-08-27 Chris Marrin <cmarrin at apple.com>
+
+ Reviewed by Simon Fraser.
+
+ https://bugs.webkit.org/show_bug.cgi?id=42862
+ WebGL in CSS Canvas crashes
+
+ One test does a simple triangle render and uses it as a CSS background.
+ The other renders the triangle twice with 2 different background colors
+ to test that the background can be dynamically changed.
+
+ * fast/canvas/webgl/css-webkit-canvas-repaint.html: Added.
+ * fast/canvas/webgl/css-webkit-canvas.html: Added.
+ * platform/mac/fast/canvas/webgl: Added.
+ * platform/mac/fast/canvas/webgl/css-webkit-canvas-expected.checksum: Added.
+ * platform/mac/fast/canvas/webgl/css-webkit-canvas-expected.png: Added.
+ * platform/mac/fast/canvas/webgl/css-webkit-canvas-expected.txt: Added.
+ * platform/mac/fast/canvas/webgl/css-webkit-canvas-repaint-expected.checksum: Added.
+ * platform/mac/fast/canvas/webgl/css-webkit-canvas-repaint-expected.png: Added.
+ * platform/mac/fast/canvas/webgl/css-webkit-canvas-repaint-expected.txt: Added.
+
2010-08-27 Tony Chang <tony at chromium.org>
Not reviewed, cleaning up chromium test results.
diff --git a/LayoutTests/fast/canvas/webgl/css-webkit-canvas-repaint.html b/LayoutTests/fast/canvas/webgl/css-webkit-canvas-repaint.html
new file mode 100644
index 0000000..99d054f
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/css-webkit-canvas-repaint.html
@@ -0,0 +1,117 @@
+<html>
+ <head>
+ <style>
+ div {
+ width:200px;
+ height:200px;
+ border:2px solid black;
+ content: -webkit-canvas(triangle);
+ }
+ </style>
+
+ <script id="vertexShader" type="x-shader/x-vertex">
+ attribute vec4 vPosition;
+
+ void main() {
+ gl_Position = vPosition;
+ }
+ </script>
+
+ <script id="fragmentShader" type="x-shader/x-fragment">
+ void main() {
+ gl_FragColor = vec4(0.8, 0.7, 0, 1.0);
+ }
+ </script>
+
+ <script type="application/x-javascript">
+ function getFragmentShader()
+ {
+ var shaderNode = document.getElementById("fragmentShader"); // fragmentShader has been defined at the top
+ var shaderSource = getShaderSource(shaderNode);
+
+ var shader = gl.createShader(gl.FRAGMENT_SHADER);
+ gl.shaderSource(shader, shaderSource);
+ gl.compileShader(shader);
+
+ return shader;
+ }
+
+ function getShaderSource(shaderNode)
+ {
+ var shaderSource = "";
+ var node = shaderNode.firstChild;
+ while (node) {
+ if (node.nodeType == 3) // Node.TEXT_NODE
+ shaderSource += node.textContent;
+ node = node.nextSibling;
+ }
+
+ return shaderSource;
+ }
+
+ function getVertexShader()
+ {
+ var shaderNode = document.getElementById("vertexShader");
+ var shaderSource = getShaderSource(shaderNode);
+
+ var shader = gl.createShader(gl.VERTEX_SHADER);
+ gl.shaderSource(shader, shaderSource);
+ gl.compileShader(shader);
+
+ return shader;
+ }
+
+ function initialize()
+ {
+ gl = document.getCSSCanvasContext("experimental-webgl", "triangle", 200, 200);
+
+ var vertexShader = getVertexShader();
+ var fragmentShader = getFragmentShader();
+
+ var shaderProgram = gl.createProgram();
+ gl.attachShader(shaderProgram, vertexShader);
+ gl.attachShader(shaderProgram, fragmentShader);
+ gl.bindAttribLocation(shaderProgram, 0, "vPosition"); // vPosition has been defined at the top
+ gl.linkProgram(shaderProgram);
+
+ gl.useProgram(shaderProgram);
+
+ var buffer = gl.createBuffer();
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
+ }
+
+ function draw(r, g, b)
+ {
+ var vertices = [ 0.0, 0.8, 0.0,
+ -0.8, -0.8, 0.0,
+ 0.8, -0.8, 0.0 ];
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);
+
+ gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0); // Load the vertex data
+ gl.enableVertexAttribArray(0);
+ gl.clearColor(r, g, b, 1);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+ }
+
+ if (window.layoutTestController) {
+ layoutTestController.waitUntilDone();
+ layoutTestController.overridePreference("WebKitWebGLEnabled", "1");
+ }
+
+ initialize();
+
+ setTimeout(function() {
+ draw(0.7, 0, 0);
+ setTimeout(function() {
+ draw(0, 0.5, 0);
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+ }, 100);
+ }, 100);
+ </script>
+ </head>
+ <body>
+ <div></div>
+ </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/canvas/webgl/css-webkit-canvas.html b/LayoutTests/fast/canvas/webgl/css-webkit-canvas.html
new file mode 100644
index 0000000..d5a18a1
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/css-webkit-canvas.html
@@ -0,0 +1,107 @@
+<html>
+ <head>
+ <style>
+ div {
+ width:200px;
+ height:200px;
+ border:2px solid black;
+ content: -webkit-canvas(triangle);
+ }
+ </style>
+
+ <script id="vertexShader" type="x-shader/x-vertex">
+ attribute vec4 vPosition;
+
+ void main() {
+ gl_Position = vPosition;
+ }
+ </script>
+
+ <script id="fragmentShader" type="x-shader/x-fragment">
+ void main() {
+ gl_FragColor = vec4(0.8, 0.7, 0, 1.0);
+ }
+ </script>
+
+ <script type="application/x-javascript">
+ function getFragmentShader()
+ {
+ var shaderNode = document.getElementById("fragmentShader"); // fragmentShader has been defined at the top
+ var shaderSource = getShaderSource(shaderNode);
+
+ var shader = gl.createShader(gl.FRAGMENT_SHADER);
+ gl.shaderSource(shader, shaderSource);
+ gl.compileShader(shader);
+
+ return shader;
+ }
+
+ function getShaderSource(shaderNode)
+ {
+ var shaderSource = "";
+ var node = shaderNode.firstChild;
+ while (node) {
+ if (node.nodeType == 3) // Node.TEXT_NODE
+ shaderSource += node.textContent;
+ node = node.nextSibling;
+ }
+
+ return shaderSource;
+ }
+
+ function getVertexShader()
+ {
+ var shaderNode = document.getElementById("vertexShader");
+ var shaderSource = getShaderSource(shaderNode);
+
+ var shader = gl.createShader(gl.VERTEX_SHADER);
+ gl.shaderSource(shader, shaderSource);
+ gl.compileShader(shader);
+
+ return shader;
+ }
+
+ function initialize()
+ {
+ gl = document.getCSSCanvasContext("experimental-webgl", "triangle", 200, 200);
+
+ var vertexShader = getVertexShader();
+ var fragmentShader = getFragmentShader();
+
+ var shaderProgram = gl.createProgram();
+ gl.attachShader(shaderProgram, vertexShader);
+ gl.attachShader(shaderProgram, fragmentShader);
+ gl.bindAttribLocation(shaderProgram, 0, "vPosition"); // vPosition has been defined at the top
+ gl.linkProgram(shaderProgram);
+
+ gl.useProgram(shaderProgram);
+
+ var buffer = gl.createBuffer();
+ gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
+ }
+
+ function draw(r, g, b)
+ {
+ var vertices = [ 0.0, 0.8, 0.0,
+ -0.8, -0.8, 0.0,
+ 0.8, -0.8, 0.0 ];
+ gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW);
+
+ gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0); // Load the vertex data
+ gl.enableVertexAttribArray(0);
+ gl.clearColor(r, g, b, 1);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+ gl.drawArrays(gl.TRIANGLES, 0, 3);
+ }
+
+ if (window.layoutTestController)
+ layoutTestController.overridePreference("WebKitWebGLEnabled", "1");
+
+ initialize();
+ draw(0, 0.5, 0);
+ </script>
+ </head>
+ <body>
+ <div></div>
+ </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-expected.checksum b/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-expected.checksum
new file mode 100644
index 0000000..2bbf577
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-expected.checksum
@@ -0,0 +1 @@
+ed090873f9ef779f1227cf67ad92fdec
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-expected.png b/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-expected.png
new file mode 100644
index 0000000..2974b4d
Binary files /dev/null and b/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-expected.txt b/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-expected.txt
new file mode 100644
index 0000000..d7faa2e
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-expected.txt
@@ -0,0 +1,6 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderImage {DIV} at (0,0) size 204x204 [border: (2px solid #000000)]
diff --git a/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-repaint-expected.checksum b/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-repaint-expected.checksum
new file mode 100644
index 0000000..2bbf577
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-repaint-expected.checksum
@@ -0,0 +1 @@
+ed090873f9ef779f1227cf67ad92fdec
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-repaint-expected.png b/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-repaint-expected.png
new file mode 100644
index 0000000..2974b4d
Binary files /dev/null and b/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-repaint-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-repaint-expected.txt b/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-repaint-expected.txt
new file mode 100644
index 0000000..d7faa2e
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/canvas/webgl/css-webkit-canvas-repaint-expected.txt
@@ -0,0 +1,6 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderImage {DIV} at (0,0) size 204x204 [border: (2px solid #000000)]
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c04f37e..ce5c382 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,27 @@
+2010-08-27 Chris Marrin <cmarrin at apple.com>
+
+ Reviewed by Simon Fraser.
+
+ https://bugs.webkit.org/show_bug.cgi?id=42862
+ WebGL in CSS Canvas crashes
+
+ This fixes the crash, which was a simple null pointer deref. But this
+ revealed that -webkit-canvas no longer works for WebGL. I believe this
+ is due to the recent ImageBuffer optimizations done by Dave Hyatt
+ (https://bugs.webkit.org/show_bug.cgi?id=43507). This changed ImageBuffer
+ from always keeping a copy of the pixels to doing a copy to get them
+ when needed. Since We need to get pixels out of the WebGL drawing buffer
+ to use them as a CSS background, I had to change when I return those
+ pixels to the ImageBuffer.
+
+ Tests: fast/canvas/webgl/css-webkit-canvas-repaint.html
+ fast/canvas/webgl/css-webkit-canvas.html
+
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::HTMLCanvasElement::copiedImage): Add logic to get image from WebGL so it works with new ImageBuffer logic (see above)
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore::WebGLRenderingContext::create): Fixed null pointer deref
+
2010-08-27 James Robinson <jamesr at chromium.org>
Reviewed by Dimitri Glazkov.
diff --git a/WebCore/html/HTMLCanvasElement.cpp b/WebCore/html/HTMLCanvasElement.cpp
index d398bfd..ea7479d 100644
--- a/WebCore/html/HTMLCanvasElement.cpp
+++ b/WebCore/html/HTMLCanvasElement.cpp
@@ -394,8 +394,14 @@ ImageBuffer* HTMLCanvasElement::buffer() const
Image* HTMLCanvasElement::copiedImage() const
{
- if (!m_copiedImage && buffer())
+ if (!m_copiedImage && buffer()) {
+ if (m_context) {
+ // If we're not rendering to the ImageBuffer, copy the rendering results to it.
+ if (!m_context->paintsIntoCanvasBuffer())
+ m_context->paintRenderingResultsToCanvas();
+ }
m_copiedImage = buffer()->copyImage();
+ }
return m_copiedImage.get();
}
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index 44d3e08..e812068 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -86,7 +86,8 @@ private:
PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElement* canvas, WebGLContextAttributes* attrs)
{
HostWindow* hostWindow = canvas->document()->view()->root()->hostWindow();
- OwnPtr<GraphicsContext3D> context(GraphicsContext3D::create(attrs->attributes(), hostWindow));
+ GraphicsContext3D::Attributes emptyAttributes;
+ OwnPtr<GraphicsContext3D> context(GraphicsContext3D::create(attrs ? attrs->attributes() : emptyAttributes, hostWindow));
if (!context)
return 0;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list