Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp |
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
index b5476f00e5af475c8425e7e033fdca5f6a88b8b1..18662e7fb791d45cb8871366ecec9f292e6cfae6 100644 |
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
@@ -36,6 +36,7 @@ |
#include "CSSFontSelector.h" |
#include "CSSParser.h" |
#include "CSSPropertyNames.h" |
+#include "Canvas2DContextAttributes.h" |
#include "CanvasGradient.h" |
#include "CanvasPattern.h" |
#include "CanvasStyle.h" |
@@ -117,11 +118,12 @@ private: |
CanvasRenderingContext2D* m_canvasContext; |
}; |
-CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, bool usesCSSCompatibilityParseMode) |
+CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, const Canvas2DContextAttributes* attrs, bool usesCSSCompatibilityParseMode) |
: CanvasRenderingContext(canvas) |
, m_stateStack(1) |
, m_unrealizedSaveCount(0) |
, m_usesCSSCompatibilityParseMode(usesCSSCompatibilityParseMode) |
+ , m_hasAlpha(!attrs || attrs->alpha()) |
{ |
ScriptWrappable::init(this); |
} |
@@ -2250,4 +2252,13 @@ void CanvasRenderingContext2D::setWebkitImageSmoothingEnabled(bool enabled) |
c->setImageInterpolationQuality(enabled ? DefaultInterpolationQuality : InterpolationNone); |
} |
+PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttributes() const |
+{ |
+ // We always need to return a new Canvas2DContextAttributes object to |
+ // prevent the user from mutating any cached version. |
jamesr
2013/04/26 18:30:09
i don't follow - what is the 'user' here? javascri
Stephen White
2013/04/26 18:53:18
This comment was lifted from WebGLRenderingContext
|
+ RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::create(); |
+ attributes->setAlpha(m_hasAlpha); |
+ return attributes.release(); |
+} |
+ |
} // namespace WebCore |