[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 15:27:29 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c7a536efc469d6b05eb68ad042ffc1b3d2dd1d6d
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 3 23:53:19 2010 +0000

    2010-11-02  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Kenneth Russell.
    
            A different mask or reference value in stencil operations should generate INVALID_OPERATION
            https://bugs.webkit.org/show_bug.cgi?id=48669
    
            * html/canvas/WebGLRenderingContext.cpp:
            (WebCore::WebGLRenderingContext::WebGLRenderingContext): Init stencil func ref/mask and stencil mask to default.
            (WebCore::WebGLRenderingContext::stencilFunc): Cache ref/mask value.
            (WebCore::WebGLRenderingContext::stencilFuncSeparate): Generate error if front/back values differ.
            (WebCore::WebGLRenderingContext::stencilMask): Cache mask value.
            (WebCore::WebGLRenderingContext::stencilMaskSeparate): Generate error if front/back values differ.
            (WebCore::WebGLRenderingContext::validateFace): Validate face parameter.
            (WebCore::WebGLRenderingContext::validateStencilFunc): Validate stencil func parameter.
            * html/canvas/WebGLRenderingContext.h: Add members to track stencil func ref/mask and stencil mask.
    2010-11-02  Zhenyao Mo  <zmo at google.com>
    
            Reviewed by Kenneth Russell.
    
            A different mask or reference value in stencil operations should generate INVALID_OPERATION
            https://bugs.webkit.org/show_bug.cgi?id=48669
    
            * fast/canvas/webgl/webgl-specific-expected.txt:
            * fast/canvas/webgl/webgl-specific.html: Uncomment the test cases for the bug.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71282 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b4bfbae..9db967c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-02  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Kenneth Russell.
+
+        A different mask or reference value in stencil operations should generate INVALID_OPERATION
+        https://bugs.webkit.org/show_bug.cgi?id=48669
+
+        * fast/canvas/webgl/webgl-specific-expected.txt:
+        * fast/canvas/webgl/webgl-specific.html: Uncomment the test cases for the bug.
+
 2010-11-03  Oliver Hunt  <oliver at apple.com>
 
         Reviewed by Gavin Barraclough.
diff --git a/LayoutTests/fast/canvas/webgl/webgl-specific-expected.txt b/LayoutTests/fast/canvas/webgl/webgl-specific-expected.txt
index c9616bd..192bc50 100644
--- a/LayoutTests/fast/canvas/webgl/webgl-specific-expected.txt
+++ b/LayoutTests/fast/canvas/webgl/webgl-specific-expected.txt
@@ -18,6 +18,14 @@ PASS getError was expected value: INVALID_OPERATION : constant color and constan
 PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
 PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
 PASS getError was expected value: INVALID_OPERATION : constant color and constant alpha cannot be used together as source and destination factors in the blend function
+PASS getError was expected value: NO_ERROR : stencilMask should generate no error
+PASS getError was expected value: INVALID_OPERATION : a different mask value for front and back facing is illegal
+PASS getError was expected value: INVALID_OPERATION : a different mask value for front and back facing is illegal
+PASS getError was expected value: NO_ERROR : stencilFunc should generate no error
+PASS getError was expected value: INVALID_OPERATION : a different reference value for front and back facing is illegal
+PASS getError was expected value: INVALID_OPERATION : a different reference value for front and back facing is illegal
+PASS getError was expected value: INVALID_OPERATION : a different mask value for front and back facing is illegal
+PASS getError was expected value: INVALID_OPERATION : a different mask value for front and back facing is illegal
 PASS successfullyParsed is true
 
 TEST COMPLETE
diff --git a/LayoutTests/fast/canvas/webgl/webgl-specific.html b/LayoutTests/fast/canvas/webgl/webgl-specific.html
index 2e1e9b1..b84cafb 100644
--- a/LayoutTests/fast/canvas/webgl/webgl-specific.html
+++ b/LayoutTests/fast/canvas/webgl/webgl-specific.html
@@ -72,6 +72,7 @@ glErrorShouldBe(gl, gl.INVALID_OPERATION,
 gl.depthRange(20, 10);
 glErrorShouldBe(gl, gl.INVALID_OPERATION,
     "depthRange should generate INVALID_OPERATION if zNear is greater than zFar");
+*/
 
 gl.stencilMask(255);
 glErrorShouldBe(gl, gl.NO_ERROR,
@@ -98,7 +99,6 @@ glErrorShouldBe(gl, gl.INVALID_OPERATION,
 gl.stencilFuncSeparate(gl.BACK, gl.ALWAYS, 0, 1);
 glErrorShouldBe(gl, gl.INVALID_OPERATION,
     "a different mask value for front and back facing is illegal");
-*/
 
 successfullyParsed = true;
 </script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0a86774..2da7d81 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-11-02  Zhenyao Mo  <zmo at google.com>
+
+        Reviewed by Kenneth Russell.
+
+        A different mask or reference value in stencil operations should generate INVALID_OPERATION
+        https://bugs.webkit.org/show_bug.cgi?id=48669
+
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::WebGLRenderingContext): Init stencil func ref/mask and stencil mask to default.
+        (WebCore::WebGLRenderingContext::stencilFunc): Cache ref/mask value.
+        (WebCore::WebGLRenderingContext::stencilFuncSeparate): Generate error if front/back values differ.
+        (WebCore::WebGLRenderingContext::stencilMask): Cache mask value.
+        (WebCore::WebGLRenderingContext::stencilMaskSeparate): Generate error if front/back values differ.
+        (WebCore::WebGLRenderingContext::validateFace): Validate face parameter.
+        (WebCore::WebGLRenderingContext::validateStencilFunc): Validate stencil func parameter.
+        * html/canvas/WebGLRenderingContext.h: Add members to track stencil func ref/mask and stencil mask.
+
 2010-11-03  Dimitri Glazkov  <dglazkov at chromium.org>
 
         Reverting r71244, r71248 and r71250. Broke default event handling inside text fields.
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index eb90acc..4270728 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -104,6 +104,9 @@ WebGLRenderingContext::WebGLRenderingContext(HTMLCanvasElement* passedCanvas, Pa
     , m_context(context)
     , m_videoCache(4)
     , m_contextLost(false)
+    , m_stencilMask(0xFFFFFFFF)
+    , m_stencilFuncRef(0)
+    , m_stencilFuncMask(0xFFFFFFFF)
 {
     ASSERT(m_context);
     initializeNewContext();
@@ -2217,6 +2220,10 @@ void WebGLRenderingContext::stencilFunc(unsigned long func, long ref, unsigned l
 {
     if (isContextLost())
         return;
+    if (!validateStencilFunc(func))
+        return;
+    m_stencilFuncRef = ref;
+    m_stencilFuncMask = mask;
     m_context->stencilFunc(func, ref, mask);
     cleanupAfterGraphicsCall(false);
 }
@@ -2225,6 +2232,17 @@ void WebGLRenderingContext::stencilFuncSeparate(unsigned long face, unsigned lon
 {
     if (isContextLost())
         return;
+    if (!validateFace(face) || !validateStencilFunc(func))
+        return;
+    if (face == GraphicsContext3D::FRONT_AND_BACK) {
+        m_stencilFuncRef = ref;
+        m_stencilFuncMask = mask;
+    } else if (m_stencilFuncRef != ref || m_stencilFuncMask != mask) {
+        // for ref value, we generate an error if user specify a different value
+        // for front/back faces even if they clamp to the same value internally.
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+        return;
+    }
     m_context->stencilFuncSeparate(face, func, ref, mask);
     cleanupAfterGraphicsCall(false);
 }
@@ -2233,6 +2251,7 @@ void WebGLRenderingContext::stencilMask(unsigned long mask)
 {
     if (isContextLost())
         return;
+    m_stencilMask = mask;
     m_context->stencilMask(mask);
     cleanupAfterGraphicsCall(false);
 }
@@ -2241,6 +2260,14 @@ void WebGLRenderingContext::stencilMaskSeparate(unsigned long face, unsigned lon
 {
     if (isContextLost())
         return;
+    if (!validateFace(face))
+        return;
+    if (face == GraphicsContext3D::FRONT_AND_BACK)
+        m_stencilMask = mask;
+    else if (m_stencilMask != mask) {
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
+        return;
+    }
     m_context->stencilMaskSeparate(face, mask);
     cleanupAfterGraphicsCall(false);
 }
@@ -3555,6 +3582,37 @@ bool WebGLRenderingContext::validateDrawMode(unsigned long mode)
     }
 }
 
+bool WebGLRenderingContext::validateFace(unsigned long face)
+{
+    switch (face) {
+    case GraphicsContext3D::FRONT:
+    case GraphicsContext3D::BACK:
+    case GraphicsContext3D::FRONT_AND_BACK:
+        return true;
+    default:
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
+        return false;
+    }
+}
+
+bool WebGLRenderingContext::validateStencilFunc(unsigned long func)
+{
+    switch (func) {
+    case GraphicsContext3D::NEVER:
+    case GraphicsContext3D::LESS:
+    case GraphicsContext3D::LEQUAL:
+    case GraphicsContext3D::GREATER:
+    case GraphicsContext3D::GEQUAL:
+    case GraphicsContext3D::EQUAL:
+    case GraphicsContext3D::NOTEQUAL:
+    case GraphicsContext3D::ALWAYS:
+        return true;
+    default:
+        m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM);
+        return false;
+    }
+}
+
 void WebGLRenderingContext::printWarningToConsole(const String& message)
 {
     canvas()->document()->frame()->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, WarningMessageLevel,
diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h
index 2188fc9..912a2ef 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.h
+++ b/WebCore/html/canvas/WebGLRenderingContext.h
@@ -426,6 +426,11 @@ public:
     bool m_unpackPremultiplyAlpha;
     bool m_contextLost;
 
+    long m_stencilBits;
+    unsigned long m_stencilMask;
+    long m_stencilFuncRef; // Note that this is the user specified value, not the internal clamped value.
+    unsigned long m_stencilFuncMask;
+
     // Helpers for getParameter and others
     WebGLGetInfo getBooleanParameter(unsigned long pname);
     WebGLGetInfo getBooleanArrayParameter(unsigned long pname);
@@ -485,6 +490,12 @@ public:
     // Helper function to validate mode for draw{Arrays/Elements}.
     bool validateDrawMode(unsigned long);
 
+    // Helper function to validate face.
+    bool validateFace(unsigned long);
+
+    // Helper function to validate stencil func.
+    bool validateStencilFunc(unsigned long);
+
     // Helper function for texParameterf and texParameteri.
     void texParameter(unsigned long target, unsigned long pname, float parami, int paramf, bool isFloat);
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list