Diff
Modified: trunk/Source/WebCore/ChangeLog (108596 => 108597)
--- trunk/Source/WebCore/ChangeLog 2012-02-23 03:05:55 UTC (rev 108596)
+++ trunk/Source/WebCore/ChangeLog 2012-02-23 03:07:09 UTC (rev 108597)
@@ -1,3 +1,32 @@
+2012-02-22 James Robinson <[email protected]>
+
+ Remove GraphicsContext3D::paintsIntoCanvasBuffer and unify WebGL and canvas 2d logic
+ https://bugs.webkit.org/show_bug.cgi?id=79317
+
+ Reviewed by Kenneth Russell.
+
+ HTMLCanvasElement::paint needs to know whether to attempt to paint the canvas buffer for its context. In the
+ case of an accelerated canvas or WebGL context, unless we are printing it is typically the composited layer's
+ responsibility to present the contents and the element itself is only responsible for backgrounds, borders and
+ the like. This removes a rather indirect path that WebGL content used to take to accomplish this and unifies
+ the logic with CanvasRenderingContext2D's, which has the exact same needs.
+
+ Covered by existing canvas layout tests.
+
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::HTMLCanvasElement::paintsIntoCanvasBuffer):
+ (WebCore):
+ (WebCore::HTMLCanvasElement::paint):
+ * html/HTMLCanvasElement.h:
+ (HTMLCanvasElement):
+ * html/canvas/CanvasRenderingContext.h:
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ * html/canvas/CanvasRenderingContext2D.h:
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore):
+ * html/canvas/WebGLRenderingContext.h:
+ * platform/graphics/GraphicsContext3D.h:
+
2012-02-22 Pablo Flouret <[email protected]>
PopStateEvent.state should use the same object as history.state
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (108596 => 108597)
--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2012-02-23 03:05:55 UTC (rev 108596)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2012-02-23 03:07:09 UTC (rev 108597)
@@ -45,6 +45,7 @@
#include "MIMETypeRegistry.h"
#include "Page.h"
#include "RenderHTMLCanvas.h"
+#include "RenderLayer.h"
#include "Settings.h"
#include <math.h>
#include <stdio.h>
@@ -269,6 +270,20 @@
(*it)->canvasResized(this);
}
+bool HTMLCanvasElement::paintsIntoCanvasBuffer() const
+{
+ ASSERT(m_context);
+#if USE(ACCELERATED_COMPOSITING)
+ if (!m_context->isAccelerated())
+ return true;
+
+ if (renderBox() && renderBox()->hasLayer() && renderBox()->layer()->hasAcceleratedCompositing())
+ return false;
+#endif
+ return true;
+}
+
+
void HTMLCanvasElement::paint(GraphicsContext* context, const LayoutRect& r, bool useLowQualityScale)
{
// Clear the dirty rect
@@ -278,7 +293,7 @@
return;
if (m_context) {
- if (!m_context->paintsIntoCanvasBuffer() && !document()->printing())
+ if (!paintsIntoCanvasBuffer() && !document()->printing())
return;
m_context->paintRenderingResultsToCanvas();
}
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (108596 => 108597)
--- trunk/Source/WebCore/html/HTMLCanvasElement.h 2012-02-23 03:05:55 UTC (rev 108596)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h 2012-02-23 03:07:09 UTC (rev 108597)
@@ -148,6 +148,8 @@
bool shouldDefer() const;
+ bool paintsIntoCanvasBuffer() const;
+
HashSet<CanvasObserver*> m_observers;
IntSize m_size;
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext.h (108596 => 108597)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext.h 2012-02-23 03:05:55 UTC (rev 108596)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext.h 2012-02-23 03:07:09 UTC (rev 108597)
@@ -55,7 +55,6 @@
virtual bool isAccelerated() const { return false; }
virtual void paintRenderingResultsToCanvas() {}
- virtual bool paintsIntoCanvasBuffer() const { return true; }
#if USE(ACCELERATED_COMPOSITING)
virtual PlatformLayer* platformLayer() const { return 0; }
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (108596 => 108597)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2012-02-23 03:05:55 UTC (rev 108596)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2012-02-23 03:07:09 UTC (rev 108597)
@@ -155,20 +155,6 @@
#endif
}
-bool CanvasRenderingContext2D::paintsIntoCanvasBuffer() const
-{
-#if ENABLE(ACCELERATED_2D_CANVAS) && USE(ACCELERATED_COMPOSITING)
- if (!isAccelerated())
- return true;
-
- RenderBox* renderBox = canvas()->renderBox();
- if (renderBox && renderBox->hasLayer() && renderBox->layer()->hasAcceleratedCompositing())
- return false;
-#endif
- return true;
-}
-
-
void CanvasRenderingContext2D::reset()
{
unwindStateStack();
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h (108596 => 108597)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h 2012-02-23 03:05:55 UTC (rev 108596)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h 2012-02-23 03:07:09 UTC (rev 108597)
@@ -67,7 +67,6 @@
virtual bool is2d() const { return true; }
virtual bool isAccelerated() const;
- virtual bool paintsIntoCanvasBuffer() const;
CanvasStyle* strokeStyle() const;
void setStrokeStyle(PassRefPtr<CanvasStyle>);
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (108596 => 108597)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2012-02-23 03:05:55 UTC (rev 108596)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2012-02-23 03:07:09 UTC (rev 108597)
@@ -719,11 +719,6 @@
return imageData;
}
-bool WebGLRenderingContext::paintsIntoCanvasBuffer() const
-{
- return m_context->paintsIntoCanvasBuffer();
-}
-
void WebGLRenderingContext::reshape(int width, int height)
{
// This is an approximation because at WebGLRenderingContext level we don't
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h (108596 => 108597)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h 2012-02-23 03:05:55 UTC (rev 108596)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h 2012-02-23 03:07:09 UTC (rev 108597)
@@ -77,7 +77,6 @@
virtual bool is3d() const { return true; }
virtual bool isAccelerated() const { return true; }
- virtual bool paintsIntoCanvasBuffer() const;
int drawingBufferWidth() const;
int drawingBufferHeight() const;
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (108596 => 108597)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2012-02-23 03:05:55 UTC (rev 108596)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2012-02-23 03:07:09 UTC (rev 108597)
@@ -814,18 +814,6 @@
PassRefPtr<ImageData> paintRenderingResultsToImageData(DrawingBuffer*);
bool paintCompositedResultsToCanvas(CanvasRenderingContext*);
-#if PLATFORM(QT)
- bool paintsIntoCanvasBuffer() const { return true; }
-#elif PLATFORM(CHROMIUM)
- bool paintsIntoCanvasBuffer() const;
-#elif PLATFORM(GTK)
- bool paintsIntoCanvasBuffer() const { return true; }
-#elif PLATFORM(EFL)
- bool paintsIntoCanvasBuffer() const { return true; }
-#else
- bool paintsIntoCanvasBuffer() const { return false; }
-#endif
-
// Support for buffer creation and deletion
Platform3DObject createBuffer();
Platform3DObject createFramebuffer();
Modified: trunk/Source/WebKit/chromium/ChangeLog (108596 => 108597)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-02-23 03:05:55 UTC (rev 108596)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-02-23 03:07:09 UTC (rev 108597)
@@ -1,3 +1,16 @@
+2012-02-22 James Robinson <[email protected]>
+
+ Remove GraphicsContext3D::paintsIntoCanvasBuffer and unify WebGL and canvas 2d logic
+ https://bugs.webkit.org/show_bug.cgi?id=79317
+
+ Reviewed by Kenneth Russell.
+
+ Remove paintsIntoCanvasBuffer() implementations.
+
+ * src/GraphicsContext3DChromium.cpp:
+ (WebCore):
+ * src/GraphicsContext3DPrivate.h:
+
2012-02-22 Yuta Kitamura <[email protected]>
Unreviewed, rolling out r108590.
Modified: trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp (108596 => 108597)
--- trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp 2012-02-23 03:05:55 UTC (rev 108596)
+++ trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp 2012-02-23 03:07:09 UTC (rev 108597)
@@ -345,13 +345,6 @@
return imageData.release();
}
-bool GraphicsContext3DPrivate::paintsIntoCanvasBuffer() const
-{
- // If the gpu compositor is on then skip the readback and software rendering path.
- ASSERT(m_webViewImpl);
- return !m_webViewImpl->isAcceleratedCompositingActive();
-}
-
void GraphicsContext3DPrivate::reshape(int width, int height)
{
if (width == m_impl->width() && height == m_impl->height())
@@ -1248,11 +1241,6 @@
DELEGATE_TO_INTERNAL_1R(paintCompositedResultsToCanvas, CanvasRenderingContext*, bool)
-bool GraphicsContext3D::paintsIntoCanvasBuffer() const
-{
- return m_private->paintsIntoCanvasBuffer();
-}
-
DELEGATE_TO_INTERNAL_R(createBuffer, Platform3DObject)
DELEGATE_TO_INTERNAL_R(createFramebuffer, Platform3DObject)
DELEGATE_TO_INTERNAL_R(createProgram, Platform3DObject)
Modified: trunk/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h (108596 => 108597)
--- trunk/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h 2012-02-23 03:05:55 UTC (rev 108596)
+++ trunk/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h 2012-02-23 03:07:09 UTC (rev 108597)
@@ -98,7 +98,6 @@
void paintRenderingResultsToCanvas(CanvasRenderingContext*, DrawingBuffer*);
void paintFramebufferToCanvas(int framebuffer, int width, int height, bool premultiplyAlpha, ImageBuffer*);
PassRefPtr<ImageData> paintRenderingResultsToImageData(DrawingBuffer*);
- bool paintsIntoCanvasBuffer() const;
bool paintCompositedResultsToCanvas(CanvasRenderingContext*);
void prepareTexture();