diff --git a/content/canvas/public/nsICanvasRenderingContextInternal.h b/content/canvas/public/nsICanvasRenderingContextInternal.h index 3f496534b65..a1a1fc28e72 100644 --- a/content/canvas/public/nsICanvasRenderingContextInternal.h +++ b/content/canvas/public/nsICanvasRenderingContextInternal.h @@ -97,6 +97,7 @@ public: // dst alpha is always 1.0. If this is never called, the context // defaults to false (not opaque). NS_IMETHOD SetIsOpaque(bool isOpaque) = 0; + virtual bool GetIsOpaque() = 0; // Invalidate this context and release any held resources, in preperation // for possibly reinitializing with SetDimensions/InitializeWithSurface. diff --git a/content/canvas/src/CanvasRenderingContext2D.cpp b/content/canvas/src/CanvasRenderingContext2D.cpp index ee62d8db550..2631b6b01f2 100755 --- a/content/canvas/src/CanvasRenderingContext2D.cpp +++ b/content/canvas/src/CanvasRenderingContext2D.cpp @@ -988,6 +988,10 @@ CanvasRenderingContext2D::SetIsOpaque(bool isOpaque) ClearTarget(); } + if (mOpaque) { + EnsureTarget(); + } + return NS_OK; } @@ -1062,6 +1066,10 @@ CanvasRenderingContext2D::SetContextOptions(JSContext* aCx, JS::HandleSnapshot(); } NS_IMETHOD SetIsOpaque(bool isOpaque) MOZ_OVERRIDE; + bool GetIsOpaque() MOZ_OVERRIDE { return mOpaque; } NS_IMETHOD Reset() MOZ_OVERRIDE; already_AddRefed GetCanvasLayer(nsDisplayListBuilder* aBuilder, CanvasLayer *aOldLayer, diff --git a/content/canvas/src/WebGLContext.h b/content/canvas/src/WebGLContext.h index 8933bfe01d0..2c56966b44d 100644 --- a/content/canvas/src/WebGLContext.h +++ b/content/canvas/src/WebGLContext.h @@ -178,6 +178,7 @@ public: mozilla::TemporaryRef GetSurfaceSnapshot() MOZ_OVERRIDE; NS_IMETHOD SetIsOpaque(bool b) MOZ_OVERRIDE { return NS_OK; }; + bool GetIsOpaque() MOZ_OVERRIDE { return false; } NS_IMETHOD SetContextOptions(JSContext* aCx, JS::Handle aOptions) MOZ_OVERRIDE; diff --git a/content/canvas/test/test_canvas.html b/content/canvas/test/test_canvas.html index c73a4ac2003..7142bfaf796 100644 --- a/content/canvas/test/test_canvas.html +++ b/content/canvas/test/test_canvas.html @@ -21577,6 +21577,24 @@ function test_linedash() { } +

Canvas test: test_opaque

+ + +