[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

zmo at google.com zmo at google.com
Wed Dec 22 11:15:19 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 8d07a942057ba9ce02d58c368afe7d5306e59bdf
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jul 16 01:38:47 2010 +0000

    2010-07-15  Jay Civelli  <jcivelli at chromium.org>
    
            Reviewed by David Levin.
    
            [chromium] Making the popup label color visible when the item is
            selected.
            https://bugs.webkit.org/show_bug.cgi?id=42271
    
            * platform/chromium/PopupMenuChromium.cpp:
            (WebCore::PopupListBox::paintRow): paint the label text with a
            different color when it is selected.
    2010-07-13  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Nate Chapin.
    
            bufferData and bufferSubData generate wrong error when null buffer is bound
            https://bugs.webkit.org/show_bug.cgi?id=42125
    
            * fast/canvas/webgl/buffer-data-array-buffer-expected.txt:
            * fast/canvas/webgl/buffer-data-array-buffer.html: Test against the case where bound buffer is 0.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63505 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ec1a21f..5d6b3d7 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-07-13  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Nate Chapin.
+
+        bufferData and bufferSubData generate wrong error when null buffer is bound
+        https://bugs.webkit.org/show_bug.cgi?id=42125
+
+        * fast/canvas/webgl/buffer-data-array-buffer-expected.txt:
+        * fast/canvas/webgl/buffer-data-array-buffer.html: Test against the case where bound buffer is 0.
+
 2010-07-15  Ojan Vafai  <ojan at chromium.org>
 
         Unreviewed. Fix expected failure for test from r63494.
diff --git a/LayoutTests/fast/canvas/webgl/buffer-data-array-buffer-expected.txt b/LayoutTests/fast/canvas/webgl/buffer-data-array-buffer-expected.txt
index aef09f8..87410c2 100644
--- a/LayoutTests/fast/canvas/webgl/buffer-data-array-buffer-expected.txt
+++ b/LayoutTests/fast/canvas/webgl/buffer-data-array-buffer-expected.txt
@@ -6,6 +6,7 @@ Regression test for https://bugs.webkit.org/show_bug.cgi?id=41884 : Implement bu
 PASS gl is non-null.
 PASS array is non-null.
 PASS [object WebGLBuffer] is non-null.
+PASS gl.getError() is gl.INVALID_OPERATION
 PASS gl.getError() is gl.NO_ERROR
 PASS gl.getError() is gl.NO_ERROR
 PASS gl.getError() is gl.NO_ERROR
diff --git a/LayoutTests/fast/canvas/webgl/buffer-data-array-buffer.html b/LayoutTests/fast/canvas/webgl/buffer-data-array-buffer.html
index 4c2c25b..f827293 100644
--- a/LayoutTests/fast/canvas/webgl/buffer-data-array-buffer.html
+++ b/LayoutTests/fast/canvas/webgl/buffer-data-array-buffer.html
@@ -22,6 +22,9 @@ shouldBeNonNull("array");
 var buf = gl.createBuffer();
 shouldBeNonNull(buf);
 
+gl.bufferData(gl.ARRAY_BUFFER, array, gl.STATIC_DRAW);
+shouldBe("gl.getError()", "gl.INVALID_OPERATION"); 
+
 gl.bindBuffer(gl.ARRAY_BUFFER, buf);
 shouldBe("gl.getError()", "gl.NO_ERROR");
 
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 3f9fa9b..9baa823 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -14,6 +14,19 @@
 
         Reviewed by Nate Chapin.
 
+        bufferData and bufferSubData generate wrong error when null buffer is bound
+        https://bugs.webkit.org/show_bug.cgi?id=42125
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::bufferData): Call validateBufferDataParameters().
+        (WebCore::WebGLRenderingContext::bufferSubData): Ditto.
+        (WebCore::WebGLRenderingContext::validateBufferDataParameters): Parameters validation for buffer{Sub}Data().
+        * html/canvas/WebGLRenderingContext.h: Declare validateBufferDataParameters().
+
+2010-07-13  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Nate Chapin.
+
         WebGL rendering results must be made available to Canvas.toDataURL and 2D drawImage
         https://bugs.webkit.org/show_bug.cgi?id=34719
 
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index 35dc64a..f567ac8 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -358,22 +358,11 @@ void WebGLRenderingContext::blendFuncSeparate(unsigned long srcRGB, unsigned lon
 void WebGLRenderingContext::bufferData(unsigned long target, int size, unsigned long usage, ExceptionCode& ec)
 {
     UNUSED_PARAM(ec);
-    if (!isGLES2Compliant()) {
-        if (!validateBufferDataUsage(usage))
-            return;
-    }
-    if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER && m_boundElementArrayBuffer) {
-        if (!m_boundElementArrayBuffer->associateBufferData(size)) {
-            m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
-            return;
-        }
-    } else if (target == GraphicsContext3D::ARRAY_BUFFER && m_boundArrayBuffer) {
-        if (!m_boundArrayBuffer->associateBufferData(size)) {
-            m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
-            return;
-        }
-    } else {
-        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
+    WebGLBuffer* buffer = validateBufferDataParameters(target, usage);
+    if (!buffer)
+        return;
+    if (!buffer->associateBufferData(size)) {
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
         return;
     }
 
@@ -384,22 +373,11 @@ void WebGLRenderingContext::bufferData(unsigned long target, int size, unsigned
 void WebGLRenderingContext::bufferData(unsigned long target, ArrayBuffer* data, unsigned long usage, ExceptionCode& ec)
 {
     UNUSED_PARAM(ec);
-    if (!isGLES2Compliant()) {
-        if (!validateBufferDataUsage(usage))
-            return;
-    }
-    if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER && m_boundElementArrayBuffer) {
-        if (!m_boundElementArrayBuffer->associateBufferData(data)) {
-            m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
-            return;
-        }
-    } else if (target == GraphicsContext3D::ARRAY_BUFFER && m_boundArrayBuffer) {
-        if (!m_boundArrayBuffer->associateBufferData(data)) {
-            m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
-            return;
-        }
-    } else {
-        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
+    WebGLBuffer* buffer = validateBufferDataParameters(target, usage);
+    if (!buffer)
+        return;
+    if (!buffer->associateBufferData(data)) {
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
         return;
     }
 
@@ -410,22 +388,11 @@ void WebGLRenderingContext::bufferData(unsigned long target, ArrayBuffer* data,
 void WebGLRenderingContext::bufferData(unsigned long target, ArrayBufferView* data, unsigned long usage, ExceptionCode& ec)
 {
     UNUSED_PARAM(ec);
-    if (!isGLES2Compliant()) {
-        if (!validateBufferDataUsage(usage))
-            return;
-    }
-    if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER && m_boundElementArrayBuffer) {
-        if (!m_boundElementArrayBuffer->associateBufferData(data)) {
-            m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
-            return;
-        }
-    } else if (target == GraphicsContext3D::ARRAY_BUFFER && m_boundArrayBuffer) {
-        if (!m_boundArrayBuffer->associateBufferData(data)) {
-            m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
-            return;
-        }
-    } else {
-        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
+    WebGLBuffer* buffer = validateBufferDataParameters(target, usage);
+    if (!buffer)
+        return;
+    if (!buffer->associateBufferData(data)) {
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
         return;
     }
 
@@ -436,18 +403,11 @@ void WebGLRenderingContext::bufferData(unsigned long target, ArrayBufferView* da
 void WebGLRenderingContext::bufferSubData(unsigned long target, long offset, ArrayBuffer* data, ExceptionCode& ec)
 {
     UNUSED_PARAM(ec);
-    if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER && m_boundElementArrayBuffer) {
-        if (!m_boundElementArrayBuffer->associateBufferSubData(offset, data)) {
-            m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
-            return;
-        }
-    } else if (target == GraphicsContext3D::ARRAY_BUFFER && m_boundArrayBuffer) {
-        if (!m_boundArrayBuffer->associateBufferSubData(offset, data)) {
-            m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
-            return;
-        }
-    } else {
-        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
+    WebGLBuffer* buffer = validateBufferDataParameters(target, GraphicsContext3D::STATIC_DRAW);
+    if (!buffer)
+        return;
+    if (!buffer->associateBufferSubData(offset, data)) {
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
         return;
     }
 
@@ -458,18 +418,11 @@ void WebGLRenderingContext::bufferSubData(unsigned long target, long offset, Arr
 void WebGLRenderingContext::bufferSubData(unsigned long target, long offset, ArrayBufferView* data, ExceptionCode& ec)
 {
     UNUSED_PARAM(ec);
-    if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER && m_boundElementArrayBuffer) {
-        if (!m_boundElementArrayBuffer->associateBufferSubData(offset, data)) {
-            m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
-            return;
-        }
-    } else if (target == GraphicsContext3D::ARRAY_BUFFER && m_boundArrayBuffer) {
-        if (!m_boundArrayBuffer->associateBufferSubData(offset, data)) {
-            m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
-            return;
-        }
-    } else {
-        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
+    WebGLBuffer* buffer = validateBufferDataParameters(target, GraphicsContext3D::STATIC_DRAW);
+    if (!buffer)
+        return;
+    if (!buffer->associateBufferSubData(offset, data)) {
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
         return;
     }
 
@@ -3647,16 +3600,32 @@ bool WebGLRenderingContext::validateUniformMatrixParameters(const WebGLUniformLo
     return true;
 }
 
-bool WebGLRenderingContext::validateBufferDataUsage(unsigned long usage)
+WebGLBuffer* WebGLRenderingContext::validateBufferDataParameters(unsigned long target, unsigned long usage)
 {
+    WebGLBuffer* buffer = 0;
+    switch (target) {
+    case GraphicsContext3D::ELEMENT_ARRAY_BUFFER:
+        buffer = m_boundElementArrayBuffer.get();
+        break;
+    case GraphicsContext3D::ARRAY_BUFFER:
+        buffer = m_boundArrayBuffer.get();
+        break;
+    default:
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
+        return 0;
+    }
+    if (!buffer) {
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+        return 0;
+    }
     switch (usage) {
     case GraphicsContext3D::STREAM_DRAW:
     case GraphicsContext3D::STATIC_DRAW:
     case GraphicsContext3D::DYNAMIC_DRAW:
-        return true;
+        return buffer;
     }
     m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
-    return false;
+    return 0;
 }
 
 void WebGLRenderingContext::vertexAttribfImpl(unsigned long index, int expectedSize, float v0, float v1, float v2, float v3)
diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h
index 1dd7d53..fa9ffdb 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.h
+++ b/WebCore/html/canvas/WebGLRenderingContext.h
@@ -509,8 +509,9 @@ class WebKitCSSMatrix;
         bool validateUniformMatrixParameters(const WebGLUniformLocation* location, bool transpose, Float32Array* v, int mod);
         bool validateUniformMatrixParameters(const WebGLUniformLocation* location, bool transpose, void* v, int size, int mod);
 
-        // Helper function to validate usage for bufferData.
-        bool validateBufferDataUsage(unsigned long);
+        // Helper function to validate parameters for bufferData.
+        // Return the current bound buffer to target, or 0 if parameters are invalid.
+        WebGLBuffer* validateBufferDataParameters(unsigned long target, unsigned long usage);
 
         // Helper functions for vertexAttribNf{v}.
         void vertexAttribfImpl(unsigned long index, int expectedSize, float v0, float v1, float v2, float v3);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list