Advertisement
Guest User

Untitled

a guest
Sep 20th, 2013
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.04 KB | None | 0 0
  1. diff --git a/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp b/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
  2. index 282361e..4c48d76 100644
  3. --- a/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
  4. +++ b/Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp
  5. @@ -69,23 +69,6 @@ static PassRefPtr<CanvasStyle> toCanvasStyle(v8::Handle<v8::Value> value, v8::Is
  6. return 0;
  7. }
  8.  
  9. -void V8CanvasRenderingContext2D::currentTransformAttributeGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
  10. -{
  11. - CanvasRenderingContext2D* imp = V8CanvasRenderingContext2D::toNative(info.Holder());
  12. - v8SetReturnValue(info, toV8(SVGPropertyTearOff<SVGMatrix>::create(imp->currentTransform()), info.Holder(), info.GetIsolate()));
  13. -}
  14. -
  15. -void V8CanvasRenderingContext2D::currentTransformAttributeSetterCustom(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
  16. -{
  17. - CanvasRenderingContext2D* imp = V8CanvasRenderingContext2D::toNative(info.Holder());
  18. - V8TRYCATCH_VOID(RefPtr<SVGPropertyTearOff<SVGMatrix> >, v, V8SVGMatrix::HasInstance(value, info.GetIsolate(), worldType(info.GetIsolate())) ? V8SVGMatrix::toNative(v8::Handle<v8::Object>::Cast(value)) : 0);
  19. - if (!v) {
  20. - throwTypeError(info.GetIsolate());
  21. - return;
  22. - }
  23. - imp->setCurrentTransform(WTF::getPtr(v)->propertyReference());
  24. -}
  25. -
  26. void V8CanvasRenderingContext2D::strokeStyleAttributeGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
  27. {
  28. CanvasRenderingContext2D* impl = V8CanvasRenderingContext2D::toNative(info.Holder());
  29. diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
  30. index f30dee3..9489604 100644
  31. --- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
  32. +++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
  33. @@ -596,9 +596,20 @@ void CanvasRenderingContext2D::setGlobalCompositeOperation(const String& operati
  34. c->setCompositeOperation(op, blendMode);
  35. }
  36.  
  37. -void CanvasRenderingContext2D::setCurrentTransform(const SVGMatrix& currentTransform)
  38. +void CanvasRenderingContext2D::setCurrentTransform(SVGPropertyTearOff<SVGMatrix>* currentTransform, ExceptionState& es)
  39. {
  40. - setTransform(currentTransform.a(), currentTransform.b(), currentTransform.c(), currentTransform.d(), currentTransform.e(), currentTransform.f());
  41. + if (!currentTransform) {
  42. + es.throwDOMException(TypeError);
  43. + return;
  44. + }
  45. + const SVGMatrix& matrix = currentTransform->propertyReference();
  46. + setTransform(matrix.a(), matrix.b(), matrix.c(), matrix.d(), matrix.e(), matrix.f());
  47. +}
  48. +
  49. +void CanvasRenderingContext2D::updateCurrentTransform()
  50. +{
  51. + // FIXME: Do something?
  52. + //setTransform(m_matrix.a(), m_matrix.b(), m_matrix.c(), m_matrix.d(), m_matrix.e(), m_matrix.f());
  53. }
  54.  
  55. void CanvasRenderingContext2D::scale(float sx, float sy)
  56. diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.h b/Source/core/html/canvas/CanvasRenderingContext2D.h
  57. index d3447ae..a2a8ed0 100644
  58. --- a/Source/core/html/canvas/CanvasRenderingContext2D.h
  59. +++ b/Source/core/html/canvas/CanvasRenderingContext2D.h
  60. @@ -37,6 +37,7 @@
  61. #include "core/platform/graphics/Path.h"
  62. #include "core/platform/graphics/transforms/AffineTransform.h"
  63. #include "core/svg/SVGMatrix.h"
  64. +#include "core/svg/properties/SVGPropertyTearOff.h"
  65. #include "wtf/HashMap.h"
  66. #include "wtf/Vector.h"
  67. #include "wtf/text/WTFString.h"
  68. @@ -118,11 +119,14 @@ public:
  69. void save() { ++m_unrealizedSaveCount; }
  70. void restore();
  71.  
  72. - SVGMatrix currentTransform() const
  73. + SVGMatrix& currentTransform()
  74. {
  75. - return SVGMatrix(state().m_transform);
  76. + m_matrix = state().m_transform;
  77. + return static_cast<SVGMatrix&>(m_matrix);
  78. }
  79. - void setCurrentTransform(const SVGMatrix&);
  80. + void setCurrentTransform(SVGPropertyTearOff<SVGMatrix>*, ExceptionState&);
  81. + void updateCurrentTransform();
  82. +
  83. void scale(float sx, float sy);
  84. void rotate(float angleInRadians);
  85. void translate(float tx, float ty);
  86. @@ -336,6 +340,7 @@ private:
  87. bool m_usesCSSCompatibilityParseMode;
  88. bool m_hasAlpha;
  89. MutableStylePropertyMap m_fetchedFonts;
  90. + AffineTransform m_matrix;
  91. };
  92.  
  93. } // namespace WebCore
  94. diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.idl b/Source/core/html/canvas/CanvasRenderingContext2D.idl
  95. index 1dd3c6e..caa1257 100644
  96. --- a/Source/core/html/canvas/CanvasRenderingContext2D.idl
  97. +++ b/Source/core/html/canvas/CanvasRenderingContext2D.idl
  98. @@ -30,7 +30,7 @@ interface CanvasRenderingContext2D : CanvasRenderingContext {
  99. void save();
  100. void restore();
  101.  
  102. - [EnabledAtRuntime=ExperimentalCanvasFeatures, Custom] attribute SVGMatrix currentTransform;
  103. + [EnabledAtRuntime=ExperimentalCanvasFeatures, SetterRaisesException] attribute SVGMatrix currentTransform;
  104. void scale(float sx, float sy);
  105. void rotate(float angle);
  106. void translate(float tx, float ty);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement