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

kbr at google.com kbr at google.com
Wed Dec 22 11:44:55 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit af472000fb36aaa0e965426b4cb82a0ef452bfcb
Author: kbr at google.com <kbr at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 5 18:33:48 2010 +0000

    2010-08-04  Kenneth Russell  <kbr at google.com>
    
            Reviewed by Dimitri Glazkov.
    
            Style cleanups in WebGL
            https://bugs.webkit.org/show_bug.cgi?id=38761
    
            Cleaned up all style violations in WebGL-related files reported by
            check-webkit-style. No logic or other changes. Built WebKit and
            Chromium and ran WebGL layout tests.
    
            * src/GraphicsContext3D.cpp:
            (WebCore::GraphicsContext3DInternal::paintRenderingResultsToCanvas):
            * src/WebGraphicsContext3DDefaultImpl.cpp:
            * src/WebGraphicsContext3DDefaultImpl.h:
    2010-08-04  Kenneth Russell  <kbr at google.com>
    
            Reviewed by Dimitri Glazkov.
    
            Style cleanups in WebGL
            https://bugs.webkit.org/show_bug.cgi?id=38761
    
            Cleaned up all style violations in WebGL-related files reported by
            check-webkit-style. No logic or other changes. Built WebKit and
            Chromium and ran WebGL layout tests.
    
            * html/canvas/ArrayBuffer.cpp:
            (WebCore::ArrayBuffer::ArrayBuffer):
            (WebCore::ArrayBuffer::data):
            (WebCore::ArrayBuffer::byteLength):
            (WebCore::ArrayBuffer::~ArrayBuffer):
            (WebCore::ArrayBuffer::tryAllocate):
            * html/canvas/ArrayBufferView.cpp:
            (WebCore::ArrayBufferView::setImpl):
            * html/canvas/ArrayBufferView.h:
            * html/canvas/TypedArrayBase.h:
            * html/canvas/WebGLBuffer.cpp:
            (WebCore::WebGLBuffer::deleteObjectImpl):
            (WebCore::WebGLBuffer::associateBufferData):
            * html/canvas/WebGLBuffer.h:
            (WebCore::WebGLBuffer::~WebGLBuffer):
            (WebCore::WebGLBuffer::elementArrayBuffer):
            (WebCore::WebGLBuffer::getTarget):
            (WebCore::WebGLBuffer::isBuffer):
            * html/canvas/WebGLFramebuffer.cpp:
            (WebCore::WebGLFramebuffer::deleteObjectImpl):
            * html/canvas/WebGLFramebuffer.h:
            (WebCore::WebGLFramebuffer::~WebGLFramebuffer):
            (WebCore::WebGLFramebuffer::isDepthAttached):
            (WebCore::WebGLFramebuffer::isStencilAttached):
            (WebCore::WebGLFramebuffer::isDepthStencilAttached):
            (WebCore::WebGLFramebuffer::isFramebuffer):
            * html/canvas/WebGLGetInfo.cpp:
            * html/canvas/WebGLGetInfo.h:
            * html/canvas/WebGLObject.cpp:
            (WebCore::WebGLObject::deleteObject):
            * html/canvas/WebGLObject.h:
            (WebCore::WebGLObject::object):
            (WebCore::WebGLObject::detachContext):
            (WebCore::WebGLObject::context):
            (WebCore::WebGLObject::isBuffer):
            (WebCore::WebGLObject::isFramebuffer):
            (WebCore::WebGLObject::isProgram):
            (WebCore::WebGLObject::isRenderbuffer):
            (WebCore::WebGLObject::isShader):
            (WebCore::WebGLObject::isTexture):
            * html/canvas/WebGLProgram.cpp:
            (WebCore::WebGLProgram::deleteObjectImpl):
            * html/canvas/WebGLProgram.h:
            (WebCore::WebGLProgram::~WebGLProgram):
            (WebCore::WebGLProgram::isLinkFailureFlagSet):
            (WebCore::WebGLProgram::setLinkFailureFlag):
            (WebCore::WebGLProgram::isProgram):
            * html/canvas/WebGLRenderbuffer.cpp:
            (WebCore::WebGLRenderbuffer::deleteObjectImpl):
            * html/canvas/WebGLRenderbuffer.h:
            (WebCore::WebGLRenderbuffer::~WebGLRenderbuffer):
            (WebCore::WebGLRenderbuffer::setInternalFormat):
            (WebCore::WebGLRenderbuffer::getInternalFormat):
            (WebCore::WebGLRenderbuffer::isInitialized):
            (WebCore::WebGLRenderbuffer::setInitialized):
            (WebCore::WebGLRenderbuffer::isRenderbuffer):
            * html/canvas/WebGLRenderingContext.cpp:
            (WebCore::WebGLRenderingContext::beginPaint):
            (WebCore::WebGLRenderingContext::blendEquation):
            (WebCore::WebGLRenderingContext::getActiveAttrib):
            (WebCore::WebGLRenderingContext::getActiveUniform):
            (WebCore::WebGLRenderingContext::getBufferParameter):
            (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
            (WebCore::WebGLRenderingContext::vertexAttribPointer):
            * html/canvas/WebGLRenderingContext.h:
            (WebCore::WebGLRenderingContext::is3d):
            (WebCore::WebGLRenderingContext::isAccelerated):
            (WebCore::WebGLRenderingContext::graphicsContext3D):
            (WebCore::WebGLRenderingContext::cleanupAfterGraphicsCall):
            (WebCore::WebGLRenderingContext::VertexAttribState::VertexAttribState):
            (WebCore::WebGLRenderingContext::VertexAttribState::initValue):
            * html/canvas/WebGLShader.cpp:
            (WebCore::WebGLShader::deleteObjectImpl):
            * html/canvas/WebGLShader.h:
            (WebCore::WebGLShader::~WebGLShader):
            (WebCore::WebGLShader::getType):
            (WebCore::WebGLShader::isShader):
            * html/canvas/WebGLTexture.cpp:
            (WebCore::WebGLTexture::deleteObjectImpl):
            * html/canvas/WebGLTexture.h:
            (WebCore::WebGLTexture::~WebGLTexture):
            (WebCore::WebGLTexture::isCubeMapRWrapModeInitialized):
            (WebCore::WebGLTexture::setCubeMapRWrapModeInitialized):
            (WebCore::WebGLTexture::isTexture):
            (WebCore::WebGLTexture::LevelInfo::LevelInfo):
            (WebCore::WebGLTexture::LevelInfo::setInfo):
            * platform/graphics/GraphicsContext3D.h:
            (WebCore::GraphicsContext3D::):
            (WebCore::GraphicsContext3D::Attributes::Attributes):
            (WebCore::GraphicsContext3D::platformGraphicsContext3D):
            (WebCore::GraphicsContext3D::platformTexture):
            (WebCore::GraphicsContext3D::platformLayer):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64767 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ceb6d3b..51b6c6e 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,107 @@
+2010-08-04  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Dimitri Glazkov.
+
+        Style cleanups in WebGL
+        https://bugs.webkit.org/show_bug.cgi?id=38761
+
+        Cleaned up all style violations in WebGL-related files reported by
+        check-webkit-style. No logic or other changes. Built WebKit and
+        Chromium and ran WebGL layout tests.
+
+        * html/canvas/ArrayBuffer.cpp:
+        (WebCore::ArrayBuffer::ArrayBuffer):
+        (WebCore::ArrayBuffer::data):
+        (WebCore::ArrayBuffer::byteLength):
+        (WebCore::ArrayBuffer::~ArrayBuffer):
+        (WebCore::ArrayBuffer::tryAllocate):
+        * html/canvas/ArrayBufferView.cpp:
+        (WebCore::ArrayBufferView::setImpl):
+        * html/canvas/ArrayBufferView.h:
+        * html/canvas/TypedArrayBase.h:
+        * html/canvas/WebGLBuffer.cpp:
+        (WebCore::WebGLBuffer::deleteObjectImpl):
+        (WebCore::WebGLBuffer::associateBufferData):
+        * html/canvas/WebGLBuffer.h:
+        (WebCore::WebGLBuffer::~WebGLBuffer):
+        (WebCore::WebGLBuffer::elementArrayBuffer):
+        (WebCore::WebGLBuffer::getTarget):
+        (WebCore::WebGLBuffer::isBuffer):
+        * html/canvas/WebGLFramebuffer.cpp:
+        (WebCore::WebGLFramebuffer::deleteObjectImpl):
+        * html/canvas/WebGLFramebuffer.h:
+        (WebCore::WebGLFramebuffer::~WebGLFramebuffer):
+        (WebCore::WebGLFramebuffer::isDepthAttached):
+        (WebCore::WebGLFramebuffer::isStencilAttached):
+        (WebCore::WebGLFramebuffer::isDepthStencilAttached):
+        (WebCore::WebGLFramebuffer::isFramebuffer):
+        * html/canvas/WebGLGetInfo.cpp:
+        * html/canvas/WebGLGetInfo.h:
+        * html/canvas/WebGLObject.cpp:
+        (WebCore::WebGLObject::deleteObject):
+        * html/canvas/WebGLObject.h:
+        (WebCore::WebGLObject::object):
+        (WebCore::WebGLObject::detachContext):
+        (WebCore::WebGLObject::context):
+        (WebCore::WebGLObject::isBuffer):
+        (WebCore::WebGLObject::isFramebuffer):
+        (WebCore::WebGLObject::isProgram):
+        (WebCore::WebGLObject::isRenderbuffer):
+        (WebCore::WebGLObject::isShader):
+        (WebCore::WebGLObject::isTexture):
+        * html/canvas/WebGLProgram.cpp:
+        (WebCore::WebGLProgram::deleteObjectImpl):
+        * html/canvas/WebGLProgram.h:
+        (WebCore::WebGLProgram::~WebGLProgram):
+        (WebCore::WebGLProgram::isLinkFailureFlagSet):
+        (WebCore::WebGLProgram::setLinkFailureFlag):
+        (WebCore::WebGLProgram::isProgram):
+        * html/canvas/WebGLRenderbuffer.cpp:
+        (WebCore::WebGLRenderbuffer::deleteObjectImpl):
+        * html/canvas/WebGLRenderbuffer.h:
+        (WebCore::WebGLRenderbuffer::~WebGLRenderbuffer):
+        (WebCore::WebGLRenderbuffer::setInternalFormat):
+        (WebCore::WebGLRenderbuffer::getInternalFormat):
+        (WebCore::WebGLRenderbuffer::isInitialized):
+        (WebCore::WebGLRenderbuffer::setInitialized):
+        (WebCore::WebGLRenderbuffer::isRenderbuffer):
+        * html/canvas/WebGLRenderingContext.cpp:
+        (WebCore::WebGLRenderingContext::beginPaint):
+        (WebCore::WebGLRenderingContext::blendEquation):
+        (WebCore::WebGLRenderingContext::getActiveAttrib):
+        (WebCore::WebGLRenderingContext::getActiveUniform):
+        (WebCore::WebGLRenderingContext::getBufferParameter):
+        (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
+        (WebCore::WebGLRenderingContext::vertexAttribPointer):
+        * html/canvas/WebGLRenderingContext.h:
+        (WebCore::WebGLRenderingContext::is3d):
+        (WebCore::WebGLRenderingContext::isAccelerated):
+        (WebCore::WebGLRenderingContext::graphicsContext3D):
+        (WebCore::WebGLRenderingContext::cleanupAfterGraphicsCall):
+        (WebCore::WebGLRenderingContext::VertexAttribState::VertexAttribState):
+        (WebCore::WebGLRenderingContext::VertexAttribState::initValue):
+        * html/canvas/WebGLShader.cpp:
+        (WebCore::WebGLShader::deleteObjectImpl):
+        * html/canvas/WebGLShader.h:
+        (WebCore::WebGLShader::~WebGLShader):
+        (WebCore::WebGLShader::getType):
+        (WebCore::WebGLShader::isShader):
+        * html/canvas/WebGLTexture.cpp:
+        (WebCore::WebGLTexture::deleteObjectImpl):
+        * html/canvas/WebGLTexture.h:
+        (WebCore::WebGLTexture::~WebGLTexture):
+        (WebCore::WebGLTexture::isCubeMapRWrapModeInitialized):
+        (WebCore::WebGLTexture::setCubeMapRWrapModeInitialized):
+        (WebCore::WebGLTexture::isTexture):
+        (WebCore::WebGLTexture::LevelInfo::LevelInfo):
+        (WebCore::WebGLTexture::LevelInfo::setInfo):
+        * platform/graphics/GraphicsContext3D.h:
+        (WebCore::GraphicsContext3D::):
+        (WebCore::GraphicsContext3D::Attributes::Attributes):
+        (WebCore::GraphicsContext3D::platformGraphicsContext3D):
+        (WebCore::GraphicsContext3D::platformTexture):
+        (WebCore::GraphicsContext3D::platformLayer):
+
 2010-08-05  Kenneth Rohde Christiansen  <kenneth.christiansen at openbossa.org>
 
         Reviewed by Simon Hausmann.
diff --git a/WebCore/html/canvas/ArrayBuffer.cpp b/WebCore/html/canvas/ArrayBuffer.cpp
index 0ba2ffd..3b204ff 100644
--- a/WebCore/html/canvas/ArrayBuffer.cpp
+++ b/WebCore/html/canvas/ArrayBuffer.cpp
@@ -53,26 +53,32 @@ PassRefPtr<ArrayBuffer> ArrayBuffer::create(ArrayBuffer* other)
 
 ArrayBuffer::ArrayBuffer(void* data, unsigned sizeInBytes)
     : m_sizeInBytes(sizeInBytes)
-    , m_data(data) {
+    , m_data(data)
+{
 }
 
-void* ArrayBuffer::data() {
+void* ArrayBuffer::data()
+{
     return m_data;
 }
 
-const void* ArrayBuffer::data() const {
+const void* ArrayBuffer::data() const
+{
     return m_data;
 }
 
-unsigned ArrayBuffer::byteLength() const {
+unsigned ArrayBuffer::byteLength() const
+{
     return m_sizeInBytes;
 }
 
-ArrayBuffer::~ArrayBuffer() {
+ArrayBuffer::~ArrayBuffer()
+{
     WTF::fastFree(m_data);
 }
 
-void* ArrayBuffer::tryAllocate(unsigned numElements, unsigned elementByteSize) {
+void* ArrayBuffer::tryAllocate(unsigned numElements, unsigned elementByteSize)
+{
     void* result;
     // Do not allow 32-bit overflow of the total size
     if (numElements) {
diff --git a/WebCore/html/canvas/ArrayBufferView.cpp b/WebCore/html/canvas/ArrayBufferView.cpp
index 787fd61..bd22f88 100644
--- a/WebCore/html/canvas/ArrayBufferView.cpp
+++ b/WebCore/html/canvas/ArrayBufferView.cpp
@@ -28,6 +28,7 @@
 #if ENABLE(3D_CANVAS)
 
 #include "ArrayBufferView.h"
+
 #include "ArrayBuffer.h"
 
 namespace WebCore {
@@ -46,9 +47,9 @@ ArrayBufferView::~ArrayBufferView()
 
 void ArrayBufferView::setImpl(ArrayBufferView* array, unsigned byteOffset, ExceptionCode& ec)
 {
-    if (byteOffset > byteLength() ||
-        byteOffset + array->byteLength() > byteLength() ||
-        byteOffset + array->byteLength() < byteOffset) {
+    if (byteOffset > byteLength()
+        || byteOffset + array->byteLength() > byteLength()
+        || byteOffset + array->byteLength() < byteOffset) {
         // Out of range offset or overflow
         ec = INDEX_SIZE_ERR;
         return;
diff --git a/WebCore/html/canvas/ArrayBufferView.h b/WebCore/html/canvas/ArrayBufferView.h
index dcf6d13..29ad691 100644
--- a/WebCore/html/canvas/ArrayBufferView.h
+++ b/WebCore/html/canvas/ArrayBufferView.h
@@ -26,13 +26,14 @@
 #ifndef ArrayBufferView_h
 #define ArrayBufferView_h
 
-#include <algorithm>
+#include "ArrayBuffer.h"
 #include "ExceptionCode.h"
+
+#include <algorithm>
 #include <limits.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 #include <wtf/RefPtr.h>
-#include "ArrayBuffer.h"
 
 namespace WebCore {
 
diff --git a/WebCore/html/canvas/TypedArrayBase.h b/WebCore/html/canvas/TypedArrayBase.h
index a8bebd9..c55896b 100644
--- a/WebCore/html/canvas/TypedArrayBase.h
+++ b/WebCore/html/canvas/TypedArrayBase.h
@@ -27,8 +27,8 @@
 #ifndef TypedArrayBase_h
 #define TypedArrayBase_h
 
-#include "ArrayBufferView.h"
 #include "ArrayBuffer.h"
+#include "ArrayBufferView.h"
 
 namespace WebCore {
 
diff --git a/WebCore/html/canvas/WebGLBuffer.cpp b/WebCore/html/canvas/WebGLBuffer.cpp
index 6454001..be797e2 100644
--- a/WebCore/html/canvas/WebGLBuffer.cpp
+++ b/WebCore/html/canvas/WebGLBuffer.cpp
@@ -28,6 +28,7 @@
 #if ENABLE(3D_CANVAS)
 
 #include "WebGLBuffer.h"
+
 #include "WebGLRenderingContext.h"
 
 namespace WebCore {
@@ -47,7 +48,7 @@ WebGLBuffer::WebGLBuffer(WebGLRenderingContext* ctx)
     clearCachedMaxIndices();
 }
 
-void WebGLBuffer::_deleteObject(Platform3DObject object)
+void WebGLBuffer::deleteObjectImpl(Platform3DObject object)
 {
     context()->graphicsContext3D()->deleteBuffer(object);
 }
@@ -66,7 +67,9 @@ bool WebGLBuffer::associateBufferData(int size)
             return false;
         }
         return true;
-    } else if (m_target == GraphicsContext3D::ARRAY_BUFFER) {
+    }
+
+    if (m_target == GraphicsContext3D::ARRAY_BUFFER) {
         m_byteLength = size;
         return true;
     }
diff --git a/WebCore/html/canvas/WebGLBuffer.h b/WebCore/html/canvas/WebGLBuffer.h
index ac8273e..8df84a5 100644
--- a/WebCore/html/canvas/WebGLBuffer.h
+++ b/WebCore/html/canvas/WebGLBuffer.h
@@ -26,72 +26,72 @@
 #ifndef WebGLBuffer_h
 #define WebGLBuffer_h
 
-#include "WebGLObject.h"
 #include "ArrayBuffer.h"
+#include "WebGLObject.h"
 
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
-    
-    class WebGLBuffer : public WebGLObject {
-    public:
-        virtual ~WebGLBuffer() { deleteObject(); }
-        
-        static PassRefPtr<WebGLBuffer> create(WebGLRenderingContext*);
-
-        bool associateBufferData(int size);
-        bool associateBufferData(ArrayBuffer* array);
-        bool associateBufferData(ArrayBufferView* array);
-        bool associateBufferSubData(long offset, ArrayBuffer* array);
-        bool associateBufferSubData(long offset, ArrayBufferView* array);
-        
-        unsigned byteLength() const;
-        const ArrayBuffer* elementArrayBuffer() const { return m_elementArrayBuffer.get(); }
-                        
-        // Gets the cached max index for the given type. Returns -1 if
-        // none has been set.
-        long getCachedMaxIndex(unsigned long type);
-        // Sets the cached max index for the given type.
-        void setCachedMaxIndex(unsigned long type, long value);
-
-        unsigned long getTarget() const { return m_target; }
-        void setTarget(unsigned long);
-
-    protected:
-        WebGLBuffer(WebGLRenderingContext*);
-
-        virtual void _deleteObject(Platform3DObject o);
-    
-    private:
-        virtual bool isBuffer() const { return true; }
-
-        unsigned long m_target;
-
-        RefPtr<ArrayBuffer> m_elementArrayBuffer;
-        unsigned m_byteLength;
-
-        // Optimization for index validation. For each type of index
-        // (i.e., UNSIGNED_SHORT), cache the maximum index in the
-        // entire buffer.
-        // 
-        // This is sufficient to eliminate a lot of work upon each
-        // draw call as long as all bound array buffers are at least
-        // that size.
-        struct MaxIndexCacheEntry {
-            unsigned long type;
-            long maxIndex;
-        };
-        // OpenGL ES 2.0 only has two valid index types (UNSIGNED_BYTE
-        // and UNSIGNED_SHORT), but might as well leave open the
-        // possibility of adding others.
-        MaxIndexCacheEntry m_maxIndexCache[4];
-        unsigned m_nextAvailableCacheEntry;
-
-        // Clears all of the cached max indices.
-        void clearCachedMaxIndices();
+
+class WebGLBuffer : public WebGLObject {
+public:
+    virtual ~WebGLBuffer() { deleteObject(); }
+
+    static PassRefPtr<WebGLBuffer> create(WebGLRenderingContext*);
+
+    bool associateBufferData(int size);
+    bool associateBufferData(ArrayBuffer* array);
+    bool associateBufferData(ArrayBufferView* array);
+    bool associateBufferSubData(long offset, ArrayBuffer* array);
+    bool associateBufferSubData(long offset, ArrayBufferView* array);
+
+    unsigned byteLength() const;
+    const ArrayBuffer* elementArrayBuffer() const { return m_elementArrayBuffer.get(); }
+
+    // Gets the cached max index for the given type. Returns -1 if
+    // none has been set.
+    long getCachedMaxIndex(unsigned long type);
+    // Sets the cached max index for the given type.
+    void setCachedMaxIndex(unsigned long type, long value);
+
+    unsigned long getTarget() const { return m_target; }
+    void setTarget(unsigned long);
+
+protected:
+    WebGLBuffer(WebGLRenderingContext*);
+
+    virtual void deleteObjectImpl(Platform3DObject o);
+
+private:
+    virtual bool isBuffer() const { return true; }
+
+    unsigned long m_target;
+
+    RefPtr<ArrayBuffer> m_elementArrayBuffer;
+    unsigned m_byteLength;
+
+    // Optimization for index validation. For each type of index
+    // (i.e., UNSIGNED_SHORT), cache the maximum index in the
+    // entire buffer.
+    //
+    // This is sufficient to eliminate a lot of work upon each
+    // draw call as long as all bound array buffers are at least
+    // that size.
+    struct MaxIndexCacheEntry {
+        unsigned long type;
+        long maxIndex;
     };
-    
+    // OpenGL ES 2.0 only has two valid index types (UNSIGNED_BYTE
+    // and UNSIGNED_SHORT), but might as well leave open the
+    // possibility of adding others.
+    MaxIndexCacheEntry m_maxIndexCache[4];
+    unsigned m_nextAvailableCacheEntry;
+
+    // Clears all of the cached max indices.
+    void clearCachedMaxIndices();
+};
+
 } // namespace WebCore
 
 #endif // WebGLBuffer_h
diff --git a/WebCore/html/canvas/WebGLFramebuffer.cpp b/WebCore/html/canvas/WebGLFramebuffer.cpp
index 15ca478..bfa08b7 100644
--- a/WebCore/html/canvas/WebGLFramebuffer.cpp
+++ b/WebCore/html/canvas/WebGLFramebuffer.cpp
@@ -28,6 +28,7 @@
 #if ENABLE(3D_CANVAS)
 
 #include "WebGLFramebuffer.h"
+
 #include "WebGLRenderingContext.h"
 
 namespace WebCore {
@@ -105,7 +106,7 @@ unsigned long WebGLFramebuffer::getColorBufferFormat()
     return 0;
 }
 
-void WebGLFramebuffer::_deleteObject(Platform3DObject object)
+void WebGLFramebuffer::deleteObjectImpl(Platform3DObject object)
 {
     context()->graphicsContext3D()->deleteFramebuffer(object);
 }
diff --git a/WebCore/html/canvas/WebGLFramebuffer.h b/WebCore/html/canvas/WebGLFramebuffer.h
index 7b9b0e3..ac945dd 100644
--- a/WebCore/html/canvas/WebGLFramebuffer.h
+++ b/WebCore/html/canvas/WebGLFramebuffer.h
@@ -33,52 +33,52 @@
 
 namespace WebCore {
 
-    class WebGLFramebuffer : public WebGLObject {
-    public:
-        virtual ~WebGLFramebuffer() { deleteObject(); }
-        
-        static PassRefPtr<WebGLFramebuffer> create(WebGLRenderingContext*);
-
-        bool isDepthAttached() const { return (m_depthAttachment && m_depthAttachment->object()); }
-        bool isStencilAttached() const { return (m_stencilAttachment && m_stencilAttachment->object()); }
-        bool isDepthStencilAttached() const { return (m_depthStencilAttachment && m_depthStencilAttachment->object()); }
-
-        void setAttachment(unsigned long, WebGLObject*);
-
-        // This function is called right after a framebuffer is bound.
-        // Because renderbuffers and textures attached to the framebuffer might
-        // have changed and the framebuffer might have become complete when it
-        // isn't bound, so we need to clear un-initialized renderbuffers.
-        void onBind();
-
-        // When a texture or a renderbuffer changes, we need to check the
-        // current bound framebuffer; if the newly changed object is attached
-        // to the framebuffer and the framebuffer becomes complete, we need to
-        // clear un-initialized renderbuffers.
-        void onAttachedObjectChange(WebGLObject*);
-
-        unsigned long getColorBufferFormat();
-
-    protected:
-        WebGLFramebuffer(WebGLRenderingContext*);
-        
-        virtual void _deleteObject(Platform3DObject);
-
-    private:
-        virtual bool isFramebuffer() const { return true; }
-
-        bool isUninitialized(WebGLObject*);
-        void setInitialized(WebGLObject*);
-        void initializeRenderbuffers();
-
-        // These objects are kept alive by the global table in
-        // WebGLRenderingContext.
-        WebGLObject* m_colorAttachment;
-        WebGLObject* m_depthAttachment;
-        WebGLObject* m_stencilAttachment;
-        WebGLObject* m_depthStencilAttachment;
-    };
-    
+class WebGLFramebuffer : public WebGLObject {
+public:
+    virtual ~WebGLFramebuffer() { deleteObject(); }
+
+    static PassRefPtr<WebGLFramebuffer> create(WebGLRenderingContext*);
+
+    bool isDepthAttached() const { return (m_depthAttachment && m_depthAttachment->object()); }
+    bool isStencilAttached() const { return (m_stencilAttachment && m_stencilAttachment->object()); }
+    bool isDepthStencilAttached() const { return (m_depthStencilAttachment && m_depthStencilAttachment->object()); }
+
+    void setAttachment(unsigned long, WebGLObject*);
+
+    // This function is called right after a framebuffer is bound.
+    // Because renderbuffers and textures attached to the framebuffer might
+    // have changed and the framebuffer might have become complete when it
+    // isn't bound, so we need to clear un-initialized renderbuffers.
+    void onBind();
+
+    // When a texture or a renderbuffer changes, we need to check the
+    // current bound framebuffer; if the newly changed object is attached
+    // to the framebuffer and the framebuffer becomes complete, we need to
+    // clear un-initialized renderbuffers.
+    void onAttachedObjectChange(WebGLObject*);
+
+    unsigned long getColorBufferFormat();
+
+protected:
+    WebGLFramebuffer(WebGLRenderingContext*);
+
+    virtual void deleteObjectImpl(Platform3DObject);
+
+private:
+    virtual bool isFramebuffer() const { return true; }
+
+    bool isUninitialized(WebGLObject*);
+    void setInitialized(WebGLObject*);
+    void initializeRenderbuffers();
+
+    // These objects are kept alive by the global table in
+    // WebGLRenderingContext.
+    WebGLObject* m_colorAttachment;
+    WebGLObject* m_depthAttachment;
+    WebGLObject* m_stencilAttachment;
+    WebGLObject* m_depthStencilAttachment;
+};
+
 } // namespace WebCore
 
 #endif // WebGLFramebuffer_h
diff --git a/WebCore/html/canvas/WebGLGetInfo.cpp b/WebCore/html/canvas/WebGLGetInfo.cpp
index 0c8b548..6aff82f 100644
--- a/WebCore/html/canvas/WebGLGetInfo.cpp
+++ b/WebCore/html/canvas/WebGLGetInfo.cpp
@@ -29,14 +29,15 @@
 #if ENABLE(3D_CANVAS)
 
 #include "WebGLGetInfo.h"
-#include "WebGLBuffer.h"
+
 #include "Float32Array.h"
-#include "WebGLFramebuffer.h"
 #include "Int32Array.h"
+#include "Uint8Array.h"
+#include "WebGLBuffer.h"
+#include "WebGLFramebuffer.h"
 #include "WebGLProgram.h"
 #include "WebGLRenderbuffer.h"
 #include "WebGLTexture.h"
-#include "Uint8Array.h"
 
 namespace WebCore {
 
diff --git a/WebCore/html/canvas/WebGLGetInfo.h b/WebCore/html/canvas/WebGLGetInfo.h
index 94f6f9b..caee520 100644
--- a/WebCore/html/canvas/WebGLGetInfo.h
+++ b/WebCore/html/canvas/WebGLGetInfo.h
@@ -27,20 +27,18 @@
 #ifndef WebGLGetInfo_h
 #define WebGLGetInfo_h
 
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
+#include "Float32Array.h"
+#include "Int32Array.h"
 #include "PlatformString.h"
-
+#include "Uint8Array.h"
 #include "WebGLBuffer.h"
-#include "Float32Array.h"
 #include "WebGLFramebuffer.h"
-#include "Int32Array.h"
-// FIXME: implement WebGLObjectArray
-//#include "WebGLObjectArray.h"
 #include "WebGLProgram.h"
 #include "WebGLRenderbuffer.h"
 #include "WebGLTexture.h"
-#include "Uint8Array.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
@@ -74,7 +72,7 @@ public:
     WebGLGetInfo(const bool* value, int size);
     WebGLGetInfo(float value);
     WebGLGetInfo(long value);
-    // Represents the NULL value and type
+    // Represents the null value and type.
     WebGLGetInfo();
     WebGLGetInfo(const String& value);
     WebGLGetInfo(unsigned long value);
@@ -132,4 +130,4 @@ private:
 
 } // namespace WebCore
 
-#endif  // WebGLGetInfo_h
+#endif // WebGLGetInfo_h
diff --git a/WebCore/html/canvas/WebGLObject.cpp b/WebCore/html/canvas/WebGLObject.cpp
index 2ad5d56..6a34269 100644
--- a/WebCore/html/canvas/WebGLObject.cpp
+++ b/WebCore/html/canvas/WebGLObject.cpp
@@ -28,6 +28,7 @@
 #if ENABLE(3D_CANVAS)
 
 #include "WebGLObject.h"
+
 #include "WebGLRenderingContext.h"
 
 namespace WebCore {
@@ -61,7 +62,7 @@ void WebGLObject::deleteObject()
         if (m_shouldDeleteObject)
             if (m_context) {
                 m_context->graphicsContext3D()->makeContextCurrent();
-                _deleteObject(m_object);
+                deleteObjectImpl(m_object);
             }
         m_object = 0;
     }
diff --git a/WebCore/html/canvas/WebGLObject.h b/WebCore/html/canvas/WebGLObject.h
index 1d559b5..b66311f 100644
--- a/WebCore/html/canvas/WebGLObject.h
+++ b/WebCore/html/canvas/WebGLObject.h
@@ -26,54 +26,54 @@
 #ifndef WebGLObject_h
 #define WebGLObject_h
 
+#include "GraphicsContext3D.h"
+
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
-#include "GraphicsContext3D.h"
-
 namespace WebCore {
 
-    class WebGLRenderingContext;
-    
-    class WebGLObject : public RefCounted<WebGLObject> {
-    public:
-        virtual ~WebGLObject();
-        
-        Platform3DObject object() const { return m_object; }
-        void setObject(Platform3DObject, bool shouldDeleteObject = true);
-        void deleteObject();
-        
-        void detachContext()
-        {
-            deleteObject();
-            m_context = 0;
-        }
+class WebGLRenderingContext;
+
+class WebGLObject : public RefCounted<WebGLObject> {
+public:
+    virtual ~WebGLObject();
+
+    Platform3DObject object() const { return m_object; }
+    void setObject(Platform3DObject, bool shouldDeleteObject = true);
+    void deleteObject();
+
+    void detachContext()
+    {
+        deleteObject();
+        m_context = 0;
+    }
+
+    WebGLRenderingContext* context() const { return m_context; }
+
+    virtual bool isBuffer() const { return false; }
+    virtual bool isFramebuffer() const { return false; }
+    virtual bool isProgram() const { return false; }
+    virtual bool isRenderbuffer() const { return false; }
+    virtual bool isShader() const { return false; }
+    virtual bool isTexture() const { return false; }
 
-        WebGLRenderingContext* context() const { return m_context; }
+protected:
+    WebGLObject(WebGLRenderingContext*);
+    virtual void deleteObjectImpl(Platform3DObject) = 0;
 
-        virtual bool isBuffer() const { return false; }
-        virtual bool isFramebuffer() const { return false; }
-        virtual bool isProgram() const { return false; }
-        virtual bool isRenderbuffer() const { return false; }
-        virtual bool isShader() const { return false; }
-        virtual bool isTexture() const { return false; }
+private:
+    Platform3DObject m_object;
+    // The shouldDeleteObject flag indicates whether this wrapper
+    // owns the underlying resource and should delete it when the
+    // wrapper is unreferenced for the last time and deleted. It
+    // is only set to false for certain objects returned from get
+    // queries. FIXME: should consider canonicalizing all of these
+    // objects in the future.
+    bool m_shouldDeleteObject;
+    WebGLRenderingContext* m_context;
+};
 
-    protected:
-        WebGLObject(WebGLRenderingContext*);
-        virtual void _deleteObject(Platform3DObject) = 0;
-    
-    private:
-        Platform3DObject m_object;
-        // The shouldDeleteObject flag indicates whether this wrapper
-        // owns the underlying resource and should delete it when the
-        // wrapper is unreferenced for the last time and deleted. It
-        // is only set to false for certain objects returned from get
-        // queries. FIXME: should consider canonicalizing all of these
-        // objects in the future.
-        bool m_shouldDeleteObject;
-        WebGLRenderingContext* m_context;
-    };
-    
 } // namespace WebCore
 
 #endif // WebGLObject_h
diff --git a/WebCore/html/canvas/WebGLProgram.cpp b/WebCore/html/canvas/WebGLProgram.cpp
index cd7fb56..846b171 100644
--- a/WebCore/html/canvas/WebGLProgram.cpp
+++ b/WebCore/html/canvas/WebGLProgram.cpp
@@ -28,6 +28,7 @@
 #if ENABLE(3D_CANVAS)
 
 #include "WebGLProgram.h"
+
 #include "WebGLRenderingContext.h"
 
 namespace WebCore {
@@ -44,7 +45,7 @@ WebGLProgram::WebGLProgram(WebGLRenderingContext* ctx)
     setObject(context()->graphicsContext3D()->createProgram());
 }
 
-void WebGLProgram::_deleteObject(Platform3DObject object)
+void WebGLProgram::deleteObjectImpl(Platform3DObject object)
 {
     context()->graphicsContext3D()->deleteProgram(object);
 }
diff --git a/WebCore/html/canvas/WebGLProgram.h b/WebCore/html/canvas/WebGLProgram.h
index 2b4838a..0156938 100644
--- a/WebCore/html/canvas/WebGLProgram.h
+++ b/WebCore/html/canvas/WebGLProgram.h
@@ -33,40 +33,40 @@
 #include <wtf/Vector.h>
 
 namespace WebCore {
-    
-    class WebGLProgram : public WebGLObject {
-    public:
-        virtual ~WebGLProgram() { deleteObject(); }
-        
-        static PassRefPtr<WebGLProgram> create(WebGLRenderingContext*);
-
-        // cacheActiveAttribLocation() is only called once after linkProgram()
-        // succeeds.
-        bool cacheActiveAttribLocations();
-        int numActiveAttribLocations() const;
-        int getActiveAttribLocation(int index) const;
-
-        bool isUsingVertexAttrib0() const;
-
-        // Return true means getProgramParameter(LINK_STATUS) should return
-        // false; return false means we should actually call
-        // getProgramParameter(LINK_STATUS) to find out.
-        bool isLinkFailureFlagSet() const { return m_linkFailure; }
-        void setLinkFailureFlag(bool failed) { m_linkFailure = failed; }
-
-    protected:
-        WebGLProgram(WebGLRenderingContext*);
-        
-        virtual void _deleteObject(Platform3DObject);
-
-    private:
-        virtual bool isProgram() const { return true; }
-
-        Vector<int> m_activeAttribLocations;
-
-        bool m_linkFailure;
-    };
-    
+
+class WebGLProgram : public WebGLObject {
+public:
+    virtual ~WebGLProgram() { deleteObject(); }
+
+    static PassRefPtr<WebGLProgram> create(WebGLRenderingContext*);
+
+    // cacheActiveAttribLocation() is only called once after linkProgram()
+    // succeeds.
+    bool cacheActiveAttribLocations();
+    int numActiveAttribLocations() const;
+    int getActiveAttribLocation(int index) const;
+
+    bool isUsingVertexAttrib0() const;
+
+    // Return true means getProgramParameter(LINK_STATUS) should return
+    // false; return false means we should actually call
+    // getProgramParameter(LINK_STATUS) to find out.
+    bool isLinkFailureFlagSet() const { return m_linkFailure; }
+    void setLinkFailureFlag(bool failed) { m_linkFailure = failed; }
+
+protected:
+    WebGLProgram(WebGLRenderingContext*);
+
+    virtual void deleteObjectImpl(Platform3DObject);
+
+private:
+    virtual bool isProgram() const { return true; }
+
+    Vector<int> m_activeAttribLocations;
+
+    bool m_linkFailure;
+};
+
 } // namespace WebCore
 
 #endif // WebGLProgram_h
diff --git a/WebCore/html/canvas/WebGLRenderbuffer.cpp b/WebCore/html/canvas/WebGLRenderbuffer.cpp
index 9f16a5c..7bc2eec 100644
--- a/WebCore/html/canvas/WebGLRenderbuffer.cpp
+++ b/WebCore/html/canvas/WebGLRenderbuffer.cpp
@@ -28,6 +28,7 @@
 #if ENABLE(3D_CANVAS)
 
 #include "WebGLRenderbuffer.h"
+
 #include "WebGLRenderingContext.h"
 
 namespace WebCore {
@@ -45,7 +46,7 @@ WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContext* ctx)
     setObject(context()->graphicsContext3D()->createRenderbuffer());
 }
 
-void WebGLRenderbuffer::_deleteObject(Platform3DObject object)
+void WebGLRenderbuffer::deleteObjectImpl(Platform3DObject object)
 {
     context()->graphicsContext3D()->deleteRenderbuffer(object);
 }
diff --git a/WebCore/html/canvas/WebGLRenderbuffer.h b/WebCore/html/canvas/WebGLRenderbuffer.h
index b849b05..5765061 100644
--- a/WebCore/html/canvas/WebGLRenderbuffer.h
+++ b/WebCore/html/canvas/WebGLRenderbuffer.h
@@ -32,31 +32,31 @@
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
-    
-    class WebGLRenderbuffer : public WebGLObject {
-    public:
-        virtual ~WebGLRenderbuffer() { deleteObject(); }
-        
-        static PassRefPtr<WebGLRenderbuffer> create(WebGLRenderingContext*);
-
-        void setInternalFormat(unsigned long internalformat) { m_internalFormat = internalformat; }
-        unsigned long getInternalFormat() const { return m_internalFormat; }
-
-        bool isInitialized() const { return m_initialized; }
-        void setInitialized() { m_initialized = true; }
-
-    protected:
-        WebGLRenderbuffer(WebGLRenderingContext*);
-        
-        virtual void _deleteObject(Platform3DObject);
-
-    private:
-        virtual bool isRenderbuffer() const { return true; }
-
-        unsigned long m_internalFormat;
-        bool m_initialized;
-    };
-    
+
+class WebGLRenderbuffer : public WebGLObject {
+public:
+    virtual ~WebGLRenderbuffer() { deleteObject(); }
+
+    static PassRefPtr<WebGLRenderbuffer> create(WebGLRenderingContext*);
+
+    void setInternalFormat(unsigned long internalformat) { m_internalFormat = internalformat; }
+    unsigned long getInternalFormat() const { return m_internalFormat; }
+
+    bool isInitialized() const { return m_initialized; }
+    void setInitialized() { m_initialized = true; }
+
+protected:
+    WebGLRenderbuffer(WebGLRenderingContext*);
+
+    virtual void deleteObjectImpl(Platform3DObject);
+
+private:
+    virtual bool isRenderbuffer() const { return true; }
+
+    unsigned long m_internalFormat;
+    bool m_initialized;
+};
+
 } // namespace WebCore
 
 #endif // WebGLRenderbuffer_h
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index 70507b6..5f9ad91 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -29,8 +29,8 @@
 
 #include "WebGLRenderingContext.h"
 
-#include "CheckedInt.h"
 #include "CanvasPixelArray.h"
+#include "CheckedInt.h"
 #include "Console.h"
 #include "DOMWindow.h"
 #include "FrameView.h"
@@ -41,15 +41,15 @@
 #include "NotImplemented.h"
 #include "RenderBox.h"
 #include "RenderLayer.h"
-#include "WebGLActiveInfo.h"
 #include "Uint16Array.h"
+#include "WebGLActiveInfo.h"
 #include "WebGLBuffer.h"
 #include "WebGLContextAttributes.h"
 #include "WebGLFramebuffer.h"
 #include "WebGLProgram.h"
 #include "WebGLRenderbuffer.h"
-#include "WebGLTexture.h"
 #include "WebGLShader.h"
+#include "WebGLTexture.h"
 #include "WebGLUniformLocation.h"
 
 #include <wtf/ByteArray.h>
@@ -171,9 +171,8 @@ bool WebGLRenderingContext::paintRenderingResultsToCanvas()
 
 void WebGLRenderingContext::beginPaint()
 {
-    if (m_markedCanvasDirty) {
+    if (m_markedCanvasDirty)
         m_context->beginPaint(this);
-    }
 }
 
 void WebGLRenderingContext::endPaint()
@@ -350,7 +349,7 @@ void WebGLRenderingContext::blendColor(double red, double green, double blue, do
     cleanupAfterGraphicsCall(false);
 }
 
-void WebGLRenderingContext::blendEquation( unsigned long mode )
+void WebGLRenderingContext::blendEquation(unsigned long mode)
 {
     if (!isGLES2Compliant()) {
         if (!validateBlendEquation(mode))
@@ -1143,9 +1142,8 @@ PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveAttrib(WebGLProgram*
     ActiveInfo info;
     if (!validateWebGLObject(program))
         return 0;
-    if (!m_context->getActiveAttrib(objectOrZero(program), index, info)) {
+    if (!m_context->getActiveAttrib(objectOrZero(program), index, info))
         return 0;
-    }
     return WebGLActiveInfo::create(info.name, info.type, info.size);
 }
 
@@ -1155,13 +1153,11 @@ PassRefPtr<WebGLActiveInfo> WebGLRenderingContext::getActiveUniform(WebGLProgram
     ActiveInfo info;
     if (!validateWebGLObject(program))
         return 0;
-    if (!m_context->getActiveUniform(objectOrZero(program), index, info)) {
+    if (!m_context->getActiveUniform(objectOrZero(program), index, info))
         return 0;
-    }
-    if (!isGLES2Compliant()) {
+    if (!isGLES2Compliant())
         if (info.size > 1 && !info.name.endsWith("[0]"))
             info.name.append("[0]");
-    }
     return WebGLActiveInfo::create(info.name, info.type, info.size);
 }
 
@@ -1215,8 +1211,7 @@ WebGLGetInfo WebGLRenderingContext::getBufferParameter(unsigned long target, uns
     m_context->getBufferParameteriv(target, pname, &value);
     if (pname == GraphicsContext3D::BUFFER_SIZE)
         return WebGLGetInfo(static_cast<long>(value));
-    else
-        return WebGLGetInfo(static_cast<unsigned long>(value));
+    return WebGLGetInfo(static_cast<unsigned long>(value));
 }
 
 PassRefPtr<WebGLContextAttributes> WebGLRenderingContext::getContextAttributes()
@@ -1258,23 +1253,22 @@ WebGLGetInfo WebGLRenderingContext::getFramebufferAttachmentParameter(unsigned l
         m_context->getFramebufferAttachmentParameteriv(target, attachment, pname, &value);
         if (pname == GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE)
             return WebGLGetInfo(static_cast<unsigned long>(value));
-        else
-            return WebGLGetInfo(static_cast<long>(value));
-    } else {
-        WebGLStateRestorer(this, false);
-        int type = 0;
-        m_context->getFramebufferAttachmentParameteriv(target, attachment, GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type);
-        int value = 0;
-        m_context->getFramebufferAttachmentParameteriv(target, attachment, GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &value);
-        switch (type) {
-        case GraphicsContext3D::RENDERBUFFER:
-            return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(findRenderbuffer(static_cast<Platform3DObject>(value))));
-        case GraphicsContext3D::TEXTURE:
-            return WebGLGetInfo(PassRefPtr<WebGLTexture>(findTexture(static_cast<Platform3DObject>(value))));
-        default:
-            // FIXME: raise exception?
-            return WebGLGetInfo();
-        }
+        return WebGLGetInfo(static_cast<long>(value));
+    }
+
+    WebGLStateRestorer(this, false);
+    int type = 0;
+    m_context->getFramebufferAttachmentParameteriv(target, attachment, GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, &type);
+    int value = 0;
+    m_context->getFramebufferAttachmentParameteriv(target, attachment, GraphicsContext3D::FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, &value);
+    switch (type) {
+    case GraphicsContext3D::RENDERBUFFER:
+        return WebGLGetInfo(PassRefPtr<WebGLRenderbuffer>(findRenderbuffer(static_cast<Platform3DObject>(value))));
+    case GraphicsContext3D::TEXTURE:
+        return WebGLGetInfo(PassRefPtr<WebGLTexture>(findTexture(static_cast<Platform3DObject>(value))));
+    default:
+        // FIXME: raise exception?
+        return WebGLGetInfo();
     }
 }
 
@@ -3050,7 +3044,7 @@ void WebGLRenderingContext::vertexAttribPointer(unsigned long index, long size,
         m_vertexAttribState.resize(index + 1);
 
     long validatedStride = bytesPerElement;
-    if (stride != 0) {
+    if (stride) {
         if ((long) stride < bytesPerElement) {
             m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE);
             return;
diff --git a/WebCore/html/canvas/WebGLRenderingContext.h b/WebCore/html/canvas/WebGLRenderingContext.h
index 7164433..b5a6343 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.h
+++ b/WebCore/html/canvas/WebGLRenderingContext.h
@@ -29,11 +29,11 @@
 #include "CanvasRenderingContext.h"
 #include "ExceptionCode.h"
 #include "Float32Array.h"
-#include "WebGLGetInfo.h"
-#include "Int32Array.h"
-#include "Uint8Array.h"
 #include "GraphicsContext3D.h"
+#include "Int32Array.h"
 #include "PlatformString.h"
+#include "Uint8Array.h"
+#include "WebGLGetInfo.h"
 
 namespace WebCore {
 
@@ -52,481 +52,481 @@ class HTMLVideoElement;
 class ImageData;
 class WebKitCSSMatrix;
 
-    class WebGLRenderingContext : public CanvasRenderingContext {
-    public:
-        static PassOwnPtr<WebGLRenderingContext> create(HTMLCanvasElement*, WebGLContextAttributes*);
-        virtual ~WebGLRenderingContext();
-
-        virtual bool is3d() const { return true; }
-        virtual bool isAccelerated() const { return true; }
-
-        // Helper to return the size in bytes of OpenGL data types
-        // like GL_FLOAT, GL_INT, etc.
-        int sizeInBytes(int type, ExceptionCode& ec);
-
-        void activeTexture(unsigned long texture, ExceptionCode& ec);
-        void attachShader(WebGLProgram*, WebGLShader*, ExceptionCode& ec);
-        void bindAttribLocation(WebGLProgram*, unsigned long index, const String& name, ExceptionCode& ec);
-        void bindBuffer(unsigned long target, WebGLBuffer*, ExceptionCode& ec);
-        void bindFramebuffer(unsigned long target, WebGLFramebuffer*, ExceptionCode& ec);
-        void bindRenderbuffer(unsigned long target, WebGLRenderbuffer*, ExceptionCode& ec);
-        void bindTexture(unsigned long target, WebGLTexture*, ExceptionCode& ec);
-        void blendColor(double red, double green, double blue, double alpha);
-        void blendEquation(unsigned long mode);
-        void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha);
-        void blendFunc(unsigned long sfactor, unsigned long dfactor);
-        void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha);
+class WebGLRenderingContext : public CanvasRenderingContext {
+public:
+    static PassOwnPtr<WebGLRenderingContext> create(HTMLCanvasElement*, WebGLContextAttributes*);
+    virtual ~WebGLRenderingContext();
 
-        void bufferData(unsigned long target, int size, unsigned long usage, ExceptionCode&);
-        void bufferData(unsigned long target, ArrayBuffer* data, unsigned long usage, ExceptionCode&);
-        void bufferData(unsigned long target, ArrayBufferView* data, unsigned long usage, ExceptionCode&);
-        void bufferSubData(unsigned long target, long offset, ArrayBuffer* data, ExceptionCode&);
-        void bufferSubData(unsigned long target, long offset, ArrayBufferView* data, ExceptionCode&);
-
-        unsigned long checkFramebufferStatus(unsigned long target);
-        void clear(unsigned long mask);
-        void clearColor(double red, double green, double blue, double alpha);
-        void clearDepth(double);
-        void clearStencil(long);
-        void colorMask(bool red, bool green, bool blue, bool alpha);
-        void compileShader(WebGLShader*, ExceptionCode& ec);
-        
-        //void compressedTexImage2D(unsigned long target, long level, unsigned long internalformat, unsigned long width, unsigned long height, long border, unsigned long imageSize, const void* data);
-        //void compressedTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, unsigned long width, unsigned long height, unsigned long format, unsigned long imageSize, const void* data);
-        
-        void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border);
-        void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height);
-
-        PassRefPtr<WebGLBuffer> createBuffer();
-        PassRefPtr<WebGLFramebuffer> createFramebuffer();
-        PassRefPtr<WebGLProgram> createProgram();
-        PassRefPtr<WebGLRenderbuffer> createRenderbuffer();
-        PassRefPtr<WebGLShader> createShader(unsigned long type, ExceptionCode&);
-        PassRefPtr<WebGLTexture> createTexture();
-
-        void cullFace(unsigned long mode);
-
-        void deleteBuffer(WebGLBuffer*);
-        void deleteFramebuffer(WebGLFramebuffer*);
-        void deleteProgram(WebGLProgram*);
-        void deleteRenderbuffer(WebGLRenderbuffer*);
-        void deleteShader(WebGLShader*);
-        void deleteTexture(WebGLTexture*);
-        
-        void depthFunc(unsigned long);
-        void depthMask(bool);
-        void depthRange(double zNear, double zFar);
-        void detachShader(WebGLProgram*, WebGLShader*, ExceptionCode&);
-        void disable(unsigned long cap);
-        void disableVertexAttribArray(unsigned long index, ExceptionCode&);
-        void drawArrays(unsigned long mode, long first, long count, ExceptionCode&);
-        void drawElements(unsigned long mode, long count, unsigned long type, long offset, ExceptionCode&);
-
-        void enable(unsigned long cap);
-        void enableVertexAttribArray(unsigned long index, ExceptionCode&);
-        void finish();
-        void flush();
-        void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer*, ExceptionCode& ec);
-        void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture*, long level, ExceptionCode& ec);
-        void frontFace(unsigned long mode);
-        void generateMipmap(unsigned long target);
-
-        PassRefPtr<WebGLActiveInfo> getActiveAttrib(WebGLProgram*, unsigned long index, ExceptionCode&);
-        PassRefPtr<WebGLActiveInfo> getActiveUniform(WebGLProgram*, unsigned long index, ExceptionCode&);
-
-        bool getAttachedShaders(WebGLProgram*, Vector<WebGLShader*>&, ExceptionCode&);
-
-        int  getAttribLocation(WebGLProgram*, const String& name);
-
-        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&);
-
-        WebGLGetInfo getParameter(unsigned long pname, ExceptionCode&);
-
-        WebGLGetInfo getProgramParameter(WebGLProgram*, unsigned long pname, ExceptionCode&);
-
-        String getProgramInfoLog(WebGLProgram*, ExceptionCode& ec);
-
-        WebGLGetInfo getRenderbufferParameter(unsigned long target, unsigned long pname, ExceptionCode&);
-
-        WebGLGetInfo getShaderParameter(WebGLShader*, unsigned long pname, ExceptionCode& ec);
-
-        String getShaderInfoLog(WebGLShader*, ExceptionCode& ec);
-
-        // TBD
-        // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
-
-        String getShaderSource(WebGLShader*, ExceptionCode&);
-        String getString(unsigned long name);
-
-        WebGLGetInfo getTexParameter(unsigned long target, unsigned long pname, ExceptionCode&);
-
-        WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*, ExceptionCode&);
-
-        PassRefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const String&, ExceptionCode&);
-
-        WebGLGetInfo getVertexAttrib(unsigned long index, unsigned long pname, ExceptionCode&);
-
-        long getVertexAttribOffset(unsigned long index, unsigned long pname);
-
-        void hint(unsigned long target, unsigned long mode);
-        bool isBuffer(WebGLBuffer*);
-        bool isEnabled(unsigned long cap);
-        bool isFramebuffer(WebGLFramebuffer*);
-        bool isProgram(WebGLProgram*);
-        bool isRenderbuffer(WebGLRenderbuffer*);
-        bool isShader(WebGLShader*);
-        bool isTexture(WebGLTexture*);
-        void lineWidth(double);
-        void linkProgram(WebGLProgram*, ExceptionCode&);
-        void pixelStorei(unsigned long pname, long param);
-        void polygonOffset(double factor, double units);
-        void readPixels(long x, long y, long width, long height, unsigned long format, unsigned long type, ArrayBufferView* pixels);
-        void releaseShaderCompiler();
-        void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height);
-        void sampleCoverage(double value, bool invert);
-        void scissor(long x, long y, unsigned long width, unsigned long height);
-        void shaderSource(WebGLShader*, const String&, ExceptionCode&);
-        void stencilFunc(unsigned long func, long ref, unsigned long mask);
-        void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask);
-        void stencilMask(unsigned long);
-        void stencilMaskSeparate(unsigned long face, unsigned long mask);
-        void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass);
-        void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass);
+    virtual bool is3d() const { return true; }
+    virtual bool isAccelerated() const { return true; }
 
-        void texImage2D(unsigned target, unsigned level, unsigned internalformat,
-                        unsigned width, unsigned height, unsigned border,
-                        unsigned format, unsigned type, ArrayBufferView* pixels, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, unsigned internalformat,
-                        unsigned format, unsigned type, ImageData* pixels, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, unsigned internalformat,
-                        unsigned format, unsigned type, HTMLImageElement* image, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, unsigned internalformat,
-                        unsigned format, unsigned type, HTMLCanvasElement* canvas, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, unsigned internalformat,
-                        unsigned format, unsigned type, HTMLVideoElement* video, ExceptionCode&);
-        // Obsolete entry points -- to be removed shortly. (FIXME)
-        void texImage2D(unsigned target, unsigned level, ImageData* pixels, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, ImageData* pixels, bool flipY, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, bool flipY, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, bool flipY, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, bool flipY, ExceptionCode&);
-        void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, bool flipY, bool premultiplyAlpha, ExceptionCode&);
-
-        void texParameterf(unsigned target, unsigned pname, float param);
-        void texParameteri(unsigned target, unsigned pname, int param);
-
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
-                           unsigned width, unsigned height,
-                           unsigned format, unsigned type, ArrayBufferView* pixels, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
-                           unsigned format, unsigned type, ImageData* pixels, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
-                           unsigned format, unsigned type, HTMLImageElement* image, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
-                           unsigned format, unsigned type, HTMLCanvasElement* canvas, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
-                           unsigned format, unsigned type, HTMLVideoElement* video, ExceptionCode&);
-        // Obsolete entry points -- to be removed shortly. (FIXME)
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, bool flipY, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, bool flipY, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, bool flipY, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLVideoElement* video, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLVideoElement* video, bool flipY, ExceptionCode&);
-        void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLVideoElement* video, bool flipY, bool premultiplyAlpha, ExceptionCode&);
-
-        void uniform1f(const WebGLUniformLocation* location, float x, ExceptionCode&);
-        void uniform1fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&);
-        void uniform1fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&);
-        void uniform1i(const WebGLUniformLocation* location, int x, ExceptionCode&);
-        void uniform1iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&);
-        void uniform1iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&);
-        void uniform2f(const WebGLUniformLocation* location, float x, float y, ExceptionCode&);
-        void uniform2fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&);
-        void uniform2fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&);
-        void uniform2i(const WebGLUniformLocation* location, int x, int y, ExceptionCode&);
-        void uniform2iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&);
-        void uniform2iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&);
-        void uniform3f(const WebGLUniformLocation* location, float x, float y, float z, ExceptionCode&);
-        void uniform3fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&);
-        void uniform3fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&);
-        void uniform3i(const WebGLUniformLocation* location, int x, int y, int z, ExceptionCode&);
-        void uniform3iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&);
-        void uniform3iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&);
-        void uniform4f(const WebGLUniformLocation* location, float x, float y, float z, float w, ExceptionCode&);
-        void uniform4fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&);
-        void uniform4fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&);
-        void uniform4i(const WebGLUniformLocation* location, int x, int y, int z, int w, ExceptionCode&);
-        void uniform4iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&);
-        void uniform4iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&);
-        void uniformMatrix2fv(const WebGLUniformLocation* location, bool transpose, Float32Array* value, ExceptionCode&);
-        void uniformMatrix2fv(const WebGLUniformLocation* location, bool transpose, float* value, int size, ExceptionCode&);
-        void uniformMatrix3fv(const WebGLUniformLocation* location, bool transpose, Float32Array* value, ExceptionCode&);
-        void uniformMatrix3fv(const WebGLUniformLocation* location, bool transpose, float* value, int size, ExceptionCode&);
-        void uniformMatrix4fv(const WebGLUniformLocation* location, bool transpose, Float32Array* value, ExceptionCode&);
-        void uniformMatrix4fv(const WebGLUniformLocation* location, bool transpose, float* value, int size, ExceptionCode&);
-
-        void useProgram(WebGLProgram*, ExceptionCode&);
-        void validateProgram(WebGLProgram*, ExceptionCode&);
-
-        void vertexAttrib1f(unsigned long index, float x);
-        void vertexAttrib1fv(unsigned long index, Float32Array* values);
-        void vertexAttrib1fv(unsigned long index, float* values, int size);
-        void vertexAttrib2f(unsigned long index, float x, float y);
-        void vertexAttrib2fv(unsigned long index, Float32Array* values);
-        void vertexAttrib2fv(unsigned long index, float* values, int size);
-        void vertexAttrib3f(unsigned long index, float x, float y, float z);
-        void vertexAttrib3fv(unsigned long index, Float32Array* values);
-        void vertexAttrib3fv(unsigned long index, float* values, int size);
-        void vertexAttrib4f(unsigned long index, float x, float y, float z, float w);
-        void vertexAttrib4fv(unsigned long index, Float32Array* values);
-        void vertexAttrib4fv(unsigned long index, float* values, int size);
-        void vertexAttribPointer(unsigned long index, long size, unsigned long type, bool normalized,
-                                 long stride, long offset, ExceptionCode&);
-
-        void viewport(long x, long y, unsigned long width, unsigned long height);
-
-        virtual GraphicsContext3D* graphicsContext3D() const { return m_context.get(); }
-    
-        void reshape(int width, int height);
-
-        // Return value true indicates canvas is updated during the call,
-        // false indicates no updates.
-        bool paintRenderingResultsToCanvas();
-
-        // Helpers for notification about paint events.
-        void beginPaint();
-        void endPaint();
-        
-        void removeObject(WebGLObject*);
-        
-    private:
-        friend class WebGLObject;
-
-        WebGLRenderingContext(HTMLCanvasElement*, PassOwnPtr<GraphicsContext3D>);
-
-        void addObject(WebGLObject*);
-        void detachAndRemoveAllObjects();
-        WebGLTexture* findTexture(Platform3DObject);
-        WebGLRenderbuffer* findRenderbuffer(Platform3DObject);
-        WebGLBuffer* findBuffer(Platform3DObject);
-        WebGLShader* findShader(Platform3DObject);
-
-        void markContextChanged();
-        void cleanupAfterGraphicsCall(bool changed)
+    // Helper to return the size in bytes of OpenGL data types
+    // like GL_FLOAT, GL_INT, etc.
+    int sizeInBytes(int type, ExceptionCode& ec);
+
+    void activeTexture(unsigned long texture, ExceptionCode& ec);
+    void attachShader(WebGLProgram*, WebGLShader*, ExceptionCode& ec);
+    void bindAttribLocation(WebGLProgram*, unsigned long index, const String& name, ExceptionCode& ec);
+    void bindBuffer(unsigned long target, WebGLBuffer*, ExceptionCode& ec);
+    void bindFramebuffer(unsigned long target, WebGLFramebuffer*, ExceptionCode& ec);
+    void bindRenderbuffer(unsigned long target, WebGLRenderbuffer*, ExceptionCode& ec);
+    void bindTexture(unsigned long target, WebGLTexture*, ExceptionCode& ec);
+    void blendColor(double red, double green, double blue, double alpha);
+    void blendEquation(unsigned long mode);
+    void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha);
+    void blendFunc(unsigned long sfactor, unsigned long dfactor);
+    void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha);
+
+    void bufferData(unsigned long target, int size, unsigned long usage, ExceptionCode&);
+    void bufferData(unsigned long target, ArrayBuffer* data, unsigned long usage, ExceptionCode&);
+    void bufferData(unsigned long target, ArrayBufferView* data, unsigned long usage, ExceptionCode&);
+    void bufferSubData(unsigned long target, long offset, ArrayBuffer* data, ExceptionCode&);
+    void bufferSubData(unsigned long target, long offset, ArrayBufferView* data, ExceptionCode&);
+
+    unsigned long checkFramebufferStatus(unsigned long target);
+    void clear(unsigned long mask);
+    void clearColor(double red, double green, double blue, double alpha);
+    void clearDepth(double);
+    void clearStencil(long);
+    void colorMask(bool red, bool green, bool blue, bool alpha);
+    void compileShader(WebGLShader*, ExceptionCode& ec);
+
+    // void compressedTexImage2D(unsigned long target, long level, unsigned long internalformat, unsigned long width, unsigned long height, long border, unsigned long imageSize, const void* data);
+    // void compressedTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, unsigned long width, unsigned long height, unsigned long format, unsigned long imageSize, const void* data);
+
+    void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border);
+    void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height);
+
+    PassRefPtr<WebGLBuffer> createBuffer();
+    PassRefPtr<WebGLFramebuffer> createFramebuffer();
+    PassRefPtr<WebGLProgram> createProgram();
+    PassRefPtr<WebGLRenderbuffer> createRenderbuffer();
+    PassRefPtr<WebGLShader> createShader(unsigned long type, ExceptionCode&);
+    PassRefPtr<WebGLTexture> createTexture();
+
+    void cullFace(unsigned long mode);
+
+    void deleteBuffer(WebGLBuffer*);
+    void deleteFramebuffer(WebGLFramebuffer*);
+    void deleteProgram(WebGLProgram*);
+    void deleteRenderbuffer(WebGLRenderbuffer*);
+    void deleteShader(WebGLShader*);
+    void deleteTexture(WebGLTexture*);
+
+    void depthFunc(unsigned long);
+    void depthMask(bool);
+    void depthRange(double zNear, double zFar);
+    void detachShader(WebGLProgram*, WebGLShader*, ExceptionCode&);
+    void disable(unsigned long cap);
+    void disableVertexAttribArray(unsigned long index, ExceptionCode&);
+    void drawArrays(unsigned long mode, long first, long count, ExceptionCode&);
+    void drawElements(unsigned long mode, long count, unsigned long type, long offset, ExceptionCode&);
+
+    void enable(unsigned long cap);
+    void enableVertexAttribArray(unsigned long index, ExceptionCode&);
+    void finish();
+    void flush();
+    void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, WebGLRenderbuffer*, ExceptionCode& ec);
+    void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, WebGLTexture*, long level, ExceptionCode& ec);
+    void frontFace(unsigned long mode);
+    void generateMipmap(unsigned long target);
+
+    PassRefPtr<WebGLActiveInfo> getActiveAttrib(WebGLProgram*, unsigned long index, ExceptionCode&);
+    PassRefPtr<WebGLActiveInfo> getActiveUniform(WebGLProgram*, unsigned long index, ExceptionCode&);
+
+    bool getAttachedShaders(WebGLProgram*, Vector<WebGLShader*>&, ExceptionCode&);
+
+    int getAttribLocation(WebGLProgram*, const String& name);
+
+    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&);
+
+    WebGLGetInfo getParameter(unsigned long pname, ExceptionCode&);
+
+    WebGLGetInfo getProgramParameter(WebGLProgram*, unsigned long pname, ExceptionCode&);
+
+    String getProgramInfoLog(WebGLProgram*, ExceptionCode& ec);
+
+    WebGLGetInfo getRenderbufferParameter(unsigned long target, unsigned long pname, ExceptionCode&);
+
+    WebGLGetInfo getShaderParameter(WebGLShader*, unsigned long pname, ExceptionCode& ec);
+
+    String getShaderInfoLog(WebGLShader*, ExceptionCode& ec);
+
+    // TBD
+    // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+
+    String getShaderSource(WebGLShader*, ExceptionCode&);
+    String getString(unsigned long name);
+
+    WebGLGetInfo getTexParameter(unsigned long target, unsigned long pname, ExceptionCode&);
+
+    WebGLGetInfo getUniform(WebGLProgram*, const WebGLUniformLocation*, ExceptionCode&);
+
+    PassRefPtr<WebGLUniformLocation> getUniformLocation(WebGLProgram*, const String&, ExceptionCode&);
+
+    WebGLGetInfo getVertexAttrib(unsigned long index, unsigned long pname, ExceptionCode&);
+
+    long getVertexAttribOffset(unsigned long index, unsigned long pname);
+
+    void hint(unsigned long target, unsigned long mode);
+    bool isBuffer(WebGLBuffer*);
+    bool isEnabled(unsigned long cap);
+    bool isFramebuffer(WebGLFramebuffer*);
+    bool isProgram(WebGLProgram*);
+    bool isRenderbuffer(WebGLRenderbuffer*);
+    bool isShader(WebGLShader*);
+    bool isTexture(WebGLTexture*);
+    void lineWidth(double);
+    void linkProgram(WebGLProgram*, ExceptionCode&);
+    void pixelStorei(unsigned long pname, long param);
+    void polygonOffset(double factor, double units);
+    void readPixels(long x, long y, long width, long height, unsigned long format, unsigned long type, ArrayBufferView* pixels);
+    void releaseShaderCompiler();
+    void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height);
+    void sampleCoverage(double value, bool invert);
+    void scissor(long x, long y, unsigned long width, unsigned long height);
+    void shaderSource(WebGLShader*, const String&, ExceptionCode&);
+    void stencilFunc(unsigned long func, long ref, unsigned long mask);
+    void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask);
+    void stencilMask(unsigned long);
+    void stencilMaskSeparate(unsigned long face, unsigned long mask);
+    void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass);
+    void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass);
+
+    void texImage2D(unsigned target, unsigned level, unsigned internalformat,
+                    unsigned width, unsigned height, unsigned border,
+                    unsigned format, unsigned type, ArrayBufferView* pixels, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, unsigned internalformat,
+                    unsigned format, unsigned type, ImageData* pixels, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, unsigned internalformat,
+                    unsigned format, unsigned type, HTMLImageElement* image, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, unsigned internalformat,
+                    unsigned format, unsigned type, HTMLCanvasElement* canvas, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, unsigned internalformat,
+                    unsigned format, unsigned type, HTMLVideoElement* video, ExceptionCode&);
+    // Obsolete entry points -- to be removed shortly. (FIXME)
+    void texImage2D(unsigned target, unsigned level, ImageData* pixels, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, ImageData* pixels, bool flipY, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, bool flipY, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, bool flipY, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, bool flipY, ExceptionCode&);
+    void texImage2D(unsigned target, unsigned level, HTMLVideoElement* video, bool flipY, bool premultiplyAlpha, ExceptionCode&);
+
+    void texParameterf(unsigned target, unsigned pname, float param);
+    void texParameteri(unsigned target, unsigned pname, int param);
+
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
+                       unsigned width, unsigned height,
+                       unsigned format, unsigned type, ArrayBufferView* pixels, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
+                       unsigned format, unsigned type, ImageData* pixels, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
+                       unsigned format, unsigned type, HTMLImageElement* image, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
+                       unsigned format, unsigned type, HTMLCanvasElement* canvas, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
+                       unsigned format, unsigned type, HTMLVideoElement* video, ExceptionCode&);
+    // Obsolete entry points -- to be removed shortly. (FIXME)
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, bool flipY, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, ImageData* pixels, bool flipY, bool premultiplyAlpha, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, bool flipY, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLImageElement* image, bool flipY, bool premultiplyAlpha, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, bool flipY, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLVideoElement* video, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLVideoElement* video, bool flipY, ExceptionCode&);
+    void texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, HTMLVideoElement* video, bool flipY, bool premultiplyAlpha, ExceptionCode&);
+
+    void uniform1f(const WebGLUniformLocation* location, float x, ExceptionCode&);
+    void uniform1fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&);
+    void uniform1fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&);
+    void uniform1i(const WebGLUniformLocation* location, int x, ExceptionCode&);
+    void uniform1iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&);
+    void uniform1iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&);
+    void uniform2f(const WebGLUniformLocation* location, float x, float y, ExceptionCode&);
+    void uniform2fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&);
+    void uniform2fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&);
+    void uniform2i(const WebGLUniformLocation* location, int x, int y, ExceptionCode&);
+    void uniform2iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&);
+    void uniform2iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&);
+    void uniform3f(const WebGLUniformLocation* location, float x, float y, float z, ExceptionCode&);
+    void uniform3fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&);
+    void uniform3fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&);
+    void uniform3i(const WebGLUniformLocation* location, int x, int y, int z, ExceptionCode&);
+    void uniform3iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&);
+    void uniform3iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&);
+    void uniform4f(const WebGLUniformLocation* location, float x, float y, float z, float w, ExceptionCode&);
+    void uniform4fv(const WebGLUniformLocation* location, Float32Array* v, ExceptionCode&);
+    void uniform4fv(const WebGLUniformLocation* location, float* v, int size, ExceptionCode&);
+    void uniform4i(const WebGLUniformLocation* location, int x, int y, int z, int w, ExceptionCode&);
+    void uniform4iv(const WebGLUniformLocation* location, Int32Array* v, ExceptionCode&);
+    void uniform4iv(const WebGLUniformLocation* location, int* v, int size, ExceptionCode&);
+    void uniformMatrix2fv(const WebGLUniformLocation* location, bool transpose, Float32Array* value, ExceptionCode&);
+    void uniformMatrix2fv(const WebGLUniformLocation* location, bool transpose, float* value, int size, ExceptionCode&);
+    void uniformMatrix3fv(const WebGLUniformLocation* location, bool transpose, Float32Array* value, ExceptionCode&);
+    void uniformMatrix3fv(const WebGLUniformLocation* location, bool transpose, float* value, int size, ExceptionCode&);
+    void uniformMatrix4fv(const WebGLUniformLocation* location, bool transpose, Float32Array* value, ExceptionCode&);
+    void uniformMatrix4fv(const WebGLUniformLocation* location, bool transpose, float* value, int size, ExceptionCode&);
+
+    void useProgram(WebGLProgram*, ExceptionCode&);
+    void validateProgram(WebGLProgram*, ExceptionCode&);
+
+    void vertexAttrib1f(unsigned long index, float x);
+    void vertexAttrib1fv(unsigned long index, Float32Array* values);
+    void vertexAttrib1fv(unsigned long index, float* values, int size);
+    void vertexAttrib2f(unsigned long index, float x, float y);
+    void vertexAttrib2fv(unsigned long index, Float32Array* values);
+    void vertexAttrib2fv(unsigned long index, float* values, int size);
+    void vertexAttrib3f(unsigned long index, float x, float y, float z);
+    void vertexAttrib3fv(unsigned long index, Float32Array* values);
+    void vertexAttrib3fv(unsigned long index, float* values, int size);
+    void vertexAttrib4f(unsigned long index, float x, float y, float z, float w);
+    void vertexAttrib4fv(unsigned long index, Float32Array* values);
+    void vertexAttrib4fv(unsigned long index, float* values, int size);
+    void vertexAttribPointer(unsigned long index, long size, unsigned long type, bool normalized,
+                             long stride, long offset, ExceptionCode&);
+
+    void viewport(long x, long y, unsigned long width, unsigned long height);
+
+    virtual GraphicsContext3D* graphicsContext3D() const { return m_context.get(); }
+
+    void reshape(int width, int height);
+
+    // Return value true indicates canvas is updated during the call,
+    // false indicates no updates.
+    bool paintRenderingResultsToCanvas();
+
+    // Helpers for notification about paint events.
+    void beginPaint();
+    void endPaint();
+
+    void removeObject(WebGLObject*);
+
+  private:
+    friend class WebGLObject;
+
+    WebGLRenderingContext(HTMLCanvasElement*, PassOwnPtr<GraphicsContext3D>);
+
+    void addObject(WebGLObject*);
+    void detachAndRemoveAllObjects();
+    WebGLTexture* findTexture(Platform3DObject);
+    WebGLRenderbuffer* findRenderbuffer(Platform3DObject);
+    WebGLBuffer* findBuffer(Platform3DObject);
+    WebGLShader* findShader(Platform3DObject);
+
+    void markContextChanged();
+    void cleanupAfterGraphicsCall(bool changed)
+    {
+        if (changed)
+            markContextChanged();
+    }
+
+    bool isGLES2Compliant();
+
+    // Basic validation of count and offset against number of elements in element array buffer
+    bool validateElementArraySize(unsigned long count, unsigned long type, long offset);
+
+    // Conservative but quick index validation
+    bool validateIndexArrayConservative(unsigned long type, long& numElementsRequired);
+
+    // Precise but slow index validation -- only done if conservative checks fail
+    bool validateIndexArrayPrecise(unsigned long count, unsigned long type, long offset, long& numElementsRequired);
+    bool validateRenderingState(long numElements);
+
+    bool validateWebGLObject(WebGLObject* object);
+
+    OwnPtr<GraphicsContext3D> m_context;
+    bool m_needsUpdate;
+    bool m_markedCanvasDirty;
+    // FIXME: I think this is broken -- it does not increment any
+    // reference counts, so may refer to destroyed objects.
+    HashSet<RefPtr<WebGLObject> > m_canvasObjects;
+
+    // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER and stored values for ELEMENT_ARRAY_BUFFER
+    RefPtr<WebGLBuffer> m_boundArrayBuffer;
+    RefPtr<WebGLBuffer> m_boundElementArrayBuffer;
+
+    // Cached values for vertex attrib range checks
+    class VertexAttribState {
+    public:
+        VertexAttribState()
+            : enabled(false)
+            , bytesPerElement(0)
+            , size(4)
+            , type(GraphicsContext3D::FLOAT)
+            , normalized(false)
+            , stride(16)
+            , originalStride(0)
+            , offset(0)
+        {
+            initValue();
+        }
+
+        void initValue()
         {
-            if (changed)
-                markContextChanged();
+            value[0] = 0.0f;
+            value[1] = 0.0f;
+            value[2] = 0.0f;
+            value[3] = 1.0f;
         }
 
-        bool isGLES2Compliant();
-        
-        // Basic validation of count and offset against number of elements in element array buffer
-        bool validateElementArraySize(unsigned long count, unsigned long type, long offset);
-
-        // Conservative but quick index validation
-        bool validateIndexArrayConservative(unsigned long type, long& numElementsRequired);
-
-        // Precise but slow index validation -- only done if conservative checks fail
-        bool validateIndexArrayPrecise(unsigned long count, unsigned long type, long offset, long& numElementsRequired);
-        bool validateRenderingState(long numElements);
-
-        bool validateWebGLObject(WebGLObject* object);
-
-        OwnPtr<GraphicsContext3D> m_context;
-        bool m_needsUpdate;
-        bool m_markedCanvasDirty;
-        // FIXME: I think this is broken -- it does not increment any
-        // reference counts, so may refer to destroyed objects.
-        HashSet<RefPtr<WebGLObject> > m_canvasObjects;
-        
-        // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER and stored values for ELEMENT_ARRAY_BUFFER
-        RefPtr<WebGLBuffer> m_boundArrayBuffer;
-        RefPtr<WebGLBuffer> m_boundElementArrayBuffer;
-    
-        // Cached values for vertex attrib range checks
-        class VertexAttribState {
-        public:
-            VertexAttribState()
-                : enabled(false)
-                , bytesPerElement(0)
-                , size(4)
-                , type(GraphicsContext3D::FLOAT)
-                , normalized(false)
-                , stride(16)
-                , originalStride(0)
-                , offset(0)
-            {
-                initValue();
-            }
-
-            void initValue()
-            {
-                value[0] = 0.0f;
-                value[1] = 0.0f;
-                value[2] = 0.0f;
-                value[3] = 1.0f;
-            }
-
-            bool enabled;
-            RefPtr<WebGLBuffer> bufferBinding;
-            long bytesPerElement;
-            long size;
-            unsigned long type;
-            bool normalized;
-            long stride;
-            long originalStride;
-            long offset;
-            float value[4];
-        };
-        
-        Vector<VertexAttribState> m_vertexAttribState;
-        unsigned m_maxVertexAttribs;
-        RefPtr<WebGLBuffer> m_vertexAttrib0Buffer;
-        long m_vertexAttrib0BufferSize;
-        float m_vertexAttrib0BufferValue[4];
-
-        RefPtr<WebGLProgram> m_currentProgram;
-        RefPtr<WebGLFramebuffer> m_framebufferBinding;
-        RefPtr<WebGLRenderbuffer> m_renderbufferBinding;
-        class TextureUnitState {
-        public:
-            RefPtr<WebGLTexture> m_texture2DBinding;
-            RefPtr<WebGLTexture> m_textureCubeMapBinding;
-        };
-        Vector<TextureUnitState> m_textureUnits;
-        unsigned long m_activeTextureUnit;
-
-        RefPtr<WebGLTexture> m_blackTexture2D;
-        RefPtr<WebGLTexture> m_blackTextureCubeMap;
-
-        int m_maxTextureSize;
-        int m_maxCubeMapTextureSize;
-        int m_maxTextureLevel;
-        int m_maxCubeMapTextureLevel;
-
-        int m_packAlignment;
-        int m_unpackAlignment;
-        unsigned long m_implementationColorReadFormat;
-        unsigned long m_implementationColorReadType;
-        bool m_unpackFlipY;
-        bool m_unpackPremultiplyAlpha;
-
-        // Helpers for getParameter and others
-        WebGLGetInfo getBooleanParameter(unsigned long pname);
-        WebGLGetInfo getBooleanArrayParameter(unsigned long pname);
-        WebGLGetInfo getFloatParameter(unsigned long pname);
-        WebGLGetInfo getIntParameter(unsigned long pname);
-        WebGLGetInfo getLongParameter(unsigned long pname);
-        WebGLGetInfo getUnsignedLongParameter(unsigned long pname);
-        WebGLGetInfo getWebGLFloatArrayParameter(unsigned long pname);
-        WebGLGetInfo getWebGLIntArrayParameter(unsigned long pname);
-
-        void texImage2DBase(unsigned target, unsigned level, unsigned internalformat,
-                            unsigned width, unsigned height, unsigned border,
-                            unsigned format, unsigned type, void* pixels, ExceptionCode&);
-        void texImage2DImpl(unsigned target, unsigned level, unsigned internalformat,
-                            unsigned format, unsigned type, Image* image,
-                            bool flipY, bool premultiplyAlpha, ExceptionCode&);
-        void texSubImage2DBase(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
-                               unsigned width, unsigned height,
-                               unsigned format, unsigned type, void* pixels, ExceptionCode&);
-        void texSubImage2DImpl(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
-                               unsigned format, unsigned type,
-                               Image* image, bool flipY, bool premultiplyAlpha, ExceptionCode&);
-
-        void handleNPOTTextures(bool prepareToDraw);
-
-        void createFallbackBlackTextures1x1();
-
-        // Helper function for copyTex{Sub}Image, check whether the internalformat
-        // and the color buffer format of the current bound framebuffer combination
-        // is valid.
-        bool isTexInternalFormatColorBufferCombinationValid(unsigned long texInternalFormat,
-                                                            unsigned long colorBufferFormat);
-
-        // Helper function to get the current bound texture.
-        WebGLTexture* getTextureBinding(unsigned long target);
-
-        // Helper function to check input format/type for functions {copy}Tex{Sub}Image.
-        // Generates GL error and returns false if parameters are invalid.
-        bool validateTexFuncFormatAndType(unsigned long format, unsigned long type);
-
-        // Helper function to check input parameters for functions {copy}Tex{Sub}Image.
-        // Generates GL error and returns false if parameters are invalid.
-        bool validateTexFuncParameters(unsigned long target, long level,
-                                       unsigned long internalformat,
-                                       long width, long height, long border,
-                                       unsigned long format, unsigned long type);
-
-        // Helper function to validate that the given ArrayBufferView
-        // is of the correct type and contains enough data for the texImage call.
-        // Generates GL error and returns false if parameters are invalid.
-        bool validateTexFuncData(long width, long height,
-                                 unsigned long format, unsigned long type,
-                                 ArrayBufferView* pixels);
-
-        // Helper function to validate mode for draw{Arrays/Elements}.
-        bool validateDrawMode(unsigned long);
-
-        // Helper function for texParameterf and texParameteri.
-        void texParameter(unsigned long target, unsigned long pname, float parami, int paramf, bool isFloat);
-
-        // Helper function to print warnings to console. Currently
-        // used only to warn about use of obsolete functions.
-        void printWarningToConsole(const String& message);
-
-        // Helper function to validate input parameters for framebuffer functions.
-        // Generate GL error if parameters are illegal.
-        bool validateFramebufferFuncParameters(unsigned long target, unsigned long attachment);
-
-        // Helper function to validate blend equation mode.
-        bool validateBlendEquation(unsigned long);
-
-        // Helper function to validate a GL capability.
-        bool validateCapability(unsigned long);
-
-        // Helper function to validate input parameters for uniform functions.
-        bool validateUniformParameters(const WebGLUniformLocation* location, Float32Array* v, int mod);
-        bool validateUniformParameters(const WebGLUniformLocation* location, Int32Array* v, int mod);
-        bool validateUniformParameters(const WebGLUniformLocation* location, void* v, int size, int mod);
-        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 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);
-        void vertexAttribfvImpl(unsigned long index, Float32Array* v, int expectedSize);
-        void vertexAttribfvImpl(unsigned long index, float* v, int size, int expectedSize);
-
-        // Helpers for simulating vertexAttrib0
-        void initVertexAttrib0();
-        bool simulateVertexAttrib0(long numVertex);
-        void restoreStatesAfterVertexAttrib0Simulation();
-
-        friend class WebGLStateRestorer;
+        bool enabled;
+        RefPtr<WebGLBuffer> bufferBinding;
+        long bytesPerElement;
+        long size;
+        unsigned long type;
+        bool normalized;
+        long stride;
+        long originalStride;
+        long offset;
+        float value[4];
     };
 
+    Vector<VertexAttribState> m_vertexAttribState;
+    unsigned m_maxVertexAttribs;
+    RefPtr<WebGLBuffer> m_vertexAttrib0Buffer;
+    long m_vertexAttrib0BufferSize;
+    float m_vertexAttrib0BufferValue[4];
+
+    RefPtr<WebGLProgram> m_currentProgram;
+    RefPtr<WebGLFramebuffer> m_framebufferBinding;
+    RefPtr<WebGLRenderbuffer> m_renderbufferBinding;
+    class TextureUnitState {
+    public:
+        RefPtr<WebGLTexture> m_texture2DBinding;
+        RefPtr<WebGLTexture> m_textureCubeMapBinding;
+    };
+    Vector<TextureUnitState> m_textureUnits;
+    unsigned long m_activeTextureUnit;
+
+    RefPtr<WebGLTexture> m_blackTexture2D;
+    RefPtr<WebGLTexture> m_blackTextureCubeMap;
+
+    int m_maxTextureSize;
+    int m_maxCubeMapTextureSize;
+    int m_maxTextureLevel;
+    int m_maxCubeMapTextureLevel;
+
+    int m_packAlignment;
+    int m_unpackAlignment;
+    unsigned long m_implementationColorReadFormat;
+    unsigned long m_implementationColorReadType;
+    bool m_unpackFlipY;
+    bool m_unpackPremultiplyAlpha;
+
+    // Helpers for getParameter and others
+    WebGLGetInfo getBooleanParameter(unsigned long pname);
+    WebGLGetInfo getBooleanArrayParameter(unsigned long pname);
+    WebGLGetInfo getFloatParameter(unsigned long pname);
+    WebGLGetInfo getIntParameter(unsigned long pname);
+    WebGLGetInfo getLongParameter(unsigned long pname);
+    WebGLGetInfo getUnsignedLongParameter(unsigned long pname);
+    WebGLGetInfo getWebGLFloatArrayParameter(unsigned long pname);
+    WebGLGetInfo getWebGLIntArrayParameter(unsigned long pname);
+
+    void texImage2DBase(unsigned target, unsigned level, unsigned internalformat,
+                        unsigned width, unsigned height, unsigned border,
+                        unsigned format, unsigned type, void* pixels, ExceptionCode&);
+    void texImage2DImpl(unsigned target, unsigned level, unsigned internalformat,
+                        unsigned format, unsigned type, Image* image,
+                        bool flipY, bool premultiplyAlpha, ExceptionCode&);
+    void texSubImage2DBase(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
+                           unsigned width, unsigned height,
+                           unsigned format, unsigned type, void* pixels, ExceptionCode&);
+    void texSubImage2DImpl(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
+                           unsigned format, unsigned type,
+                           Image* image, bool flipY, bool premultiplyAlpha, ExceptionCode&);
+
+    void handleNPOTTextures(bool prepareToDraw);
+
+    void createFallbackBlackTextures1x1();
+
+    // Helper function for copyTex{Sub}Image, check whether the internalformat
+    // and the color buffer format of the current bound framebuffer combination
+    // is valid.
+    bool isTexInternalFormatColorBufferCombinationValid(unsigned long texInternalFormat,
+                                                        unsigned long colorBufferFormat);
+
+    // Helper function to get the current bound texture.
+    WebGLTexture* getTextureBinding(unsigned long target);
+
+    // Helper function to check input format/type for functions {copy}Tex{Sub}Image.
+    // Generates GL error and returns false if parameters are invalid.
+    bool validateTexFuncFormatAndType(unsigned long format, unsigned long type);
+
+    // Helper function to check input parameters for functions {copy}Tex{Sub}Image.
+    // Generates GL error and returns false if parameters are invalid.
+    bool validateTexFuncParameters(unsigned long target, long level,
+                                   unsigned long internalformat,
+                                   long width, long height, long border,
+                                   unsigned long format, unsigned long type);
+
+    // Helper function to validate that the given ArrayBufferView
+    // is of the correct type and contains enough data for the texImage call.
+    // Generates GL error and returns false if parameters are invalid.
+    bool validateTexFuncData(long width, long height,
+                             unsigned long format, unsigned long type,
+                             ArrayBufferView* pixels);
+
+    // Helper function to validate mode for draw{Arrays/Elements}.
+    bool validateDrawMode(unsigned long);
+
+    // Helper function for texParameterf and texParameteri.
+    void texParameter(unsigned long target, unsigned long pname, float parami, int paramf, bool isFloat);
+
+    // Helper function to print warnings to console. Currently
+    // used only to warn about use of obsolete functions.
+    void printWarningToConsole(const String& message);
+
+    // Helper function to validate input parameters for framebuffer functions.
+    // Generate GL error if parameters are illegal.
+    bool validateFramebufferFuncParameters(unsigned long target, unsigned long attachment);
+
+    // Helper function to validate blend equation mode.
+    bool validateBlendEquation(unsigned long);
+
+    // Helper function to validate a GL capability.
+    bool validateCapability(unsigned long);
+
+    // Helper function to validate input parameters for uniform functions.
+    bool validateUniformParameters(const WebGLUniformLocation* location, Float32Array* v, int mod);
+    bool validateUniformParameters(const WebGLUniformLocation* location, Int32Array* v, int mod);
+    bool validateUniformParameters(const WebGLUniformLocation* location, void* v, int size, int mod);
+    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 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);
+    void vertexAttribfvImpl(unsigned long index, Float32Array* v, int expectedSize);
+    void vertexAttribfvImpl(unsigned long index, float* v, int size, int expectedSize);
+
+    // Helpers for simulating vertexAttrib0
+    void initVertexAttrib0();
+    bool simulateVertexAttrib0(long numVertex);
+    void restoreStatesAfterVertexAttrib0Simulation();
+
+    friend class WebGLStateRestorer;
+};
+
 } // namespace WebCore
 
 #endif
diff --git a/WebCore/html/canvas/WebGLShader.cpp b/WebCore/html/canvas/WebGLShader.cpp
index 15c4a91..4f8bf68 100644
--- a/WebCore/html/canvas/WebGLShader.cpp
+++ b/WebCore/html/canvas/WebGLShader.cpp
@@ -28,6 +28,7 @@
 #if ENABLE(3D_CANVAS)
 
 #include "WebGLShader.h"
+
 #include "WebGLRenderingContext.h"
 
 namespace WebCore {
@@ -44,7 +45,7 @@ WebGLShader::WebGLShader(WebGLRenderingContext* ctx, GraphicsContext3D::WebGLEnu
     setObject(context()->graphicsContext3D()->createShader(type));
 }
 
-void WebGLShader::_deleteObject(Platform3DObject object)
+void WebGLShader::deleteObjectImpl(Platform3DObject object)
 {
     context()->graphicsContext3D()->deleteShader(object);
 }
diff --git a/WebCore/html/canvas/WebGLShader.h b/WebCore/html/canvas/WebGLShader.h
index 62d1222..c0c41df 100644
--- a/WebCore/html/canvas/WebGLShader.h
+++ b/WebCore/html/canvas/WebGLShader.h
@@ -32,25 +32,25 @@
 #include <wtf/RefCounted.h>
 
 namespace WebCore {
-    
-    class WebGLShader : public WebGLObject {
-    public:
-        virtual ~WebGLShader() { deleteObject(); }
-        
-        static PassRefPtr<WebGLShader> create(WebGLRenderingContext*, GraphicsContext3D::WebGLEnumType);
 
-        GraphicsContext3D::WebGLEnumType getType() const { return m_type; }
+class WebGLShader : public WebGLObject {
+public:
+    virtual ~WebGLShader() { deleteObject(); }
 
-    private:
-        WebGLShader(WebGLRenderingContext*, GraphicsContext3D::WebGLEnumType);
+    static PassRefPtr<WebGLShader> create(WebGLRenderingContext*, GraphicsContext3D::WebGLEnumType);
 
-        virtual void _deleteObject(Platform3DObject);
+    GraphicsContext3D::WebGLEnumType getType() const { return m_type; }
 
-        virtual bool isShader() const { return true; }
+private:
+    WebGLShader(WebGLRenderingContext*, GraphicsContext3D::WebGLEnumType);
+
+    virtual void deleteObjectImpl(Platform3DObject);
+
+    virtual bool isShader() const { return true; }
+
+    GraphicsContext3D::WebGLEnumType m_type;
+};
 
-        GraphicsContext3D::WebGLEnumType m_type;
-    };
-    
 } // namespace WebCore
 
 #endif // WebGLShader_h
diff --git a/WebCore/html/canvas/WebGLTexture.cpp b/WebCore/html/canvas/WebGLTexture.cpp
index c47e040..2c50bf8 100644
--- a/WebCore/html/canvas/WebGLTexture.cpp
+++ b/WebCore/html/canvas/WebGLTexture.cpp
@@ -28,6 +28,7 @@
 #if ENABLE(3D_CANVAS)
 
 #include "WebGLTexture.h"
+
 #include "WebGLRenderingContext.h"
 
 namespace WebCore {
@@ -197,7 +198,7 @@ bool WebGLTexture::needToUseBlackTexture() const
     return m_needToUseBlackTexture;
 }
 
-void WebGLTexture::_deleteObject(Platform3DObject object)
+void WebGLTexture::deleteObjectImpl(Platform3DObject object)
 {
     context()->graphicsContext3D()->deleteTexture(object);
 }
diff --git a/WebCore/html/canvas/WebGLTexture.h b/WebCore/html/canvas/WebGLTexture.h
index d23b253..64bd6e0 100644
--- a/WebCore/html/canvas/WebGLTexture.h
+++ b/WebCore/html/canvas/WebGLTexture.h
@@ -33,97 +33,99 @@
 #include <wtf/Vector.h>
 
 namespace WebCore {
-    
-    class WebGLTexture : public WebGLObject {
-    public:
-        virtual ~WebGLTexture() { deleteObject(); }
-        
-        static PassRefPtr<WebGLTexture> create(WebGLRenderingContext*);
 
-        bool isCubeMapRWrapModeInitialized() {
-            return cubeMapRWrapModeInitialized;
-        }
+class WebGLTexture : public WebGLObject {
+public:
+    virtual ~WebGLTexture() { deleteObject(); }
 
-        void setCubeMapRWrapModeInitialized(bool initialized) {
-            cubeMapRWrapModeInitialized = initialized;
-        }
+    static PassRefPtr<WebGLTexture> create(WebGLRenderingContext*);
 
-        void setTarget(unsigned long target, int maxLevel);
-        void setParameteri(unsigned long pname, int param);
-        void setParameterf(unsigned long pname, float param);
+    bool isCubeMapRWrapModeInitialized()
+    {
+        return cubeMapRWrapModeInitialized;
+    }
 
-        void setLevelInfo(unsigned long target, int level, unsigned long internalFormat, int width, int height, unsigned long type);
+    void setCubeMapRWrapModeInitialized(bool initialized)
+    {
+        cubeMapRWrapModeInitialized = initialized;
+    }
 
-        bool canGenerateMipmaps();
-        // Generate all level information.
-        void generateMipmapLevelInfo();
+    void setTarget(unsigned long target, int maxLevel);
+    void setParameteri(unsigned long pname, int param);
+    void setParameterf(unsigned long pname, float param);
 
-        unsigned long getInternalFormat() const;
+    void setLevelInfo(unsigned long target, int level, unsigned long internalFormat, int width, int height, unsigned long type);
 
-        // Whether width/height is NotPowerOfTwo.
-        static bool isNPOT(unsigned, unsigned);
+    bool canGenerateMipmaps();
+    // Generate all level information.
+    void generateMipmapLevelInfo();
 
-        bool isNPOT() const;
-        // Determine if texture sampling should always return [0, 0, 0, 1] (OpenGL ES 2.0 Sec 3.8.2).
-        bool needToUseBlackTexture() const;
+    unsigned long getInternalFormat() const;
 
-        static int computeLevelCount(int width, int height);
+    // Whether width/height is NotPowerOfTwo.
+    static bool isNPOT(unsigned, unsigned);
 
-    protected:
-        WebGLTexture(WebGLRenderingContext*);
+    bool isNPOT() const;
+    // Determine if texture sampling should always return [0, 0, 0, 1] (OpenGL ES 2.0 Sec 3.8.2).
+    bool needToUseBlackTexture() const;
 
-        virtual void _deleteObject(Platform3DObject);
+    static int computeLevelCount(int width, int height);
 
-    private:
-        virtual bool isTexture() const { return true; }
+protected:
+    WebGLTexture(WebGLRenderingContext*);
 
-        void update();
+    virtual void deleteObjectImpl(Platform3DObject);
 
-        int mapTargetToIndex(unsigned long);
+private:
+    virtual bool isTexture() const { return true; }
 
-        bool cubeMapRWrapModeInitialized;
+    void update();
 
-        unsigned long m_target;
+    int mapTargetToIndex(unsigned long);
 
-        int m_minFilter;
-        int m_magFilter;
-        int m_wrapS;
-        int m_wrapT;
+    bool cubeMapRWrapModeInitialized;
 
-        class LevelInfo {
-        public:
-            LevelInfo()
-                : valid(false)
-                , internalFormat(0)
-                , width(0)
-                , height(0)
-                , type(0)
-            {
-            }
+    unsigned long m_target;
 
-            void setInfo(unsigned long internalFmt, int w, int h, unsigned long tp)
-            {
-                valid = true;
-                internalFormat = internalFmt;
-                width = w;
-                height = h;
-                type = tp;
-            }
+    int m_minFilter;
+    int m_magFilter;
+    int m_wrapS;
+    int m_wrapT;
 
-            bool valid;
-            unsigned long internalFormat;
-            int width;
-            int height;
-            unsigned long type;
-        };
+    class LevelInfo {
+    public:
+        LevelInfo()
+            : valid(false)
+            , internalFormat(0)
+            , width(0)
+            , height(0)
+            , type(0)
+        {
+        }
 
-        Vector<Vector<LevelInfo> > m_info;
+        void setInfo(unsigned long internalFmt, int w, int h, unsigned long tp)
+        {
+            valid = true;
+            internalFormat = internalFmt;
+            width = w;
+            height = h;
+            type = tp;
+        }
 
-        bool m_isNPOT;
-        bool m_isComplete;
-        bool m_needToUseBlackTexture;
+        bool valid;
+        unsigned long internalFormat;
+        int width;
+        int height;
+        unsigned long type;
     };
-    
+
+    Vector<Vector<LevelInfo> > m_info;
+
+    bool m_isNPOT;
+    bool m_isComplete;
+    bool m_needToUseBlackTexture;
+};
+
 } // namespace WebCore
 
 #endif // WebGLTexture_h
diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h
index 1c06ef1..d702096 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/WebCore/platform/graphics/GraphicsContext3D.h
@@ -43,7 +43,7 @@
 #include <wtf/RetainPtr.h>
 
 typedef CGLContextObj PlatformGraphicsContext3D;
-const  PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0;
+const PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0;
 typedef GLuint Platform3DObject;
 const Platform3DObject NullPlatform3DObject = 0;
 
@@ -58,12 +58,12 @@ typedef void* WebGLLayer;
 class QPainter;
 class QRect;
 typedef void* PlatformGraphicsContext3D;
-const  PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0;
+const PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0;
 typedef int Platform3DObject;
 const Platform3DObject NullPlatform3DObject = 0;
 #else
 typedef void* PlatformGraphicsContext3D;
-const  PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0;
+const PlatformGraphicsContext3D NullPlatformGraphicsContext3D = 0;
 typedef int Platform3DObject;
 const Platform3DObject NullPlatform3DObject = 0;
 #endif
@@ -73,768 +73,768 @@ const Platform3DObject NullPlatform3DObject = 0;
 #endif
 
 namespace WebCore {
-    class ArrayBuffer;
-    class ArrayBufferView;
-    class CanvasRenderingContext;
-    class Float32Array;
-    class HostWindow;
-    class Image;
-    class ImageData;
-    class Int32Array;
-    class Uint8Array;
-    class WebGLActiveInfo;
-
-    struct ActiveInfo {
-        String name;
-        unsigned type;
-        int size;
-    };
-
-    // FIXME: ideally this would be used on all platforms.
+class ArrayBuffer;
+class ArrayBufferView;
+class CanvasRenderingContext;
+class Float32Array;
+class HostWindow;
+class Image;
+class ImageData;
+class Int32Array;
+class Uint8Array;
+class WebGLActiveInfo;
+
+struct ActiveInfo {
+    String name;
+    unsigned type;
+    int size;
+};
+
+// FIXME: ideally this would be used on all platforms.
 #if PLATFORM(CHROMIUM) || PLATFORM(QT)
-    class GraphicsContext3DInternal;
+class GraphicsContext3DInternal;
 #endif
 
-    class GraphicsContext3D : public Noncopyable {
-    public:
-        enum WebGLEnumType {
-            DEPTH_BUFFER_BIT = 0x00000100,
-            STENCIL_BUFFER_BIT = 0x00000400,
-            COLOR_BUFFER_BIT = 0x00004000,
-            POINTS = 0x0000,
-            LINES = 0x0001,
-            LINE_LOOP = 0x0002,
-            LINE_STRIP = 0x0003,
-            TRIANGLES = 0x0004,
-            TRIANGLE_STRIP = 0x0005,
-            TRIANGLE_FAN = 0x0006,
-            ZERO = 0,
-            ONE = 1,
-            SRC_COLOR = 0x0300,
-            ONE_MINUS_SRC_COLOR = 0x0301,
-            SRC_ALPHA = 0x0302,
-            ONE_MINUS_SRC_ALPHA = 0x0303,
-            DST_ALPHA = 0x0304,
-            ONE_MINUS_DST_ALPHA = 0x0305,
-            DST_COLOR = 0x0306,
-            ONE_MINUS_DST_COLOR = 0x0307,
-            SRC_ALPHA_SATURATE = 0x0308,
-            FUNC_ADD = 0x8006,
-            BLEND_EQUATION = 0x8009,
-            BLEND_EQUATION_RGB = 0x8009,
-            BLEND_EQUATION_ALPHA = 0x883D,
-            FUNC_SUBTRACT = 0x800A,
-            FUNC_REVERSE_SUBTRACT = 0x800B,
-            BLEND_DST_RGB = 0x80C8,
-            BLEND_SRC_RGB = 0x80C9,
-            BLEND_DST_ALPHA = 0x80CA,
-            BLEND_SRC_ALPHA = 0x80CB,
-            CONSTANT_COLOR = 0x8001,
-            ONE_MINUS_CONSTANT_COLOR = 0x8002,
-            CONSTANT_ALPHA = 0x8003,
-            ONE_MINUS_CONSTANT_ALPHA = 0x8004,
-            BLEND_COLOR = 0x8005,
-            ARRAY_BUFFER = 0x8892,
-            ELEMENT_ARRAY_BUFFER = 0x8893,
-            ARRAY_BUFFER_BINDING = 0x8894,
-            ELEMENT_ARRAY_BUFFER_BINDING = 0x8895,
-            STREAM_DRAW = 0x88E0,
-            STATIC_DRAW = 0x88E4,
-            DYNAMIC_DRAW = 0x88E8,
-            BUFFER_SIZE = 0x8764,
-            BUFFER_USAGE = 0x8765,
-            CURRENT_VERTEX_ATTRIB = 0x8626,
-            FRONT = 0x0404,
-            BACK = 0x0405,
-            FRONT_AND_BACK = 0x0408,
-            TEXTURE_2D = 0x0DE1,
-            CULL_FACE = 0x0B44,
-            BLEND = 0x0BE2,
-            DITHER = 0x0BD0,
-            STENCIL_TEST = 0x0B90,
-            DEPTH_TEST = 0x0B71,
-            SCISSOR_TEST = 0x0C11,
-            POLYGON_OFFSET_FILL = 0x8037,
-            SAMPLE_ALPHA_TO_COVERAGE = 0x809E,
-            SAMPLE_COVERAGE = 0x80A0,
-            NO_ERROR = 0,
-            INVALID_ENUM = 0x0500,
-            INVALID_VALUE = 0x0501,
-            INVALID_OPERATION = 0x0502,
-            OUT_OF_MEMORY = 0x0505,
-            CW = 0x0900,
-            CCW = 0x0901,
-            LINE_WIDTH = 0x0B21,
-            ALIASED_POINT_SIZE_RANGE = 0x846D,
-            ALIASED_LINE_WIDTH_RANGE = 0x846E,
-            CULL_FACE_MODE = 0x0B45,
-            FRONT_FACE = 0x0B46,
-            DEPTH_RANGE = 0x0B70,
-            DEPTH_WRITEMASK = 0x0B72,
-            DEPTH_CLEAR_VALUE = 0x0B73,
-            DEPTH_FUNC = 0x0B74,
-            STENCIL_CLEAR_VALUE = 0x0B91,
-            STENCIL_FUNC = 0x0B92,
-            STENCIL_FAIL = 0x0B94,
-            STENCIL_PASS_DEPTH_FAIL = 0x0B95,
-            STENCIL_PASS_DEPTH_PASS = 0x0B96,
-            STENCIL_REF = 0x0B97,
-            STENCIL_VALUE_MASK = 0x0B93,
-            STENCIL_WRITEMASK = 0x0B98,
-            STENCIL_BACK_FUNC = 0x8800,
-            STENCIL_BACK_FAIL = 0x8801,
-            STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802,
-            STENCIL_BACK_PASS_DEPTH_PASS = 0x8803,
-            STENCIL_BACK_REF = 0x8CA3,
-            STENCIL_BACK_VALUE_MASK = 0x8CA4,
-            STENCIL_BACK_WRITEMASK = 0x8CA5,
-            VIEWPORT = 0x0BA2,
-            SCISSOR_BOX = 0x0C10,
-            COLOR_CLEAR_VALUE = 0x0C22,
-            COLOR_WRITEMASK = 0x0C23,
-            UNPACK_ALIGNMENT = 0x0CF5,
-            PACK_ALIGNMENT = 0x0D05,
-            MAX_TEXTURE_SIZE = 0x0D33,
-            MAX_VIEWPORT_DIMS = 0x0D3A,
-            SUBPIXEL_BITS = 0x0D50,
-            RED_BITS = 0x0D52,
-            GREEN_BITS = 0x0D53,
-            BLUE_BITS = 0x0D54,
-            ALPHA_BITS = 0x0D55,
-            DEPTH_BITS = 0x0D56,
-            STENCIL_BITS = 0x0D57,
-            POLYGON_OFFSET_UNITS = 0x2A00,
-            POLYGON_OFFSET_FACTOR = 0x8038,
-            TEXTURE_BINDING_2D = 0x8069,
-            SAMPLE_BUFFERS = 0x80A8,
-            SAMPLES = 0x80A9,
-            SAMPLE_COVERAGE_VALUE = 0x80AA,
-            SAMPLE_COVERAGE_INVERT = 0x80AB,
-            NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2,
-            COMPRESSED_TEXTURE_FORMATS = 0x86A3,
-            DONT_CARE = 0x1100,
-            FASTEST = 0x1101,
-            NICEST = 0x1102,
-            GENERATE_MIPMAP_HINT = 0x8192,
-            BYTE = 0x1400,
-            UNSIGNED_BYTE = 0x1401,
-            SHORT = 0x1402,
-            UNSIGNED_SHORT = 0x1403,
-            INT = 0x1404,
-            UNSIGNED_INT = 0x1405,
-            FLOAT = 0x1406,
-            FIXED = 0x140C,
-            DEPTH_COMPONENT = 0x1902,
-            ALPHA = 0x1906,
-            RGB = 0x1907,
-            RGBA = 0x1908,
-            LUMINANCE = 0x1909,
-            LUMINANCE_ALPHA = 0x190A,
-            UNSIGNED_SHORT_4_4_4_4 = 0x8033,
-            UNSIGNED_SHORT_5_5_5_1 = 0x8034,
-            UNSIGNED_SHORT_5_6_5 = 0x8363,
-            FRAGMENT_SHADER = 0x8B30,
-            VERTEX_SHADER = 0x8B31,
-            MAX_VERTEX_ATTRIBS = 0x8869,
-            MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB,
-            MAX_VARYING_VECTORS = 0x8DFC,
-            MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D,
-            MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C,
-            MAX_TEXTURE_IMAGE_UNITS = 0x8872,
-            MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD,
-            SHADER_TYPE = 0x8B4F,
-            DELETE_STATUS = 0x8B80,
-            LINK_STATUS = 0x8B82,
-            VALIDATE_STATUS = 0x8B83,
-            ATTACHED_SHADERS = 0x8B85,
-            ACTIVE_UNIFORMS = 0x8B86,
-            ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87,
-            ACTIVE_ATTRIBUTES = 0x8B89,
-            ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A,
-            SHADING_LANGUAGE_VERSION = 0x8B8C,
-            CURRENT_PROGRAM = 0x8B8D,
-            NEVER = 0x0200,
-            LESS = 0x0201,
-            EQUAL = 0x0202,
-            LEQUAL = 0x0203,
-            GREATER = 0x0204,
-            NOTEQUAL = 0x0205,
-            GEQUAL = 0x0206,
-            ALWAYS = 0x0207,
-            KEEP = 0x1E00,
-            REPLACE = 0x1E01,
-            INCR = 0x1E02,
-            DECR = 0x1E03,
-            INVERT = 0x150A,
-            INCR_WRAP = 0x8507,
-            DECR_WRAP = 0x8508,
-            VENDOR = 0x1F00,
-            RENDERER = 0x1F01,
-            VERSION = 0x1F02,
-            EXTENSIONS = 0x1F03,
-            NEAREST = 0x2600,
-            LINEAR = 0x2601,
-            NEAREST_MIPMAP_NEAREST = 0x2700,
-            LINEAR_MIPMAP_NEAREST = 0x2701,
-            NEAREST_MIPMAP_LINEAR = 0x2702,
-            LINEAR_MIPMAP_LINEAR = 0x2703,
-            TEXTURE_MAG_FILTER = 0x2800,
-            TEXTURE_MIN_FILTER = 0x2801,
-            TEXTURE_WRAP_S = 0x2802,
-            TEXTURE_WRAP_T = 0x2803,
-            TEXTURE = 0x1702,
-            TEXTURE_CUBE_MAP = 0x8513,
-            TEXTURE_BINDING_CUBE_MAP = 0x8514,
-            TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515,
-            TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516,
-            TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517,
-            TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518,
-            TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519,
-            TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A,
-            MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C,
-            TEXTURE0 = 0x84C0,
-            TEXTURE1 = 0x84C1,
-            TEXTURE2 = 0x84C2,
-            TEXTURE3 = 0x84C3,
-            TEXTURE4 = 0x84C4,
-            TEXTURE5 = 0x84C5,
-            TEXTURE6 = 0x84C6,
-            TEXTURE7 = 0x84C7,
-            TEXTURE8 = 0x84C8,
-            TEXTURE9 = 0x84C9,
-            TEXTURE10 = 0x84CA,
-            TEXTURE11 = 0x84CB,
-            TEXTURE12 = 0x84CC,
-            TEXTURE13 = 0x84CD,
-            TEXTURE14 = 0x84CE,
-            TEXTURE15 = 0x84CF,
-            TEXTURE16 = 0x84D0,
-            TEXTURE17 = 0x84D1,
-            TEXTURE18 = 0x84D2,
-            TEXTURE19 = 0x84D3,
-            TEXTURE20 = 0x84D4,
-            TEXTURE21 = 0x84D5,
-            TEXTURE22 = 0x84D6,
-            TEXTURE23 = 0x84D7,
-            TEXTURE24 = 0x84D8,
-            TEXTURE25 = 0x84D9,
-            TEXTURE26 = 0x84DA,
-            TEXTURE27 = 0x84DB,
-            TEXTURE28 = 0x84DC,
-            TEXTURE29 = 0x84DD,
-            TEXTURE30 = 0x84DE,
-            TEXTURE31 = 0x84DF,
-            ACTIVE_TEXTURE = 0x84E0,
-            REPEAT = 0x2901,
-            CLAMP_TO_EDGE = 0x812F,
-            MIRRORED_REPEAT = 0x8370,
-            FLOAT_VEC2 = 0x8B50,
-            FLOAT_VEC3 = 0x8B51,
-            FLOAT_VEC4 = 0x8B52,
-            INT_VEC2 = 0x8B53,
-            INT_VEC3 = 0x8B54,
-            INT_VEC4 = 0x8B55,
-            BOOL = 0x8B56,
-            BOOL_VEC2 = 0x8B57,
-            BOOL_VEC3 = 0x8B58,
-            BOOL_VEC4 = 0x8B59,
-            FLOAT_MAT2 = 0x8B5A,
-            FLOAT_MAT3 = 0x8B5B,
-            FLOAT_MAT4 = 0x8B5C,
-            SAMPLER_2D = 0x8B5E,
-            SAMPLER_CUBE = 0x8B60,
-            VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622,
-            VERTEX_ATTRIB_ARRAY_SIZE = 0x8623,
-            VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624,
-            VERTEX_ATTRIB_ARRAY_TYPE = 0x8625,
-            VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A,
-            VERTEX_ATTRIB_ARRAY_POINTER = 0x8645,
-            VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F,
-            IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A,
-            IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B,
-            COMPILE_STATUS = 0x8B81,
-            INFO_LOG_LENGTH = 0x8B84,
-            SHADER_SOURCE_LENGTH = 0x8B88,
-            SHADER_COMPILER = 0x8DFA,
-            SHADER_BINARY_FORMATS = 0x8DF8,
-            NUM_SHADER_BINARY_FORMATS = 0x8DF9,
-            LOW_FLOAT = 0x8DF0,
-            MEDIUM_FLOAT = 0x8DF1,
-            HIGH_FLOAT = 0x8DF2,
-            LOW_INT = 0x8DF3,
-            MEDIUM_INT = 0x8DF4,
-            HIGH_INT = 0x8DF5,
-            FRAMEBUFFER = 0x8D40,
-            RENDERBUFFER = 0x8D41,
-            RGBA4 = 0x8056,
-            RGB5_A1 = 0x8057,
-            RGB565 = 0x8D62,
-            DEPTH_COMPONENT16 = 0x81A5,
-            STENCIL_INDEX = 0x1901,
-            STENCIL_INDEX8 = 0x8D48,
-            DEPTH_STENCIL = 0x84F9,
-            RENDERBUFFER_WIDTH = 0x8D42,
-            RENDERBUFFER_HEIGHT = 0x8D43,
-            RENDERBUFFER_INTERNAL_FORMAT = 0x8D44,
-            RENDERBUFFER_RED_SIZE = 0x8D50,
-            RENDERBUFFER_GREEN_SIZE = 0x8D51,
-            RENDERBUFFER_BLUE_SIZE = 0x8D52,
-            RENDERBUFFER_ALPHA_SIZE = 0x8D53,
-            RENDERBUFFER_DEPTH_SIZE = 0x8D54,
-            RENDERBUFFER_STENCIL_SIZE = 0x8D55,
-            FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0,
-            FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1,
-            FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2,
-            FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3,
-            COLOR_ATTACHMENT0 = 0x8CE0,
-            DEPTH_ATTACHMENT = 0x8D00,
-            STENCIL_ATTACHMENT = 0x8D20,
-            DEPTH_STENCIL_ATTACHMENT = 0x821A,
-            NONE = 0,
-            FRAMEBUFFER_COMPLETE = 0x8CD5,
-            FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6,
-            FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7,
-            FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9,
-            FRAMEBUFFER_UNSUPPORTED = 0x8CDD,
-            FRAMEBUFFER_BINDING = 0x8CA6,
-            RENDERBUFFER_BINDING = 0x8CA7,
-            MAX_RENDERBUFFER_SIZE = 0x84E8,
-            INVALID_FRAMEBUFFER_OPERATION = 0x0506,
-
-            // WebGL-specific enums
-            UNPACK_FLIP_Y_WEBGL = 0x9240,
-            UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241
-        };
-        
-        // Context creation attributes.
-        struct Attributes {
-            Attributes()
-                : alpha(true)
-                , depth(true)
-                , stencil(false)
-                , antialias(true)
-                , premultipliedAlpha(true)
-            {
-            }
-
-            bool alpha;
-            bool depth;
-            bool stencil;
-            bool antialias;
-            bool premultipliedAlpha;
-        };
-
-        static PassOwnPtr<GraphicsContext3D> create(Attributes attrs, HostWindow* hostWindow);
-        virtual ~GraphicsContext3D();
+class GraphicsContext3D : public Noncopyable {
+public:
+    enum WebGLEnumType {
+        DEPTH_BUFFER_BIT = 0x00000100,
+        STENCIL_BUFFER_BIT = 0x00000400,
+        COLOR_BUFFER_BIT = 0x00004000,
+        POINTS = 0x0000,
+        LINES = 0x0001,
+        LINE_LOOP = 0x0002,
+        LINE_STRIP = 0x0003,
+        TRIANGLES = 0x0004,
+        TRIANGLE_STRIP = 0x0005,
+        TRIANGLE_FAN = 0x0006,
+        ZERO = 0,
+        ONE = 1,
+        SRC_COLOR = 0x0300,
+        ONE_MINUS_SRC_COLOR = 0x0301,
+        SRC_ALPHA = 0x0302,
+        ONE_MINUS_SRC_ALPHA = 0x0303,
+        DST_ALPHA = 0x0304,
+        ONE_MINUS_DST_ALPHA = 0x0305,
+        DST_COLOR = 0x0306,
+        ONE_MINUS_DST_COLOR = 0x0307,
+        SRC_ALPHA_SATURATE = 0x0308,
+        FUNC_ADD = 0x8006,
+        BLEND_EQUATION = 0x8009,
+        BLEND_EQUATION_RGB = 0x8009,
+        BLEND_EQUATION_ALPHA = 0x883D,
+        FUNC_SUBTRACT = 0x800A,
+        FUNC_REVERSE_SUBTRACT = 0x800B,
+        BLEND_DST_RGB = 0x80C8,
+        BLEND_SRC_RGB = 0x80C9,
+        BLEND_DST_ALPHA = 0x80CA,
+        BLEND_SRC_ALPHA = 0x80CB,
+        CONSTANT_COLOR = 0x8001,
+        ONE_MINUS_CONSTANT_COLOR = 0x8002,
+        CONSTANT_ALPHA = 0x8003,
+        ONE_MINUS_CONSTANT_ALPHA = 0x8004,
+        BLEND_COLOR = 0x8005,
+        ARRAY_BUFFER = 0x8892,
+        ELEMENT_ARRAY_BUFFER = 0x8893,
+        ARRAY_BUFFER_BINDING = 0x8894,
+        ELEMENT_ARRAY_BUFFER_BINDING = 0x8895,
+        STREAM_DRAW = 0x88E0,
+        STATIC_DRAW = 0x88E4,
+        DYNAMIC_DRAW = 0x88E8,
+        BUFFER_SIZE = 0x8764,
+        BUFFER_USAGE = 0x8765,
+        CURRENT_VERTEX_ATTRIB = 0x8626,
+        FRONT = 0x0404,
+        BACK = 0x0405,
+        FRONT_AND_BACK = 0x0408,
+        TEXTURE_2D = 0x0DE1,
+        CULL_FACE = 0x0B44,
+        BLEND = 0x0BE2,
+        DITHER = 0x0BD0,
+        STENCIL_TEST = 0x0B90,
+        DEPTH_TEST = 0x0B71,
+        SCISSOR_TEST = 0x0C11,
+        POLYGON_OFFSET_FILL = 0x8037,
+        SAMPLE_ALPHA_TO_COVERAGE = 0x809E,
+        SAMPLE_COVERAGE = 0x80A0,
+        NO_ERROR = 0,
+        INVALID_ENUM = 0x0500,
+        INVALID_VALUE = 0x0501,
+        INVALID_OPERATION = 0x0502,
+        OUT_OF_MEMORY = 0x0505,
+        CW = 0x0900,
+        CCW = 0x0901,
+        LINE_WIDTH = 0x0B21,
+        ALIASED_POINT_SIZE_RANGE = 0x846D,
+        ALIASED_LINE_WIDTH_RANGE = 0x846E,
+        CULL_FACE_MODE = 0x0B45,
+        FRONT_FACE = 0x0B46,
+        DEPTH_RANGE = 0x0B70,
+        DEPTH_WRITEMASK = 0x0B72,
+        DEPTH_CLEAR_VALUE = 0x0B73,
+        DEPTH_FUNC = 0x0B74,
+        STENCIL_CLEAR_VALUE = 0x0B91,
+        STENCIL_FUNC = 0x0B92,
+        STENCIL_FAIL = 0x0B94,
+        STENCIL_PASS_DEPTH_FAIL = 0x0B95,
+        STENCIL_PASS_DEPTH_PASS = 0x0B96,
+        STENCIL_REF = 0x0B97,
+        STENCIL_VALUE_MASK = 0x0B93,
+        STENCIL_WRITEMASK = 0x0B98,
+        STENCIL_BACK_FUNC = 0x8800,
+        STENCIL_BACK_FAIL = 0x8801,
+        STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802,
+        STENCIL_BACK_PASS_DEPTH_PASS = 0x8803,
+        STENCIL_BACK_REF = 0x8CA3,
+        STENCIL_BACK_VALUE_MASK = 0x8CA4,
+        STENCIL_BACK_WRITEMASK = 0x8CA5,
+        VIEWPORT = 0x0BA2,
+        SCISSOR_BOX = 0x0C10,
+        COLOR_CLEAR_VALUE = 0x0C22,
+        COLOR_WRITEMASK = 0x0C23,
+        UNPACK_ALIGNMENT = 0x0CF5,
+        PACK_ALIGNMENT = 0x0D05,
+        MAX_TEXTURE_SIZE = 0x0D33,
+        MAX_VIEWPORT_DIMS = 0x0D3A,
+        SUBPIXEL_BITS = 0x0D50,
+        RED_BITS = 0x0D52,
+        GREEN_BITS = 0x0D53,
+        BLUE_BITS = 0x0D54,
+        ALPHA_BITS = 0x0D55,
+        DEPTH_BITS = 0x0D56,
+        STENCIL_BITS = 0x0D57,
+        POLYGON_OFFSET_UNITS = 0x2A00,
+        POLYGON_OFFSET_FACTOR = 0x8038,
+        TEXTURE_BINDING_2D = 0x8069,
+        SAMPLE_BUFFERS = 0x80A8,
+        SAMPLES = 0x80A9,
+        SAMPLE_COVERAGE_VALUE = 0x80AA,
+        SAMPLE_COVERAGE_INVERT = 0x80AB,
+        NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2,
+        COMPRESSED_TEXTURE_FORMATS = 0x86A3,
+        DONT_CARE = 0x1100,
+        FASTEST = 0x1101,
+        NICEST = 0x1102,
+        GENERATE_MIPMAP_HINT = 0x8192,
+        BYTE = 0x1400,
+        UNSIGNED_BYTE = 0x1401,
+        SHORT = 0x1402,
+        UNSIGNED_SHORT = 0x1403,
+        INT = 0x1404,
+        UNSIGNED_INT = 0x1405,
+        FLOAT = 0x1406,
+        FIXED = 0x140C,
+        DEPTH_COMPONENT = 0x1902,
+        ALPHA = 0x1906,
+        RGB = 0x1907,
+        RGBA = 0x1908,
+        LUMINANCE = 0x1909,
+        LUMINANCE_ALPHA = 0x190A,
+        UNSIGNED_SHORT_4_4_4_4 = 0x8033,
+        UNSIGNED_SHORT_5_5_5_1 = 0x8034,
+        UNSIGNED_SHORT_5_6_5 = 0x8363,
+        FRAGMENT_SHADER = 0x8B30,
+        VERTEX_SHADER = 0x8B31,
+        MAX_VERTEX_ATTRIBS = 0x8869,
+        MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB,
+        MAX_VARYING_VECTORS = 0x8DFC,
+        MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D,
+        MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C,
+        MAX_TEXTURE_IMAGE_UNITS = 0x8872,
+        MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD,
+        SHADER_TYPE = 0x8B4F,
+        DELETE_STATUS = 0x8B80,
+        LINK_STATUS = 0x8B82,
+        VALIDATE_STATUS = 0x8B83,
+        ATTACHED_SHADERS = 0x8B85,
+        ACTIVE_UNIFORMS = 0x8B86,
+        ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87,
+        ACTIVE_ATTRIBUTES = 0x8B89,
+        ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A,
+        SHADING_LANGUAGE_VERSION = 0x8B8C,
+        CURRENT_PROGRAM = 0x8B8D,
+        NEVER = 0x0200,
+        LESS = 0x0201,
+        EQUAL = 0x0202,
+        LEQUAL = 0x0203,
+        GREATER = 0x0204,
+        NOTEQUAL = 0x0205,
+        GEQUAL = 0x0206,
+        ALWAYS = 0x0207,
+        KEEP = 0x1E00,
+        REPLACE = 0x1E01,
+        INCR = 0x1E02,
+        DECR = 0x1E03,
+        INVERT = 0x150A,
+        INCR_WRAP = 0x8507,
+        DECR_WRAP = 0x8508,
+        VENDOR = 0x1F00,
+        RENDERER = 0x1F01,
+        VERSION = 0x1F02,
+        EXTENSIONS = 0x1F03,
+        NEAREST = 0x2600,
+        LINEAR = 0x2601,
+        NEAREST_MIPMAP_NEAREST = 0x2700,
+        LINEAR_MIPMAP_NEAREST = 0x2701,
+        NEAREST_MIPMAP_LINEAR = 0x2702,
+        LINEAR_MIPMAP_LINEAR = 0x2703,
+        TEXTURE_MAG_FILTER = 0x2800,
+        TEXTURE_MIN_FILTER = 0x2801,
+        TEXTURE_WRAP_S = 0x2802,
+        TEXTURE_WRAP_T = 0x2803,
+        TEXTURE = 0x1702,
+        TEXTURE_CUBE_MAP = 0x8513,
+        TEXTURE_BINDING_CUBE_MAP = 0x8514,
+        TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515,
+        TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516,
+        TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517,
+        TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518,
+        TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519,
+        TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A,
+        MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C,
+        TEXTURE0 = 0x84C0,
+        TEXTURE1 = 0x84C1,
+        TEXTURE2 = 0x84C2,
+        TEXTURE3 = 0x84C3,
+        TEXTURE4 = 0x84C4,
+        TEXTURE5 = 0x84C5,
+        TEXTURE6 = 0x84C6,
+        TEXTURE7 = 0x84C7,
+        TEXTURE8 = 0x84C8,
+        TEXTURE9 = 0x84C9,
+        TEXTURE10 = 0x84CA,
+        TEXTURE11 = 0x84CB,
+        TEXTURE12 = 0x84CC,
+        TEXTURE13 = 0x84CD,
+        TEXTURE14 = 0x84CE,
+        TEXTURE15 = 0x84CF,
+        TEXTURE16 = 0x84D0,
+        TEXTURE17 = 0x84D1,
+        TEXTURE18 = 0x84D2,
+        TEXTURE19 = 0x84D3,
+        TEXTURE20 = 0x84D4,
+        TEXTURE21 = 0x84D5,
+        TEXTURE22 = 0x84D6,
+        TEXTURE23 = 0x84D7,
+        TEXTURE24 = 0x84D8,
+        TEXTURE25 = 0x84D9,
+        TEXTURE26 = 0x84DA,
+        TEXTURE27 = 0x84DB,
+        TEXTURE28 = 0x84DC,
+        TEXTURE29 = 0x84DD,
+        TEXTURE30 = 0x84DE,
+        TEXTURE31 = 0x84DF,
+        ACTIVE_TEXTURE = 0x84E0,
+        REPEAT = 0x2901,
+        CLAMP_TO_EDGE = 0x812F,
+        MIRRORED_REPEAT = 0x8370,
+        FLOAT_VEC2 = 0x8B50,
+        FLOAT_VEC3 = 0x8B51,
+        FLOAT_VEC4 = 0x8B52,
+        INT_VEC2 = 0x8B53,
+        INT_VEC3 = 0x8B54,
+        INT_VEC4 = 0x8B55,
+        BOOL = 0x8B56,
+        BOOL_VEC2 = 0x8B57,
+        BOOL_VEC3 = 0x8B58,
+        BOOL_VEC4 = 0x8B59,
+        FLOAT_MAT2 = 0x8B5A,
+        FLOAT_MAT3 = 0x8B5B,
+        FLOAT_MAT4 = 0x8B5C,
+        SAMPLER_2D = 0x8B5E,
+        SAMPLER_CUBE = 0x8B60,
+        VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622,
+        VERTEX_ATTRIB_ARRAY_SIZE = 0x8623,
+        VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624,
+        VERTEX_ATTRIB_ARRAY_TYPE = 0x8625,
+        VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A,
+        VERTEX_ATTRIB_ARRAY_POINTER = 0x8645,
+        VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F,
+        IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A,
+        IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B,
+        COMPILE_STATUS = 0x8B81,
+        INFO_LOG_LENGTH = 0x8B84,
+        SHADER_SOURCE_LENGTH = 0x8B88,
+        SHADER_COMPILER = 0x8DFA,
+        SHADER_BINARY_FORMATS = 0x8DF8,
+        NUM_SHADER_BINARY_FORMATS = 0x8DF9,
+        LOW_FLOAT = 0x8DF0,
+        MEDIUM_FLOAT = 0x8DF1,
+        HIGH_FLOAT = 0x8DF2,
+        LOW_INT = 0x8DF3,
+        MEDIUM_INT = 0x8DF4,
+        HIGH_INT = 0x8DF5,
+        FRAMEBUFFER = 0x8D40,
+        RENDERBUFFER = 0x8D41,
+        RGBA4 = 0x8056,
+        RGB5_A1 = 0x8057,
+        RGB565 = 0x8D62,
+        DEPTH_COMPONENT16 = 0x81A5,
+        STENCIL_INDEX = 0x1901,
+        STENCIL_INDEX8 = 0x8D48,
+        DEPTH_STENCIL = 0x84F9,
+        RENDERBUFFER_WIDTH = 0x8D42,
+        RENDERBUFFER_HEIGHT = 0x8D43,
+        RENDERBUFFER_INTERNAL_FORMAT = 0x8D44,
+        RENDERBUFFER_RED_SIZE = 0x8D50,
+        RENDERBUFFER_GREEN_SIZE = 0x8D51,
+        RENDERBUFFER_BLUE_SIZE = 0x8D52,
+        RENDERBUFFER_ALPHA_SIZE = 0x8D53,
+        RENDERBUFFER_DEPTH_SIZE = 0x8D54,
+        RENDERBUFFER_STENCIL_SIZE = 0x8D55,
+        FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0,
+        FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1,
+        FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2,
+        FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3,
+        COLOR_ATTACHMENT0 = 0x8CE0,
+        DEPTH_ATTACHMENT = 0x8D00,
+        STENCIL_ATTACHMENT = 0x8D20,
+        DEPTH_STENCIL_ATTACHMENT = 0x821A,
+        NONE = 0,
+        FRAMEBUFFER_COMPLETE = 0x8CD5,
+        FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6,
+        FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7,
+        FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9,
+        FRAMEBUFFER_UNSUPPORTED = 0x8CDD,
+        FRAMEBUFFER_BINDING = 0x8CA6,
+        RENDERBUFFER_BINDING = 0x8CA7,
+        MAX_RENDERBUFFER_SIZE = 0x84E8,
+        INVALID_FRAMEBUFFER_OPERATION = 0x0506,
+
+        // WebGL-specific enums
+        UNPACK_FLIP_Y_WEBGL = 0x9240,
+        UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241
+    };
+
+    // Context creation attributes.
+    struct Attributes {
+        Attributes()
+            : alpha(true)
+            , depth(true)
+            , stencil(false)
+            , antialias(true)
+            , premultipliedAlpha(true)
+        {
+        }
+
+        bool alpha;
+        bool depth;
+        bool stencil;
+        bool antialias;
+        bool premultipliedAlpha;
+    };
+
+    static PassOwnPtr<GraphicsContext3D> create(Attributes attrs, HostWindow* hostWindow);
+    virtual ~GraphicsContext3D();
 
 #if PLATFORM(MAC)
-        PlatformGraphicsContext3D platformGraphicsContext3D() const { return m_contextObj; }
-        Platform3DObject platformTexture() const { return m_texture; }
-        CALayer* platformLayer() const { return static_cast<CALayer*>(m_webGLLayer.get()); }
+    PlatformGraphicsContext3D platformGraphicsContext3D() const { return m_contextObj; }
+    Platform3DObject platformTexture() const { return m_texture; }
+    CALayer* platformLayer() const { return static_cast<CALayer*>(m_webGLLayer.get()); }
 #elif PLATFORM(CHROMIUM)
-        PlatformGraphicsContext3D platformGraphicsContext3D() const;
-        Platform3DObject platformTexture() const;
+    PlatformGraphicsContext3D platformGraphicsContext3D() const;
+    Platform3DObject platformTexture() const;
 #if USE(ACCELERATED_COMPOSITING)
-        PlatformLayer* platformLayer() const;
+    PlatformLayer* platformLayer() const;
 #endif
 #elif PLATFORM(QT)
-        PlatformGraphicsContext3D platformGraphicsContext3D();
-        Platform3DObject platformTexture() const;
+    PlatformGraphicsContext3D platformGraphicsContext3D();
+    Platform3DObject platformTexture() const;
 #if USE(ACCELERATED_COMPOSITING)
-        PlatformLayer* platformLayer() const { return 0; }
+    PlatformLayer* platformLayer() const { return 0; }
 #endif
 #else
-        PlatformGraphicsContext3D platformGraphicsContext3D() const { return NullPlatformGraphicsContext3D; }
-        Platform3DObject platformTexture() const { return NullPlatform3DObject; }
+    PlatformGraphicsContext3D platformGraphicsContext3D() const { return NullPlatformGraphicsContext3D; }
+    Platform3DObject platformTexture() const { return NullPlatform3DObject; }
 #if USE(ACCELERATED_COMPOSITING)
-        PlatformLayer* platformLayer() const { return 0; }
+    PlatformLayer* platformLayer() const { return 0; }
 #endif
 #endif
-        void makeContextCurrent();
+    void makeContextCurrent();
 
 #if PLATFORM(MAC) || PLATFORM(CHROMIUM)
-        // With multisampling on, blit from multisampleFBO to regular FBO.
-        void prepareTexture();
+    // With multisampling on, blit from multisampleFBO to regular FBO.
+    void prepareTexture();
 #endif
 
-        // Helper to return the size in bytes of OpenGL data types
-        // like GL_FLOAT, GL_INT, etc.
-        int sizeInBytes(int type);
-
-        bool isGLES2Compliant() const;
-
-        //----------------------------------------------------------------------
-        // Helpers for texture uploading and pixel readback.
-        //
-
-        // Computes the components per pixel and bytes per component
-        // for the given format and type combination. Returns false if
-        // either was an invalid enum.
-        bool computeFormatAndTypeParameters(unsigned int format,
-                                            unsigned int type,
-                                            unsigned long* componentsPerPixel,
-                                            unsigned long* bytesPerComponent);
-
-        // Extracts the contents of the given Image into the passed Vector,
-        // packing the pixel data according to the given format and type,
-        // and obeying the flipY and premultiplyAlpha flags. Returns true
-        // upon success.
-        bool extractImageData(Image* image,
-                              unsigned int format,
-                              unsigned int type,
-                              bool flipY,
-                              bool premultiplyAlpha,
-                              Vector<uint8_t>& data);
-
-        // Extracts the contents of the given ImageData into the passed Vector,
-        // packing the pixel data according to the given format and type,
-        // and obeying the flipY and premultiplyAlpha flags. Returns true
-        // upon success.
-        bool extractImageData(ImageData*,
-                              unsigned int format,
-                              unsigned int type,
-                              bool flipY,
-                              bool premultiplyAlpha,
-                              Vector<uint8_t>& data);
-
-        // Helper function which extracts the user-supplied texture
-        // data, applying the flipY and premultiplyAlpha parameters.
-        // If the data is not tightly packed according to the passed
-        // unpackAlignment, the output data will be tightly packed.
-        // Returns true if successful, false if any error occurred.
-        bool extractTextureData(unsigned int width, unsigned int height,
-                                unsigned int format, unsigned int type,
-                                unsigned int unpackAlignment,
-                                bool flipY, bool premultiplyAlpha,
-                                ArrayBufferView* pixels,
-                                Vector<uint8_t>& data);
-
-        // Flips the given image data vertically, in-place.
-        void flipVertically(void* imageData,
-                            unsigned int width,
-                            unsigned int height,
-                            unsigned int bytesPerPixel,
-                            unsigned int unpackAlignment);
-
-        // Attempt to enumerate all possible native image formats to
-        // reduce the amount of temporary allocations during texture
-        // uploading. This enum must be public because it is accessed
-        // by non-member functions.
-        enum SourceDataFormat {
-            kSourceFormatRGBA8,
-            kSourceFormatRGB8,
-            kSourceFormatBGRA8,
-            kSourceFormatRGBA5551,
-            kSourceFormatRGBA4444,
-            kSourceFormatRGB565,
-            kSourceFormatR8,
-            kSourceFormatRA8,
-            kSourceFormatA8
-        };
-
-        //----------------------------------------------------------------------
-        // Entry points for WebGL.
-        //
-
-        void activeTexture(unsigned long texture);
-        void attachShader(Platform3DObject program, Platform3DObject shader);
-        void bindAttribLocation(Platform3DObject, unsigned long index, const String& name);
-        void bindBuffer(unsigned long target, Platform3DObject);
-        void bindFramebuffer(unsigned long target, Platform3DObject);
-        void bindRenderbuffer(unsigned long target, Platform3DObject);
-        void bindTexture(unsigned long target, Platform3DObject texture);
-        void blendColor(double red, double green, double blue, double alpha);
-        void blendEquation(unsigned long mode);
-        void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha);
-        void blendFunc(unsigned long sfactor, unsigned long dfactor);
-        void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha);
-
-        void bufferData(unsigned long target, int size, unsigned long usage);
-        void bufferData(unsigned long target, ArrayBuffer* data, unsigned long usage);
-        void bufferData(unsigned long target, ArrayBufferView* data, unsigned long usage);
-        void bufferSubData(unsigned long target, long offset, ArrayBuffer* data);
-        void bufferSubData(unsigned long target, long offset, ArrayBufferView* data);
-
-        unsigned long checkFramebufferStatus(unsigned long target);
-        void clear(unsigned long mask);
-        void clearColor(double red, double green, double blue, double alpha);
-        void clearDepth(double depth);
-        void clearStencil(long s);
-        void colorMask(bool red, bool green, bool blue, bool alpha);
-        void compileShader(Platform3DObject);
-        
-        //void compressedTexImage2D(unsigned long target, long level, unsigned long internalformat, unsigned long width, unsigned long height, long border, unsigned long imageSize, const void* data);
-        //void compressedTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, unsigned long width, unsigned long height, unsigned long format, unsigned long imageSize, const void* data);
-        
-        void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border);
-        void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height);
-        void cullFace(unsigned long mode);
-        void depthFunc(unsigned long func);
-        void depthMask(bool flag);
-        void depthRange(double zNear, double zFar);
-        void detachShader(Platform3DObject, Platform3DObject);
-        void disable(unsigned long cap);
-        void disableVertexAttribArray(unsigned long index);
-        void drawArrays(unsigned long mode, long first, long count);
-        void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset);
-
-        void enable(unsigned long cap);
-        void enableVertexAttribArray(unsigned long index);
-        void finish();
-        void flush();
-        void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject);
-        void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject, long level);
-        void frontFace(unsigned long mode);
-        void generateMipmap(unsigned long target);
-
-        bool getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo&);
-        bool getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo&);
-
-        void getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders);
-
-        int getAttribLocation(Platform3DObject, const String& name);
-
-        void getBooleanv(unsigned long pname, unsigned char* value);
-
-        void getBufferParameteriv(unsigned long target, unsigned long pname, int* value);
-
-        Attributes getContextAttributes();
-
-        unsigned long getError();
-
-        void getFloatv(unsigned long pname, float* value);
-
-        void getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value);
-
-        void getIntegerv(unsigned long pname, int* value);
-
-        void getProgramiv(Platform3DObject program, unsigned long pname, int* value);
-
-        String getProgramInfoLog(Platform3DObject);
-
-        void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value);
-
-        void getShaderiv(Platform3DObject, unsigned long pname, int* value);
-
-        String getShaderInfoLog(Platform3DObject);
-
-        // TBD
-        // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
-
-        String getShaderSource(Platform3DObject);
-        String getString(unsigned long name);
-
-        void getTexParameterfv(unsigned long target, unsigned long pname, float* value);
-        void getTexParameteriv(unsigned long target, unsigned long pname, int* value);
-
-        void getUniformfv(Platform3DObject program, long location, float* value);
-        void getUniformiv(Platform3DObject program, long location, int* value);
-
-        long getUniformLocation(Platform3DObject, const String& name);
-
-        void getVertexAttribfv(unsigned long index, unsigned long pname, float* value);
-        void getVertexAttribiv(unsigned long index, unsigned long pname, int* value);
-
-        long getVertexAttribOffset(unsigned long index, unsigned long pname);
-
-        void hint(unsigned long target, unsigned long mode);
-        bool isBuffer(Platform3DObject);
-        bool isEnabled(unsigned long cap);
-        bool isFramebuffer(Platform3DObject);
-        bool isProgram(Platform3DObject);
-        bool isRenderbuffer(Platform3DObject);
-        bool isShader(Platform3DObject);
-        bool isTexture(Platform3DObject);
-        void lineWidth(double);
-        void linkProgram(Platform3DObject);
-        void pixelStorei(unsigned long pname, long param);
-        void polygonOffset(double factor, double units);
-        
-        void readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, void* data);
-        
-        void releaseShaderCompiler();
-        void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height);
-        void sampleCoverage(double value, bool invert);
-        void scissor(long x, long y, unsigned long width, unsigned long height);
-        void shaderSource(Platform3DObject, const String& string);
-        void stencilFunc(unsigned long func, long ref, unsigned long mask);
-        void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask);
-        void stencilMask(unsigned long mask);
-        void stencilMaskSeparate(unsigned long face, unsigned long mask);
-        void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass);
-        void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass);
-
-        int texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels);
-
-        void texParameterf(unsigned target, unsigned pname, float param);
-        void texParameteri(unsigned target, unsigned pname, int param);
-
-        int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, void* pixels);
-
-        void uniform1f(long location, float x);
-        void uniform1fv(long location, float* v, int size);
-        void uniform1i(long location, int x);
-        void uniform1iv(long location, int* v, int size);
-        void uniform2f(long location, float x, float y);
-        void uniform2fv(long location, float* v, int size);
-        void uniform2i(long location, int x, int y);
-        void uniform2iv(long location, int* v, int size);
-        void uniform3f(long location, float x, float y, float z);
-        void uniform3fv(long location, float* v, int size);
-        void uniform3i(long location, int x, int y, int z);
-        void uniform3iv(long location, int* v, int size);
-        void uniform4f(long location, float x, float y, float z, float w);
-        void uniform4fv(long location, float* v, int size);
-        void uniform4i(long location, int x, int y, int z, int w);
-        void uniform4iv(long location, int* v, int size);
-        void uniformMatrix2fv(long location, bool transpose, float* value, int size);
-        void uniformMatrix3fv(long location, bool transpose, float* value, int size);
-        void uniformMatrix4fv(long location, bool transpose, float* value, int size);
+    // Helper to return the size in bytes of OpenGL data types
+    // like GL_FLOAT, GL_INT, etc.
+    int sizeInBytes(int type);
+
+    bool isGLES2Compliant() const;
+
+    //----------------------------------------------------------------------
+    // Helpers for texture uploading and pixel readback.
+    //
+
+    // Computes the components per pixel and bytes per component
+    // for the given format and type combination. Returns false if
+    // either was an invalid enum.
+    bool computeFormatAndTypeParameters(unsigned int format,
+                                        unsigned int type,
+                                        unsigned long* componentsPerPixel,
+                                        unsigned long* bytesPerComponent);
+
+    // Extracts the contents of the given Image into the passed Vector,
+    // packing the pixel data according to the given format and type,
+    // and obeying the flipY and premultiplyAlpha flags. Returns true
+    // upon success.
+    bool extractImageData(Image* image,
+                          unsigned int format,
+                          unsigned int type,
+                          bool flipY,
+                          bool premultiplyAlpha,
+                          Vector<uint8_t>& data);
+
+    // Extracts the contents of the given ImageData into the passed Vector,
+    // packing the pixel data according to the given format and type,
+    // and obeying the flipY and premultiplyAlpha flags. Returns true
+    // upon success.
+    bool extractImageData(ImageData*,
+                          unsigned int format,
+                          unsigned int type,
+                          bool flipY,
+                          bool premultiplyAlpha,
+                          Vector<uint8_t>& data);
+
+    // Helper function which extracts the user-supplied texture
+    // data, applying the flipY and premultiplyAlpha parameters.
+    // If the data is not tightly packed according to the passed
+    // unpackAlignment, the output data will be tightly packed.
+    // Returns true if successful, false if any error occurred.
+    bool extractTextureData(unsigned int width, unsigned int height,
+                            unsigned int format, unsigned int type,
+                            unsigned int unpackAlignment,
+                            bool flipY, bool premultiplyAlpha,
+                            ArrayBufferView* pixels,
+                            Vector<uint8_t>& data);
+
+    // Flips the given image data vertically, in-place.
+    void flipVertically(void* imageData,
+                        unsigned int width,
+                        unsigned int height,
+                        unsigned int bytesPerPixel,
+                        unsigned int unpackAlignment);
+
+    // Attempt to enumerate all possible native image formats to
+    // reduce the amount of temporary allocations during texture
+    // uploading. This enum must be public because it is accessed
+    // by non-member functions.
+    enum SourceDataFormat {
+        kSourceFormatRGBA8,
+        kSourceFormatRGB8,
+        kSourceFormatBGRA8,
+        kSourceFormatRGBA5551,
+        kSourceFormatRGBA4444,
+        kSourceFormatRGB565,
+        kSourceFormatR8,
+        kSourceFormatRA8,
+        kSourceFormatA8
+    };
+
+    //----------------------------------------------------------------------
+    // Entry points for WebGL.
+    //
+
+    void activeTexture(unsigned long texture);
+    void attachShader(Platform3DObject program, Platform3DObject shader);
+    void bindAttribLocation(Platform3DObject, unsigned long index, const String& name);
+    void bindBuffer(unsigned long target, Platform3DObject);
+    void bindFramebuffer(unsigned long target, Platform3DObject);
+    void bindRenderbuffer(unsigned long target, Platform3DObject);
+    void bindTexture(unsigned long target, Platform3DObject texture);
+    void blendColor(double red, double green, double blue, double alpha);
+    void blendEquation(unsigned long mode);
+    void blendEquationSeparate(unsigned long modeRGB, unsigned long modeAlpha);
+    void blendFunc(unsigned long sfactor, unsigned long dfactor);
+    void blendFuncSeparate(unsigned long srcRGB, unsigned long dstRGB, unsigned long srcAlpha, unsigned long dstAlpha);
+
+    void bufferData(unsigned long target, int size, unsigned long usage);
+    void bufferData(unsigned long target, ArrayBuffer* data, unsigned long usage);
+    void bufferData(unsigned long target, ArrayBufferView* data, unsigned long usage);
+    void bufferSubData(unsigned long target, long offset, ArrayBuffer* data);
+    void bufferSubData(unsigned long target, long offset, ArrayBufferView* data);
+
+    unsigned long checkFramebufferStatus(unsigned long target);
+    void clear(unsigned long mask);
+    void clearColor(double red, double green, double blue, double alpha);
+    void clearDepth(double depth);
+    void clearStencil(long s);
+    void colorMask(bool red, bool green, bool blue, bool alpha);
+    void compileShader(Platform3DObject);
+
+    // void compressedTexImage2D(unsigned long target, long level, unsigned long internalformat, unsigned long width, unsigned long height, long border, unsigned long imageSize, const void* data);
+    // void compressedTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, unsigned long width, unsigned long height, unsigned long format, unsigned long imageSize, const void* data);
+
+    void copyTexImage2D(unsigned long target, long level, unsigned long internalformat, long x, long y, unsigned long width, unsigned long height, long border);
+    void copyTexSubImage2D(unsigned long target, long level, long xoffset, long yoffset, long x, long y, unsigned long width, unsigned long height);
+    void cullFace(unsigned long mode);
+    void depthFunc(unsigned long func);
+    void depthMask(bool flag);
+    void depthRange(double zNear, double zFar);
+    void detachShader(Platform3DObject, Platform3DObject);
+    void disable(unsigned long cap);
+    void disableVertexAttribArray(unsigned long index);
+    void drawArrays(unsigned long mode, long first, long count);
+    void drawElements(unsigned long mode, unsigned long count, unsigned long type, long offset);
 
-        void useProgram(Platform3DObject);
-        void validateProgram(Platform3DObject);
+    void enable(unsigned long cap);
+    void enableVertexAttribArray(unsigned long index);
+    void finish();
+    void flush();
+    void framebufferRenderbuffer(unsigned long target, unsigned long attachment, unsigned long renderbuffertarget, Platform3DObject);
+    void framebufferTexture2D(unsigned long target, unsigned long attachment, unsigned long textarget, Platform3DObject, long level);
+    void frontFace(unsigned long mode);
+    void generateMipmap(unsigned long target);
+
+    bool getActiveAttrib(Platform3DObject program, unsigned long index, ActiveInfo&);
+    bool getActiveUniform(Platform3DObject program, unsigned long index, ActiveInfo&);
+
+    void getAttachedShaders(Platform3DObject program, int maxCount, int* count, unsigned int* shaders);
+
+    int getAttribLocation(Platform3DObject, const String& name);
+
+    void getBooleanv(unsigned long pname, unsigned char* value);
+
+    void getBufferParameteriv(unsigned long target, unsigned long pname, int* value);
+
+    Attributes getContextAttributes();
+
+    unsigned long getError();
+
+    void getFloatv(unsigned long pname, float* value);
+
+    void getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value);
+
+    void getIntegerv(unsigned long pname, int* value);
+
+    void getProgramiv(Platform3DObject program, unsigned long pname, int* value);
+
+    String getProgramInfoLog(Platform3DObject);
+
+    void getRenderbufferParameteriv(unsigned long target, unsigned long pname, int* value);
+
+    void getShaderiv(Platform3DObject, unsigned long pname, int* value);
+
+    String getShaderInfoLog(Platform3DObject);
+
+    // TBD
+    // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
+
+    String getShaderSource(Platform3DObject);
+    String getString(unsigned long name);
+
+    void getTexParameterfv(unsigned long target, unsigned long pname, float* value);
+    void getTexParameteriv(unsigned long target, unsigned long pname, int* value);
+
+    void getUniformfv(Platform3DObject program, long location, float* value);
+    void getUniformiv(Platform3DObject program, long location, int* value);
+
+    long getUniformLocation(Platform3DObject, const String& name);
+
+    void getVertexAttribfv(unsigned long index, unsigned long pname, float* value);
+    void getVertexAttribiv(unsigned long index, unsigned long pname, int* value);
+
+    long getVertexAttribOffset(unsigned long index, unsigned long pname);
+
+    void hint(unsigned long target, unsigned long mode);
+    bool isBuffer(Platform3DObject);
+    bool isEnabled(unsigned long cap);
+    bool isFramebuffer(Platform3DObject);
+    bool isProgram(Platform3DObject);
+    bool isRenderbuffer(Platform3DObject);
+    bool isShader(Platform3DObject);
+    bool isTexture(Platform3DObject);
+    void lineWidth(double);
+    void linkProgram(Platform3DObject);
+    void pixelStorei(unsigned long pname, long param);
+    void polygonOffset(double factor, double units);
+
+    void readPixels(long x, long y, unsigned long width, unsigned long height, unsigned long format, unsigned long type, void* data);
+
+    void releaseShaderCompiler();
+    void renderbufferStorage(unsigned long target, unsigned long internalformat, unsigned long width, unsigned long height);
+    void sampleCoverage(double value, bool invert);
+    void scissor(long x, long y, unsigned long width, unsigned long height);
+    void shaderSource(Platform3DObject, const String& string);
+    void stencilFunc(unsigned long func, long ref, unsigned long mask);
+    void stencilFuncSeparate(unsigned long face, unsigned long func, long ref, unsigned long mask);
+    void stencilMask(unsigned long mask);
+    void stencilMaskSeparate(unsigned long face, unsigned long mask);
+    void stencilOp(unsigned long fail, unsigned long zfail, unsigned long zpass);
+    void stencilOpSeparate(unsigned long face, unsigned long fail, unsigned long zfail, unsigned long zpass);
 
-        void vertexAttrib1f(unsigned long indx, float x);
-        void vertexAttrib1fv(unsigned long indx, float* values);
-        void vertexAttrib2f(unsigned long indx, float x, float y);
-        void vertexAttrib2fv(unsigned long indx, float* values);
-        void vertexAttrib3f(unsigned long indx, float x, float y, float z);
-        void vertexAttrib3fv(unsigned long indx, float* values);
-        void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w);
-        void vertexAttrib4fv(unsigned long indx, float* values);
-        void vertexAttribPointer(unsigned long indx, int size, int type, bool normalized,
-                                 unsigned long stride, unsigned long offset);
-
-        void viewport(long x, long y, unsigned long width, unsigned long height);
-
-        void reshape(int width, int height);
+    int texImage2D(unsigned target, unsigned level, unsigned internalformat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, void* pixels);
+
+    void texParameterf(unsigned target, unsigned pname, float param);
+    void texParameteri(unsigned target, unsigned pname, int param);
+
+    int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset, unsigned width, unsigned height, unsigned format, unsigned type, void* pixels);
+
+    void uniform1f(long location, float x);
+    void uniform1fv(long location, float* v, int size);
+    void uniform1i(long location, int x);
+    void uniform1iv(long location, int* v, int size);
+    void uniform2f(long location, float x, float y);
+    void uniform2fv(long location, float* v, int size);
+    void uniform2i(long location, int x, int y);
+    void uniform2iv(long location, int* v, int size);
+    void uniform3f(long location, float x, float y, float z);
+    void uniform3fv(long location, float* v, int size);
+    void uniform3i(long location, int x, int y, int z);
+    void uniform3iv(long location, int* v, int size);
+    void uniform4f(long location, float x, float y, float z, float w);
+    void uniform4fv(long location, float* v, int size);
+    void uniform4i(long location, int x, int y, int z, int w);
+    void uniform4iv(long location, int* v, int size);
+    void uniformMatrix2fv(long location, bool transpose, float* value, int size);
+    void uniformMatrix3fv(long location, bool transpose, float* value, int size);
+    void uniformMatrix4fv(long location, bool transpose, float* value, int size);
+
+    void useProgram(Platform3DObject);
+    void validateProgram(Platform3DObject);
+
+    void vertexAttrib1f(unsigned long indx, float x);
+    void vertexAttrib1fv(unsigned long indx, float* values);
+    void vertexAttrib2f(unsigned long indx, float x, float y);
+    void vertexAttrib2fv(unsigned long indx, float* values);
+    void vertexAttrib3f(unsigned long indx, float x, float y, float z);
+    void vertexAttrib3fv(unsigned long indx, float* values);
+    void vertexAttrib4f(unsigned long indx, float x, float y, float z, float w);
+    void vertexAttrib4fv(unsigned long indx, float* values);
+    void vertexAttribPointer(unsigned long indx, int size, int type, bool normalized,
+                             unsigned long stride, unsigned long offset);
+
+    void viewport(long x, long y, unsigned long width, unsigned long height);
+
+    void reshape(int width, int height);
 
 #if PLATFORM(CG)
-        void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight,
-                           int canvasWidth, int canvasHeight, CGContextRef context);
+    void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight,
+                       int canvasWidth, int canvasHeight, CGContextRef context);
 #endif
 
-        void paintRenderingResultsToCanvas(CanvasRenderingContext* context);
+    void paintRenderingResultsToCanvas(CanvasRenderingContext* context);
 
-        // Helpers for notification about paint events
-        void beginPaint(CanvasRenderingContext* context);
-        void endPaint();
+    // Helpers for notification about paint events
+    void beginPaint(CanvasRenderingContext* context);
+    void endPaint();
 #if PLATFORM(QT)
-        void paint(QPainter* painter, const QRect& rect) const;
+    void paint(QPainter* painter, const QRect& rect) const;
 #endif
 
-        // Support for buffer creation and deletion
-        unsigned createBuffer();
-        unsigned createFramebuffer();
-        unsigned createProgram();
-        unsigned createRenderbuffer();
-        unsigned createShader(unsigned long);
-        unsigned createTexture();
-        
-        void deleteBuffer(unsigned);
-        void deleteFramebuffer(unsigned);
-        void deleteProgram(unsigned);
-        void deleteRenderbuffer(unsigned);
-        void deleteShader(unsigned);
-        void deleteTexture(unsigned);        
-        
-        // Synthesizes an OpenGL error which will be returned from a
-        // later call to getError. This is used to emulate OpenGL ES
-        // 2.0 behavior on the desktop and to enforce additional error
-        // checking mandated by WebGL.
-        //
-        // Per the behavior of glGetError, this stores at most one
-        // instance of any given error, and returns them from calls to
-        // getError in the order they were added.
-        void synthesizeGLError(unsigned long error);
-
-    private:        
-        GraphicsContext3D(Attributes attrs, HostWindow* hostWindow);
-
-        // Each platform must provide an implementation of this method.
-        //
-        // Gets the data for the given Image into outputVector in the
-        // format specified by the (OpenGL-style) format and type
-        // arguments. Despite the fact that the outputVector contains
-        // uint8_t, if the format and type specify packed pixels, then
-        // it will essentially contain uint16_t after the extraction
-        // process.
-        //
-        // If premultiplyAlpha is true, the alpha channel, if any,
-        // will be multiplied into the color channels during the
-        // extraction process. This premultiplication occurs before
-        // any packing of pixel data.
-        //
-        // No vertical flip of the image data is performed by this
-        // method.
-        bool getImageData(Image* image,
-                          unsigned int format,
-                          unsigned int type,
-                          bool premultiplyAlpha,
-                          Vector<uint8_t>& outputVector);
-
-        // Possible alpha operations that may need to occur during
-        // pixel packing. FIXME: kAlphaDoUnmultiply is lossy and must
-        // be removed.
-        enum AlphaOp {
-            kAlphaDoNothing = 0,
-            kAlphaDoPremultiply = 1,
-            kAlphaDoUnmultiply = 2
-        };
-
-        // Helper for getImageData which implements packing of pixel
-        // data into the specified OpenGL destination format and type.
-        // A sourceUnpackAlignment of zero indicates that the source
-        // data is tightly packed. Non-zero values may take a slow path.
-        // Destination data will have no gaps between rows.
-        bool packPixels(const uint8_t* sourceData,
-                        SourceDataFormat sourceDataFormat,
-                        unsigned int width,
-                        unsigned int height,
-                        unsigned int sourceUnpackAlignment,
-                        unsigned int destinationFormat,
-                        unsigned int destinationType,
-                        AlphaOp alphaOp,
-                        void* destinationData);
+    // Support for buffer creation and deletion
+    unsigned createBuffer();
+    unsigned createFramebuffer();
+    unsigned createProgram();
+    unsigned createRenderbuffer();
+    unsigned createShader(unsigned long);
+    unsigned createTexture();
+
+    void deleteBuffer(unsigned);
+    void deleteFramebuffer(unsigned);
+    void deleteProgram(unsigned);
+    void deleteRenderbuffer(unsigned);
+    void deleteShader(unsigned);
+    void deleteTexture(unsigned);
+
+    // Synthesizes an OpenGL error which will be returned from a
+    // later call to getError. This is used to emulate OpenGL ES
+    // 2.0 behavior on the desktop and to enforce additional error
+    // checking mandated by WebGL.
+    //
+    // Per the behavior of glGetError, this stores at most one
+    // instance of any given error, and returns them from calls to
+    // getError in the order they were added.
+    void synthesizeGLError(unsigned long error);
+
+  private:
+    GraphicsContext3D(Attributes attrs, HostWindow* hostWindow);
+
+    // Each platform must provide an implementation of this method.
+    //
+    // Gets the data for the given Image into outputVector in the
+    // format specified by the (OpenGL-style) format and type
+    // arguments. Despite the fact that the outputVector contains
+    // uint8_t, if the format and type specify packed pixels, then
+    // it will essentially contain uint16_t after the extraction
+    // process.
+    //
+    // If premultiplyAlpha is true, the alpha channel, if any,
+    // will be multiplied into the color channels during the
+    // extraction process. This premultiplication occurs before
+    // any packing of pixel data.
+    //
+    // No vertical flip of the image data is performed by this
+    // method.
+    bool getImageData(Image* image,
+                      unsigned int format,
+                      unsigned int type,
+                      bool premultiplyAlpha,
+                      Vector<uint8_t>& outputVector);
+
+    // Possible alpha operations that may need to occur during
+    // pixel packing. FIXME: kAlphaDoUnmultiply is lossy and must
+    // be removed.
+    enum AlphaOp {
+        kAlphaDoNothing = 0,
+        kAlphaDoPremultiply = 1,
+        kAlphaDoUnmultiply = 2
+    };
+
+    // Helper for getImageData which implements packing of pixel
+    // data into the specified OpenGL destination format and type.
+    // A sourceUnpackAlignment of zero indicates that the source
+    // data is tightly packed. Non-zero values may take a slow path.
+    // Destination data will have no gaps between rows.
+    bool packPixels(const uint8_t* sourceData,
+                    SourceDataFormat sourceDataFormat,
+                    unsigned int width,
+                    unsigned int height,
+                    unsigned int sourceUnpackAlignment,
+                    unsigned int destinationFormat,
+                    unsigned int destinationType,
+                    AlphaOp alphaOp,
+                    void* destinationData);
 
 #if PLATFORM(MAC)
-        // Take into account the user's requested context creation attributes,
-        // in particular stencil and antialias, and determine which could or
-        // could not be honored based on the capabilities of the OpenGL
-        // implementation.
-        void validateAttributes();
+    // Take into account the user's requested context creation attributes,
+    // in particular stencil and antialias, and determine which could or
+    // could not be honored based on the capabilities of the OpenGL
+    // implementation.
+    void validateAttributes();
 #endif
 
-        int m_currentWidth, m_currentHeight;
-        
+    int m_currentWidth, m_currentHeight;
+
 #if PLATFORM(MAC)
-        Attributes m_attrs;
-        Vector<Vector<float> > m_vertexArray;
-        
-        CGLContextObj m_contextObj;
-        RetainPtr<WebGLLayer> m_webGLLayer;
-        GLuint m_texture;
-        GLuint m_fbo;
-        GLuint m_depthStencilBuffer;
-
-        // For tracking which FBO is bound
-        GLuint m_boundFBO;
-
-        // For multisampling
-        GLuint m_multisampleFBO;
-        GLuint m_multisampleDepthStencilBuffer;
-        GLuint m_multisampleColorBuffer;
-
-        // Errors raised by synthesizeGLError().
-        ListHashSet<unsigned long> m_syntheticErrors;
-#endif        
-
-        // FIXME: ideally this would be used on all platforms.
+    Attributes m_attrs;
+    Vector<Vector<float> > m_vertexArray;
+
+    CGLContextObj m_contextObj;
+    RetainPtr<WebGLLayer> m_webGLLayer;
+    GLuint m_texture;
+    GLuint m_fbo;
+    GLuint m_depthStencilBuffer;
+
+    // For tracking which FBO is bound
+    GLuint m_boundFBO;
+
+    // For multisampling
+    GLuint m_multisampleFBO;
+    GLuint m_multisampleDepthStencilBuffer;
+    GLuint m_multisampleColorBuffer;
+
+    // Errors raised by synthesizeGLError().
+    ListHashSet<unsigned long> m_syntheticErrors;
+#endif
+
+    // FIXME: ideally this would be used on all platforms.
 #if PLATFORM(CHROMIUM) || PLATFORM(QT)
-        friend class GraphicsContext3DInternal;
-        OwnPtr<GraphicsContext3DInternal> m_internal;
+    friend class GraphicsContext3DInternal;
+    OwnPtr<GraphicsContext3DInternal> m_internal;
 #endif
-    };
+};
 
 } // namespace WebCore
 
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 20b72c8..7048b8e 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,19 @@
+2010-08-04  Kenneth Russell  <kbr at google.com>
+
+        Reviewed by Dimitri Glazkov.
+
+        Style cleanups in WebGL
+        https://bugs.webkit.org/show_bug.cgi?id=38761
+
+        Cleaned up all style violations in WebGL-related files reported by
+        check-webkit-style. No logic or other changes. Built WebKit and
+        Chromium and ran WebGL layout tests.
+
+        * src/GraphicsContext3D.cpp:
+        (WebCore::GraphicsContext3DInternal::paintRenderingResultsToCanvas):
+        * src/WebGraphicsContext3DDefaultImpl.cpp:
+        * src/WebGraphicsContext3DDefaultImpl.h:
+
 2010-08-05  Jian Li  <jianli at chromium.org>
 
         Reviewed by David Levin.
diff --git a/WebKit/chromium/src/GraphicsContext3D.cpp b/WebKit/chromium/src/GraphicsContext3D.cpp
index ad5c596..d6ad1a3 100644
--- a/WebKit/chromium/src/GraphicsContext3D.cpp
+++ b/WebKit/chromium/src/GraphicsContext3D.cpp
@@ -38,13 +38,13 @@
 #include "CanvasRenderingContext.h"
 #include "Chrome.h"
 #include "ChromeClientImpl.h"
+#include "Float32Array.h"
 #include "HTMLCanvasElement.h"
 #include "HTMLImageElement.h"
 #include "ImageBuffer.h"
 #include "ImageData.h"
-#include "Int8Array.h"
-#include "Float32Array.h"
 #include "Int32Array.h"
+#include "Int8Array.h"
 #include "Uint8Array.h"
 #include "WebGLLayerChromium.h"
 #include "WebGraphicsContext3D.h"
@@ -414,9 +414,8 @@ void GraphicsContext3DInternal::paintRenderingResultsToCanvas(CanvasRenderingCon
             m_resizingBitmap.setConfig(SkBitmap::kARGB_8888_Config,
                                        m_impl->width(),
                                        m_impl->height());
-            if (!m_resizingBitmap.allocPixels()) {
+            if (!m_resizingBitmap.allocPixels())
                 return;
-            }
         }
         readbackBitmap = &m_resizingBitmap;
     }
diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
index 47bb5a0..410ac3b 100644
--- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
+++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
@@ -32,13 +32,13 @@
 
 #if ENABLE(3D_CANVAS)
 
-#include <stdio.h>
-#include <string.h>
-
 #include "WebGraphicsContext3DDefaultImpl.h"
 
 #include "NotImplemented.h"
 
+#include <stdio.h>
+#include <string.h>
+
 #if OS(LINUX)
 #include <dlfcn.h>
 #endif
diff --git a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h
index e409bf5..8223a1c 100644
--- a/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h
+++ b/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h
@@ -325,8 +325,8 @@ private:
 
     static bool s_initializedGLEW;
 #if OS(WINDOWS)
-    HWND  m_canvasWindow;
-    HDC   m_canvasDC;
+    HWND m_canvasWindow;
+    HDC m_canvasDC;
     HGLRC m_contextObj;
 #elif PLATFORM(CG)
     CGLPBufferObj m_pbuffer;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list