2011-03-24 John Bauman <jbauman@chromium.org>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Mar 2011 21:40:43 +0000 (21:40 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Mar 2011 21:40:43 +0000 (21:40 +0000)
        Reviewed by Kenneth Russell.

        preserveDrawingBuffer=true is ignored
        https://bugs.webkit.org/show_bug.cgi?id=56987

        Add code to the V8 and JSC bindings to support grabbing the value of
        preserveDrawingBuffer from the input context attributes. Also, in
        WebGLRenderingContext use the WebGLContextAttributes that were input
        directly, not those from the GraphicsContext3D which could have been
        changed.

        No new tests, as this can't be tested with DRT. However, this works
        when tested manually.

        * bindings/js/JSHTMLCanvasElementCustom.cpp:
        (WebCore::JSHTMLCanvasElement::getContext):
        * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
        (WebCore::V8HTMLCanvasElement::getContextCallback):
        * html/canvas/WebGLRenderingContext.cpp:
        (WebCore::WebGLRenderingContext::clearIfComposited):
        (WebCore::WebGLRenderingContext::paintRenderingResultsToCanvas):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@81899 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp
Source/WebCore/bindings/v8/custom/V8HTMLCanvasElementCustom.cpp
Source/WebCore/html/canvas/WebGLRenderingContext.cpp

index e3d367b..74a18b9 100644 (file)
@@ -1,3 +1,27 @@
+2011-03-24  John Bauman  <jbauman@chromium.org>
+
+        Reviewed by Kenneth Russell.
+
+        preserveDrawingBuffer=true is ignored
+        https://bugs.webkit.org/show_bug.cgi?id=56987
+
+        Add code to the V8 and JSC bindings to support grabbing the value of
+        preserveDrawingBuffer from the input context attributes. Also, in
+        WebGLRenderingContext use the WebGLContextAttributes that were input
+        directly, not those from the GraphicsContext3D which could have been
+        changed.
+
+        No new tests, as this can't be tested with DRT. However, this works
+        when tested manually.
+
+        * bindings/js/JSHTMLCanvasElementCustom.cpp:
+        (WebCore::JSHTMLCanvasElement::getContext):
+        * bindings/v8/custom/V8HTMLCanvasElementCustom.cpp:
+        (WebCore::V8HTMLCanvasElement::getContextCallback):
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::clearIfComposited):
+        (WebCore::WebGLRenderingContext::paintRenderingResultsToCanvas):
+
 2011-03-24  Enrica Casucci  <enrica@apple.com>
 
         Reviewed by Alexey Proskuryakov.
index 84dd72e..72aec4b 100644 (file)
@@ -76,6 +76,9 @@ JSValue JSHTMLCanvasElement::getContext(ExecState* exec)
             Identifier premultipliedAlpha(exec, "premultipliedAlpha");
             if (jsAttrs->hasProperty(exec, premultipliedAlpha))
                 webGLAttrs->setPremultipliedAlpha(jsAttrs->get(exec, premultipliedAlpha).toBoolean(exec));
+            Identifier preserveDrawingBuffer(exec, "preserveDrawingBuffer");
+            if (jsAttrs->hasProperty(exec, preserveDrawingBuffer))
+                webGLAttrs->setPreserveDrawingBuffer(jsAttrs->get(exec, preserveDrawingBuffer).toBoolean(exec));
         }
     }
 #endif
index 8fd2d62..52465b6 100644 (file)
@@ -76,6 +76,9 @@ v8::Handle<v8::Value> V8HTMLCanvasElement::getContextCallback(const v8::Argument
             v8::Handle<v8::String> premultipliedAlpha = v8::String::New("premultipliedAlpha");
             if (jsAttrs->Has(premultipliedAlpha))
                 webGLAttrs->setPremultipliedAlpha(jsAttrs->Get(premultipliedAlpha)->BooleanValue());
+            v8::Handle<v8::String> preserveDrawingBuffer = v8::String::New("preserveDrawingBuffer");
+            if (jsAttrs->Has(preserveDrawingBuffer))
+                webGLAttrs->setPreserveDrawingBuffer(jsAttrs->Get(preserveDrawingBuffer)->BooleanValue());
         }
     }
 #endif
index 18cecae..aa40a64 100644 (file)
@@ -505,7 +505,7 @@ bool WebGLRenderingContext::clearIfComposited(GC3Dbitfield mask)
     RefPtr<WebGLContextAttributes> contextAttributes = getContextAttributes();
 
     if (!m_context->layerComposited() || m_layerCleared
-        || contextAttributes->preserveDrawingBuffer() || m_framebufferBinding)
+        || m_attributes.preserveDrawingBuffer || m_framebufferBinding)
         return false;
 
     // Determine if it's possible to combine the clear the user asked for and this clear.
@@ -554,7 +554,7 @@ void WebGLRenderingContext::paintRenderingResultsToCanvas()
 {
     // Until the canvas is written to by the application, the clear that
     // happened after it was composited should be ignored by the compositor.
-    if (m_context->layerComposited() && !getContextAttributes()->preserveDrawingBuffer())
+    if (m_context->layerComposited() && !m_attributes.preserveDrawingBuffer)
         canvas()->makePresentationCopy();
     else
         canvas()->clearPresentationCopy();