[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

oliver at apple.com oliver at apple.com
Wed Apr 7 23:17:45 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 1de7bf2129f5551dc7c8d306bba8a8e8125d539c
Author: oliver at apple.com <oliver at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Nov 1 21:30:16 2009 +0000

    Fix layering violations in GraphicsContext3D
    https://bugs.webkit.org/show_bug.cgi?id=30986
    
    Reviewed by Darin Adler.
    
    Remove uses of HTMLImageElement and HTMLCanvasElement
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50394 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 26556bf..77adf42 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2009-10-31  Oliver Hunt  <oliver at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Fix layering violations in GraphicsContext3D
+        https://bugs.webkit.org/show_bug.cgi?id=30986
+
+        Remove uses of HTMLImageElement and HTMLCanvasElement
+
+        * html/canvas/CanvasRenderingContext3D.cpp:
+        (WebCore::CanvasRenderingContext3D::texImage2D):
+        (WebCore::CanvasRenderingContext3D::texSubImage2D):
+        * platform/graphics/GraphicsContext3D.h:
+        * platform/graphics/mac/GraphicsContext3DMac.cpp:
+        (WebCore::GraphicsContext3D::texImage2D):
+        (WebCore::GraphicsContext3D::texSubImage2D):
+
 2009-11-01  Joanmarie Diggs  <joanmarie.diggs at gmail.com>
 
         Reviewed by Jan Alonzo.
diff --git a/WebCore/html/canvas/CanvasRenderingContext3D.cpp b/WebCore/html/canvas/CanvasRenderingContext3D.cpp
index 84ccf4c..4e1fa28 100644
--- a/WebCore/html/canvas/CanvasRenderingContext3D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext3D.cpp
@@ -37,6 +37,8 @@
 #include "CanvasTexture.h"
 #include "CanvasShader.h"
 #include "HTMLCanvasElement.h"
+#include "HTMLImageElement.h"
+#include "ImageBuffer.h"
 #include "RenderBox.h"
 #include "RenderLayer.h"
 
@@ -1005,18 +1007,36 @@ void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, unsig
 void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, HTMLImageElement* image,
                                           bool flipY, bool premultiplyAlpha, ExceptionCode& ec)
 {
-    // FIXME: For now we ignore any errors returned
     ec = 0;
-    m_context->texImage2D(target, level, image, flipY, premultiplyAlpha);
+    if (!image) {
+        ec = TYPE_MISMATCH_ERR;
+        return;
+    }
+
+    CachedImage* cachedImage = image->cachedImage();
+    if (!cachedImage)
+        return;
+
+    // FIXME: For now we ignore any errors returned
+    m_context->texImage2D(target, level, cachedImage->image(), flipY, premultiplyAlpha);
     cleanupAfterGraphicsCall(false);
 }
 
 void CanvasRenderingContext3D::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas,
                                           bool flipY, bool premultiplyAlpha, ExceptionCode& ec)
 {
-    // FIXME: For now we ignore any errors returned
     ec = 0;
-    m_context->texImage2D(target, level, canvas, flipY, premultiplyAlpha);
+    if (!canvas) {
+        ec = TYPE_MISMATCH_ERR;
+        return;
+    }
+
+    ImageBuffer* buffer = canvas->buffer();
+    if (!buffer)
+        return;
+
+    // FIXME: For now we ignore any errors returned
+    m_context->texImage2D(target, level, buffer->image(), flipY, premultiplyAlpha);
     cleanupAfterGraphicsCall(false);
 }
 
@@ -1067,7 +1087,16 @@ void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, un
 {
     // FIXME: For now we ignore any errors returned
     ec = 0;
-    m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, image, flipY, premultiplyAlpha);
+    if (!image) {
+        ec = TYPE_MISMATCH_ERR;
+        return;
+    }
+    
+    CachedImage* cachedImage = image->cachedImage();
+    if (!cachedImage)
+        return;
+
+    m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, cachedImage->image(), flipY, premultiplyAlpha);
     cleanupAfterGraphicsCall(false);
 }
 
@@ -1075,9 +1104,18 @@ void CanvasRenderingContext3D::texSubImage2D(unsigned target, unsigned level, un
                                              unsigned width, unsigned height, HTMLCanvasElement* canvas,
                                              bool flipY, bool premultiplyAlpha, ExceptionCode& ec)
 {
-    // FIXME: For now we ignore any errors returned
     ec = 0;
-    m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, canvas, flipY, premultiplyAlpha);
+    if (!canvas) {
+        ec = TYPE_MISMATCH_ERR;
+        return;
+    }
+    
+    ImageBuffer* buffer = canvas->buffer();
+    if (!buffer)
+        return;
+    
+    // FIXME: For now we ignore any errors returned
+    m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, buffer->image(), flipY, premultiplyAlpha);
     cleanupAfterGraphicsCall(false);
 }
 
diff --git a/WebCore/platform/graphics/GraphicsContext3D.h b/WebCore/platform/graphics/GraphicsContext3D.h
index 07ec04d..1174c01 100644
--- a/WebCore/platform/graphics/GraphicsContext3D.h
+++ b/WebCore/platform/graphics/GraphicsContext3D.h
@@ -58,8 +58,7 @@ namespace WebCore {
     class CanvasRenderingContext3D;
     class CanvasShader;
     class CanvasTexture;
-    class HTMLCanvasElement;
-    class HTMLImageElement;
+    class Image;
     class HTMLVideoElement;
     class ImageData;
     class WebKitCSSMatrix;
@@ -236,9 +235,7 @@ namespace WebCore {
         int texImage2D(unsigned target, unsigned level, unsigned internalformat,
                        unsigned width, unsigned height, unsigned border,
                        unsigned format, unsigned type, ImageData* pixels);
-        int texImage2D(unsigned target, unsigned level, HTMLImageElement* image,
-                       bool flipY, bool premultiplyAlpha);
-        int texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas,
+        int texImage2D(unsigned target, unsigned level, Image* image,
                        bool flipY, bool premultiplyAlpha);
         int texImage2D(unsigned target, unsigned level, HTMLVideoElement* video,
                        bool flipY, bool premultiplyAlpha);
@@ -253,10 +250,7 @@ namespace WebCore {
                           unsigned width, unsigned height,
                           unsigned format, unsigned type, ImageData* pixels);
         int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
-                          unsigned width, unsigned height, HTMLImageElement* image,
-                          bool flipY, bool premultiplyAlpha);
-        int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
-                          unsigned width, unsigned height, HTMLCanvasElement* canvas,
+                          unsigned width, unsigned height, Image* image,
                           bool flipY, bool premultiplyAlpha);
         int texSubImage2D(unsigned target, unsigned level, unsigned xoffset, unsigned yoffset,
                           unsigned width, unsigned height, HTMLVideoElement* video,
diff --git a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
index 11c6fb9..9afc0b6 100644
--- a/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
+++ b/WebCore/platform/graphics/mac/GraphicsContext3DMac.cpp
@@ -1568,39 +1568,15 @@ int GraphicsContext3D::texImage2D(unsigned target, unsigned level, unsigned inte
     return -1;
 }
 
-int GraphicsContext3D::texImage2D(unsigned target, unsigned level, HTMLImageElement* image, bool flipY, bool premultiplyAlpha)
+int GraphicsContext3D::texImage2D(unsigned target, unsigned level, Image* image, bool flipY, bool premultiplyAlpha)
 {
     // FIXME: need to support flipY and premultiplyAlpha
     UNUSED_PARAM(flipY);
     UNUSED_PARAM(premultiplyAlpha);
-    
-    if (!image)
-        return -1;
+    ASSERT(image);
     
     ensureContext(m_contextObj);
-    CachedImage* cachedImage = image->cachedImage();
-    if (!cachedImage)
-        return -1;
-    
-    imageToTexture(cachedImage->image(), target, level);
-    return 0;
-}
-
-int GraphicsContext3D::texImage2D(unsigned target, unsigned level, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha)
-{
-    // FIXME: need to support flipY and premultiplyAlpha
-    UNUSED_PARAM(flipY);
-    UNUSED_PARAM(premultiplyAlpha);
-    
-    if (!canvas)
-        return -1;
-    
-    ensureContext(m_contextObj);
-    ImageBuffer* buffer = canvas->buffer();
-    if (!buffer)
-        return -1;
-    
-    imageToTexture(buffer->image(), target, level);
+    imageToTexture(image, target, level);
     return 0;
 }
 
@@ -1647,7 +1623,7 @@ int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned x
     return -1;
 }
 
-int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoff, unsigned yoff, unsigned width, unsigned height, HTMLImageElement* image, bool flipY, bool premultiplyAlpha)
+int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoff, unsigned yoff, unsigned width, unsigned height, Image* image, bool flipY, bool premultiplyAlpha)
 {
     // FIXME: we will need to deal with PixelStore params when dealing with image buffers that differ from the subimage size
     UNUSED_PARAM(target);
@@ -1664,23 +1640,6 @@ int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned x
     return -1;
 }
 
-int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoff, unsigned yoff, unsigned width, unsigned height, HTMLCanvasElement* canvas, bool flipY, bool premultiplyAlpha)
-{
-    // FIXME: we will need to deal with PixelStore params when dealing with image buffers that differ from the subimage size
-    UNUSED_PARAM(target);
-    UNUSED_PARAM(level);
-    UNUSED_PARAM(xoff);
-    UNUSED_PARAM(yoff);
-    UNUSED_PARAM(width);
-    UNUSED_PARAM(height);
-    UNUSED_PARAM(canvas);
-
-    // FIXME: need to support flipY and premultiplyAlpha    
-    UNUSED_PARAM(flipY);
-    UNUSED_PARAM(premultiplyAlpha);
-    return -1;
-}
-
 int GraphicsContext3D::texSubImage2D(unsigned target, unsigned level, unsigned xoff, unsigned yoff, unsigned width, unsigned height, HTMLVideoElement* video, bool flipY, bool premultiplyAlpha)
 {
     // FIXME: we will need to deal with PixelStore params when dealing with image buffers that differ from the subimage size

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list