WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
patch v.2
0001-Support-currentTransform-and-other-SVGMatrix-interac.patch (text/plain), 8.24 KB, created by
Dongseong Hwang
on 2012-06-29 08:05:17 PDT
(
hide
)
Description:
patch v.2
Filename:
MIME Type:
Creator:
Dongseong Hwang
Created:
2012-06-29 08:05:17 PDT
Size:
8.24 KB
patch
obsolete
>From 53e71fe7c582ca2e983835326b559c878512295b Mon Sep 17 00:00:00 2001 >From: Huang Dongsung <luxtella@company100.net> >Date: Sat, 30 Jun 2012 00:02:49 +0900 >Subject: [PATCH] Support currentTransform and other SVGMatrix interactions > https://bugs.webkit.org/show_bug.cgi?id=82797 > >canvas v5 has a currentTransform that is an SVGMatrix, as well as the ability to >reset it, and perform some matrix functions. > >Reviewed by NOBODY (OOPS!). > >Add a test: fast/canvas/canvas-currentTransform.html >--- > Source/WebCore/ChangeLog | 28 ++++++++++++++++++++ > .../js/JSCanvasRenderingContext2DCustom.cpp | 19 +++++++++++++ > .../v8/custom/V8CanvasRenderingContext2DCustom.cpp | 20 ++++++++++++++ > .../html/canvas/CanvasRenderingContext2D.cpp | 12 +++++++++ > .../WebCore/html/canvas/CanvasRenderingContext2D.h | 5 ++++ > .../html/canvas/CanvasRenderingContext2D.idl | 4 +++ > 6 files changed, 88 insertions(+) > >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0a6a52c..7921b8b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,31 @@ >+2012-06-29 Huang Dongsung <luxtella@company100.net> >+ >+ Support currentTransform and other SVGMatrix interactions >+ https://bugs.webkit.org/show_bug.cgi?id=82797 >+ >+ canvas v5 has a currentTransform that is an SVGMatrix, as well as the ability to >+ reset it, and perform some matrix functions. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a test: fast/canvas/canvas-currentTransform.html >+ >+ * bindings/js/JSCanvasRenderingContext2DCustom.cpp: >+ (WebCore::JSCanvasRenderingContext2D::currentTransform): >+ (WebCore): >+ (WebCore::JSCanvasRenderingContext2D::setCurrentTransform): >+ * bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp: >+ (WebCore::V8CanvasRenderingContext2D::currentTransformAccessorGetter): >+ (WebCore): >+ (WebCore::V8CanvasRenderingContext2D::currentTransformAccessorSetter): >+ * html/canvas/CanvasRenderingContext2D.cpp: >+ (WebCore): >+ (WebCore::CanvasRenderingContext2D::currentTransform): >+ (WebCore::CanvasRenderingContext2D::setCurrentTransform): >+ * html/canvas/CanvasRenderingContext2D.h: >+ (CanvasRenderingContext2D): >+ * html/canvas/CanvasRenderingContext2D.idl: >+ > 2012-06-29 Mihnea Ovidenie <mihnea@adobe.com> > > Crash when flowing a fixed positioned element into a region. >diff --git a/Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp b/Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp >index 0c674cb..0ae4e0d 100644 >--- a/Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp >+++ b/Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp >@@ -33,6 +33,8 @@ > #include "JSHTMLCanvasElement.h" > #include "JSHTMLImageElement.h" > #include "JSImageData.h" >+#include "JSSVGMatrix.h" >+#include "SVGPropertyTearOff.h" > > using namespace JSC; > >@@ -59,6 +61,23 @@ static PassRefPtr<CanvasStyle> toHTMLCanvasStyle(ExecState*, JSValue value) > return 0; > } > >+JSValue JSCanvasRenderingContext2D::currentTransform(ExecState* exec) const >+{ >+ CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl()); >+ return toJS(exec, globalObject(), WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(context->currentTransform()))); >+} >+ >+void JSCanvasRenderingContext2D::setCurrentTransform(ExecState* exec, JSValue value) >+{ >+ CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl()); >+ SVGPropertyTearOff<SVGMatrix>* currentTransform(toSVGMatrix(value)); >+ if (!currentTransform) { >+ setDOMException(exec, TYPE_MISMATCH_ERR); >+ return; >+ } >+ context->setCurrentTransform(currentTransform->propertyReference()); >+} >+ > JSValue JSCanvasRenderingContext2D::strokeStyle(ExecState* exec) const > { > CanvasRenderingContext2D* context = static_cast<CanvasRenderingContext2D*>(impl()); >diff --git a/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp >index a27fd01..99ac69b 100644 >--- a/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp >+++ b/Source/WebCore/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp >@@ -37,6 +37,7 @@ > #include "CanvasStyle.h" > #include "ExceptionCode.h" > #include "FloatRect.h" >+#include "SVGPropertyTearOff.h" > > #include "V8Binding.h" > #include "V8CanvasGradient.h" >@@ -46,6 +47,7 @@ > #include "V8HTMLVideoElement.h" > #include "V8ImageData.h" > #include "V8Proxy.h" >+#include "V8SVGMatrix.h" > > namespace WebCore { > >@@ -71,6 +73,24 @@ static PassRefPtr<CanvasStyle> toCanvasStyle(v8::Handle<v8::Value> value) > return 0; > } > >+v8::Handle<v8::Value> V8CanvasRenderingContext2D::currentTransformAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) >+{ >+ CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder()); >+ return toV8(WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(impl->currentTransform())), info.GetIsolate()); >+} >+ >+void V8CanvasRenderingContext2D::currentTransformAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) >+{ >+ CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder()); >+ RefPtr<SVGPropertyTearOff<SVGMatrix> > currentTransform = V8SVGMatrix::HasInstance(value) ? V8SVGMatrix::toNative(v8::Handle<v8::Object>::Cast(value)) : 0; >+ >+ if (!currentTransform) { >+ V8Proxy::setDOMException(WebCore::TYPE_MISMATCH_ERR, info.GetIsolate()); >+ return; >+ } >+ impl->setCurrentTransform(currentTransform->propertyReference()); >+} >+ > v8::Handle<v8::Value> V8CanvasRenderingContext2D::strokeStyleAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) > { > CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder()); >diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >index c65af24..dd9f1db 100644 >--- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >+++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp >@@ -579,6 +579,18 @@ void CanvasRenderingContext2D::setGlobalCompositeOperation(const String& operati > c->setCompositeOperation(op); > } > >+#if ENABLE(SVG) >+SVGMatrix CanvasRenderingContext2D::currentTransform() const >+{ >+ return SVGMatrix(state().m_transform); >+} >+ >+void CanvasRenderingContext2D::setCurrentTransform(const SVGMatrix& currentTransform) >+{ >+ setTransform(currentTransform.a(), currentTransform.b(), currentTransform.c(), currentTransform.d(), currentTransform.e(), currentTransform.f()); >+} >+#endif >+ > void CanvasRenderingContext2D::scale(float sx, float sy) > { > GraphicsContext* c = drawingContext(); >diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.h b/Source/WebCore/html/canvas/CanvasRenderingContext2D.h >index bfa9a88..e36f0b7 100644 >--- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.h >+++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.h >@@ -37,6 +37,7 @@ > #include "ImageBuffer.h" > #include "Path.h" > #include "PlatformString.h" >+#include "SVGMatrix.h" > #include <wtf/Vector.h> > > #if USE(ACCELERATED_COMPOSITING) >@@ -111,6 +112,10 @@ public: > void save() { ++m_unrealizedSaveCount; } > void restore(); > >+#if ENABLE(SVG) >+ SVGMatrix currentTransform() const; >+ void setCurrentTransform(const SVGMatrix&); >+#endif > void scale(float sx, float sy); > void rotate(float angleInRadians); > void translate(float tx, float ty); >diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl b/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl >index d41f875..df241f5 100644 >--- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl >+++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl >@@ -30,6 +30,10 @@ module html { > void save(); > void restore(); > >+#if defined(ENABLE_SVG) && ENABLE_SVG >+ // transformations (default transform is the identity matrix) >+ attribute [Custom] SVGMatrix currentTransform; >+#endif > void scale(in [Optional=DefaultIsUndefined] float sx, > in [Optional=DefaultIsUndefined] float sy); > void rotate(in [Optional=DefaultIsUndefined] float angle); >-- >1.7.9.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 82797
:
150150
|
150152
|
150166
|
150179
|
150190
|
150219
|
150342