Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
- index 282361e..4c48d76 100644
- --- a/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
- +++ b/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
- @@ -69,23 +69,6 @@ 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());
- diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
- index f30dee3..9489604 100644
- --- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
- +++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
- @@ -596,9 +596,20 @@ void CanvasRenderingContext2D::setGlobalCompositeOperation(const String& operati
- c->setCompositeOperation(op, blendMode);
- }
- -void CanvasRenderingContext2D::setCurrentTransform(const SVGMatrix& currentTransform)
- +void CanvasRenderingContext2D::setCurrentTransform(SVGPropertyTearOff<SVGMatrix>* currentTransform, ExceptionState& es)
- {
- - setTransform(currentTransform.a(), currentTransform.b(), currentTransform.c(), currentTransform.d(), currentTransform.e(), currentTransform.f());
- + if (!currentTransform) {
- + es.throwDOMException(TypeError);
- + return;
- + }
- + const SVGMatrix& matrix = currentTransform->propertyReference();
- + setTransform(matrix.a(), matrix.b(), matrix.c(), matrix.d(), matrix.e(), matrix.f());
- +}
- +
- +void CanvasRenderingContext2D::updateCurrentTransform()
- +{
- + // FIXME: Do something?
- + //setTransform(m_matrix.a(), m_matrix.b(), m_matrix.c(), m_matrix.d(), m_matrix.e(), m_matrix.f());
- }
- void CanvasRenderingContext2D::scale(float sx, float sy)
- diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.h b/Source/core/html/canvas/CanvasRenderingContext2D.h
- index d3447ae..a2a8ed0 100644
- --- a/Source/core/html/canvas/CanvasRenderingContext2D.h
- +++ b/Source/core/html/canvas/CanvasRenderingContext2D.h
- @@ -37,6 +37,7 @@
- #include "core/platform/graphics/Path.h"
- #include "core/platform/graphics/transforms/AffineTransform.h"
- #include "core/svg/SVGMatrix.h"
- +#include "core/svg/properties/SVGPropertyTearOff.h"
- #include "wtf/HashMap.h"
- #include "wtf/Vector.h"
- #include "wtf/text/WTFString.h"
- @@ -118,11 +119,14 @@ public:
- void save() { ++m_unrealizedSaveCount; }
- void restore();
- - SVGMatrix currentTransform() const
- + SVGMatrix& currentTransform()
- {
- - return SVGMatrix(state().m_transform);
- + m_matrix = state().m_transform;
- + return static_cast<SVGMatrix&>(m_matrix);
- }
- - void setCurrentTransform(const SVGMatrix&);
- + void setCurrentTransform(SVGPropertyTearOff<SVGMatrix>*, ExceptionState&);
- + void updateCurrentTransform();
- +
- void scale(float sx, float sy);
- void rotate(float angleInRadians);
- void translate(float tx, float ty);
- @@ -336,6 +340,7 @@ private:
- bool m_usesCSSCompatibilityParseMode;
- bool m_hasAlpha;
- MutableStylePropertyMap m_fetchedFonts;
- + AffineTransform m_matrix;
- };
- } // namespace WebCore
- diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.idl b/Source/core/html/canvas/CanvasRenderingContext2D.idl
- index 1dd3c6e..caa1257 100644
- --- a/Source/core/html/canvas/CanvasRenderingContext2D.idl
- +++ b/Source/core/html/canvas/CanvasRenderingContext2D.idl
- @@ -30,7 +30,7 @@ interface CanvasRenderingContext2D : CanvasRenderingContext {
- void save();
- void restore();
- - [EnabledAtRuntime=ExperimentalCanvasFeatures, Custom] attribute SVGMatrix currentTransform;
- + [EnabledAtRuntime=ExperimentalCanvasFeatures, SetterRaisesException] attribute SVGMatrix currentTransform;
- void scale(float sx, float sy);
- void rotate(float angle);
- void translate(float tx, float ty);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement