Changeset 219619 in webkit
- Timestamp:
- Jul 18, 2017 11:54:32 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r219612 r219619 1 2017-07-18 Devin Rousso <drousso@apple.com> 2 3 Add CanvasRenderingContext2D::getTransform 4 https://bugs.webkit.org/show_bug.cgi?id=174278 5 6 Reviewed by Dean Jackson. 7 8 * canvas/philip/tests/2d.missingargs.html: 9 CanvasRenderingContext2D.prototype.setTransform no longer throws an error with no arguments. 10 11 * fast/canvas/2d.getTransform.modification-expected.txt: Added. 12 * fast/canvas/2d.getTransform.modification.html: Added. 13 * fast/canvas/2d.getTransform.newobject-expected.txt: Added. 14 * fast/canvas/2d.getTransform.newobject.html: Added. 15 * fast/canvas/2d.setTransform.matrix-expected.txt: Added. 16 * fast/canvas/2d.setTransform.matrix.html: Added. 17 1 18 2017-07-18 Matt Lewis <jlewis3@apple.com> 2 19 -
trunk/LayoutTests/canvas/philip/tests/2d.missingargs.html
r203333 r219619 50 50 if (ctx.setTransform) { 51 51 try { var _thrown = false; 52 ctx.setTransform();53 } catch (e) { if (!(e instanceof TypeError)) _fail("Failed assertion: expected exception of type TypeError, got: "+e); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TypeError: ctx.setTransform()"); }54 try { var _thrown = false;55 52 ctx.setTransform(1); 56 53 } catch (e) { if (!(e instanceof TypeError)) _fail("Failed assertion: expected exception of type TypeError, got: "+e); _thrown = true; } finally { _assert(_thrown, "should throw exception of type TypeError: ctx.setTransform(1)"); } -
trunk/Source/WebCore/ChangeLog
r219618 r219619 1 2017-07-18 Devin Rousso <drousso@apple.com> 2 3 Add CanvasRenderingContext2D::getTransform 4 https://bugs.webkit.org/show_bug.cgi?id=174278 5 6 Reviewed by Dean Jackson. 7 8 Tests: fast/canvas/2d.getTransform.modification.html 9 fast/canvas/2d.getTransform.newobject.html 10 fast/canvas/2d.setTransform.matrix.html 11 12 * css/DOMMatrixReadOnly.h: 13 Make DOMMatrixReadOnly::validateAndFixup public so that values of DOMMatrixInit are still 14 usable without having to construct a DOMMatrixReadOnly. This is beneficial in the case that 15 an exception is thrown, as the validateAndFixup check can happen without any allocations. 16 17 * html/canvas/CanvasRenderingContext2D.idl: 18 * html/canvas/CanvasRenderingContext2D.h: 19 * html/canvas/CanvasRenderingContext2D.cpp: 20 (WebCore::CanvasRenderingContext2D::getTransform): 21 (WebCore::CanvasRenderingContext2D::setTransform): 22 1 23 2017-07-18 Andy Estes <aestes@apple.com> 2 24 -
trunk/Source/WebCore/css/DOMMatrixReadOnly.h
r218644 r219619 76 76 static ExceptionOr<Ref<DOMMatrixReadOnly>> fromFloat64Array(Ref<Float64Array>&&); 77 77 78 static ExceptionOr<void> validateAndFixup(DOMMatrixInit&); 79 78 80 double a() const { return m_matrix.a(); } 79 81 double b() const { return m_matrix.b(); } … … 138 140 static ExceptionOr<Ref<T>> fromMatrixHelper(DOMMatrixInit&&); 139 141 140 static ExceptionOr<void> validateAndFixup(DOMMatrixInit&);141 142 142 TransformationMatrix m_matrix; 143 143 bool m_is2D { true }; -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r216902 r219619 41 41 #include "CanvasGradient.h" 42 42 #include "CanvasPattern.h" 43 #include "DOMMatrix.h" 44 #include "DOMMatrixInit.h" 43 45 #include "DOMPath.h" 44 46 #include "DisplayListRecorder.h" … … 796 798 } 797 799 800 Ref<DOMMatrix> CanvasRenderingContext2D::getTransform() const 801 { 802 return DOMMatrix::create(state().transform.toTransformationMatrix(), DOMMatrixReadOnly::Is2D::Yes); 803 } 804 798 805 void CanvasRenderingContext2D::setTransform(float m11, float m12, float m21, float m22, float dx, float dy) 799 806 { … … 807 814 resetTransform(); 808 815 transform(m11, m12, m21, m22, dx, dy); 816 } 817 818 ExceptionOr<void> CanvasRenderingContext2D::setTransform(DOMMatrixInit&& matrixInit) 819 { 820 auto checkValid = DOMMatrixReadOnly::validateAndFixup(matrixInit); 821 if (checkValid.hasException()) 822 return checkValid.releaseException(); 823 824 setTransform(matrixInit.a.value_or(1), matrixInit.b.value_or(0), matrixInit.c.value_or(0), matrixInit.d.value_or(1), matrixInit.e.value_or(0), matrixInit.f.value_or(0)); 825 826 return { }; 809 827 } 810 828 -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.h
r218748 r219619 46 46 class CanvasGradient; 47 47 class CanvasPattern; 48 class DOMMatrix; 48 49 class DOMPath; 49 50 class FloatRect; … … 55 56 class TextMetrics; 56 57 58 struct DOMMatrixInit; 59 57 60 #if ENABLE(VIDEO) 58 61 using CanvasImageSource = Variant<RefPtr<HTMLImageElement>, RefPtr<HTMLVideoElement>, RefPtr<HTMLCanvasElement>>; … … 114 117 void translate(float tx, float ty); 115 118 void transform(float m11, float m12, float m21, float m22, float dx, float dy); 119 120 Ref<DOMMatrix> getTransform() const; 116 121 void setTransform(float m11, float m12, float m21, float m22, float dx, float dy); 122 ExceptionOr<void> setTransform(DOMMatrixInit&&); 117 123 void resetTransform(); 118 124 -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl
r210470 r219619 53 53 void transform(unrestricted float m11, unrestricted float m12, unrestricted float m21, unrestricted float m22, 54 54 unrestricted float dx, unrestricted float dy); 55 56 [NewObject] DOMMatrix getTransform(); 55 57 void setTransform(unrestricted float m11, unrestricted float m12, unrestricted float m21, unrestricted float m22, 56 58 unrestricted float dx, unrestricted float dy); 59 [MayThrowException] void setTransform(optional DOMMatrixInit transform); 57 60 void resetTransform(); 58 61
Note: See TracChangeset
for help on using the changeset viewer.