summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp')
-rw-r--r--src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp b/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp
index 9b2f70c352..7bae6e3fa3 100644
--- a/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp
+++ b/src/3rdparty/webkit/WebCore/html/HTMLCanvasElement.cpp
@@ -138,7 +138,7 @@ String HTMLCanvasElement::toDataURL(const String& mimeType, ExceptionCode& ec)
return String();
}
- if (m_size.isEmpty())
+ if (m_size.isEmpty() || !buffer())
return String("data:,");
if (mimeType.isNull() || !MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType))
@@ -166,16 +166,17 @@ CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type)
}
#if ENABLE(3D_CANVAS)
Settings* settings = document()->settings();
- if (settings && settings->experimentalWebGLEnabled()) {
+ if (settings && settings->webGLEnabled()) {
if ((type == "webkit-3d") ||
(type == "GL")) {
if (m_context && !m_context->is3d())
return 0;
if (!m_context) {
- m_context = new CanvasRenderingContext3D(this);
-
- // Need to make sure a RenderLayer and compositing layer get created for the Canvas
- setNeedsStyleRecalc(SyntheticStyleChange);
+ m_context = CanvasRenderingContext3D::create(this);
+ if (m_context) {
+ // Need to make sure a RenderLayer and compositing layer get created for the Canvas
+ setNeedsStyleRecalc(SyntheticStyleChange);
+ }
}
return m_context.get();
}