Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Unified Diff: Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp

Issue 24233004: Support currentTransform in 2D Canvas. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
diff --git a/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
index 9a6325f288a96b537bd6e7d04005c4904c064fe1..282361e5942453c5b51d1f6250e88adb55dc657c 100644
--- a/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
+++ b/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
@@ -37,6 +37,7 @@
#include "V8HTMLImageElement.h"
#include "V8HTMLVideoElement.h"
#include "V8ImageData.h"
+#include "bindings/V8SVGMatrix.h"
#include "bindings/v8/V8Binding.h"
#include "core/html/canvas/CanvasGradient.h"
#include "core/html/canvas/CanvasPattern.h"
@@ -68,6 +69,23 @@ static PassRefPtr<CanvasStyle> toCanvasStyle(v8::Handle<v8::Value> value, v8::Is
return 0;
}
+void V8CanvasRenderingContext2D::currentTransformAttributeGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
+{
+ CanvasRenderingContext2D* imp = V8CanvasRenderingContext2D::toNative(info.Holder());
+ v8SetReturnValue(info, toV8(SVGPropertyTearOff<SVGMatrix>::create(imp->currentTransform()), info.Holder(), info.GetIsolate()));
+}
+
+void V8CanvasRenderingContext2D::currentTransformAttributeSetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
+{
+ CanvasRenderingContext2D* imp = V8CanvasRenderingContext2D::toNative(info.Holder());
+ V8TRYCATCH_VOID(RefPtr<SVGPropertyTearOff<SVGMatrix> >, v, V8SVGMatrix::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8SVGMatrix::toNative(v8::Handle<v8::Object>::Cast(value)) : 0);
+ if (!v) {
+ throwTypeError(info.GetIsolate());
+ return;
+ }
+ imp->setCurrentTransform(WTF::getPtr(v)->propertyReference());
+}
+
void V8CanvasRenderingContext2D::strokeStyleAttributeGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
{
CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder());

Powered by Google App Engine
This is Rietveld 408576698