Changeset 40807 in webkit


Ignore:
Timestamp:
Feb 9, 2009 9:22:08 PM (15 years ago)
Author:
Simon Fraser
Message:

2009-02-09 Chris Marrin <cmarrin@apple.com>

Reviewed by Simon Fraser

https://bugs.webkit.org/show_bug.cgi?id=23689

Added 3D functions to WebKitCSSMatrix. This depends on the 3D functions
added to TransformationMatrix in https://bugs.webkit.org/show_bug.cgi?id=6868

Test: transforms/3d/cssmatrix-3d-interface.xhtml

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r40804 r40807  
     12009-02-09  Chris Marrin  <cmarrin@apple.com>
     2
     3        Reviewed by Simon Fraser
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=23689
     6
     7        Add test for 3D functionality of WebKitCSSMatrix.
     8
     9        * transforms/3d: Added.
     10        * transforms/3d/cssmatrix-3d-interface-expected.txt: Added.
     11        * transforms/3d/cssmatrix-3d-interface.xhtml: Added.
     12
    1132009-02-09  Mark Rowe  <mrowe@apple.com>
    214
  • trunk/LayoutTests/transforms/2d/cssmatrix-interface-expected.txt

    r39974 r40807  
    88PASS object constructor
    99PASS string constructor
     10
     11Test toString
     12PASS a[0] is "matrix"
     13PASS parseFloat(a2[0]) is 1
     14PASS parseFloat(a2[1]) is 0
     15PASS parseFloat(a2[2]) is 0
     16PASS parseFloat(a2[3]) is 1
     17PASS parseFloat(a2[4]) is 0
     18PASS parseFloat(a3[0]) is 0
     19PASS a3[1] is ""
    1020
    1121Test bad input to string constructor
     
    5767PASS parseFloat(m3.f) is 112
    5868
     69Test multiply with missing argument
     70PASS m2 is null
     71
     72Test immutability of multiply
     73PASS parseFloat(m.a) is 1
     74PASS parseFloat(m.b) is 2
     75PASS parseFloat(m.c) is 3
     76PASS parseFloat(m.d) is 4
     77PASS parseFloat(m.e) is 5
     78PASS parseFloat(m.f) is 6
     79
    5980Test inverse
    6081PASS parseFloat(m2.a) is 0.5
     
    6586PASS parseFloat(m2.f) is -10
    6687
     88Test immutability of inverse
     89PASS parseFloat(m.a) is 2
     90PASS parseFloat(m.b) is 0
     91PASS parseFloat(m.c) is 0
     92PASS parseFloat(m.d) is 2
     93PASS parseFloat(m.e) is 10
     94PASS parseFloat(m.f) is 20
     95
    6796Test throwing exception from inverse
    6897PASS m.inverse() threw exception Error: NOT_SUPPORTED_ERR: DOM Exception 9.
    6998
    7099Test translate
    71 PASS m.a is 1
    72 PASS m.b is 0
    73 PASS m.c is 0
    74 PASS m.d is 1
    75 PASS m.e is 10
    76 PASS m.f is 20
     100PASS m2.a is 1
     101PASS m2.b is 0
     102PASS m2.c is 0
     103PASS m2.d is 1
     104PASS m2.e is 10
     105PASS m2.f is 20
     106
     107Test immutability of translate
     108PASS parseFloat(m.a) is 1
     109PASS parseFloat(m.b) is 0
     110PASS parseFloat(m.c) is 0
     111PASS parseFloat(m.d) is 1
     112PASS parseFloat(m.e) is 0
     113PASS parseFloat(m.f) is 0
    77114
    78115Test scale
    79 PASS m.a is 10
    80 PASS m.b is 0
    81 PASS m.c is 0
    82 PASS m.d is 20
     116PASS m2.a is 10
     117PASS m2.b is 0
     118PASS m2.c is 0
     119PASS m2.d is 20
     120PASS m2.e is 0
     121PASS m2.f is 0
     122
     123Test immutability of scale
     124PASS parseFloat(m.a) is 1
     125PASS parseFloat(m.b) is 0
     126PASS parseFloat(m.c) is 0
     127PASS parseFloat(m.d) is 1
     128PASS parseFloat(m.e) is 0
     129PASS parseFloat(m.f) is 0
     130
     131Test rotate
     132PASS parseFloat(m2.a.toPrecision(6)) is 0.984808
     133PASS parseFloat(m2.b.toPrecision(6)) is 0.173648
     134PASS parseFloat(m2.c.toPrecision(6)) is -0.173648
     135PASS parseFloat(m2.d.toPrecision(6)) is 0.984808
    83136PASS m.e is 0
    84137PASS m.f is 0
    85138
    86 Test rotate
    87 PASS Math.round(m.a*1000000)/1000000 is 0.984808
    88 PASS Math.round(m.b*1000000)/1000000 is 0.173648
    89 PASS Math.round(m.c*1000000)/1000000 is -0.173648
    90 PASS Math.round(m.d*1000000)/1000000 is 0.984808
    91 PASS m.e is 0
    92 PASS m.f is 0
     139Test immutability of rotate
     140PASS parseFloat(m.a) is 1
     141PASS parseFloat(m.b) is 0
     142PASS parseFloat(m.c) is 0
     143PASS parseFloat(m.d) is 1
     144PASS parseFloat(m.e) is 0
     145PASS parseFloat(m.f) is 0
    93146
    94147PASS successfullyParsed is true
  • trunk/LayoutTests/transforms/2d/cssmatrix-interface.xhtml

    r39968 r40807  
    3333else
    3434  testFailed("string constructor");
     35
     36debug("");
     37debug("Test toString");
     38var m = new WebKitCSSMatrix("matrix(1, 0, 0, 1, 0, 0)");
     39var s = m.toString();
     40var a = s.split('(');
     41shouldBe('a[0]', '"matrix"');
     42var a2 = a[1].split(',');
     43shouldBe('parseFloat(a2[0])', '1');
     44shouldBe('parseFloat(a2[1])', '0');
     45shouldBe('parseFloat(a2[2])', '0');
     46shouldBe('parseFloat(a2[3])', '1');
     47shouldBe('parseFloat(a2[4])', '0');
     48var a3 = a2[5].split(")");
     49shouldBe('parseFloat(a3[0])', '0');
     50shouldBe('a3[1]', '""');
    3551
    3652debug("");
     
    99115
    100116debug("");
     117debug("Test multiply with missing argument");
     118m = new WebKitCSSMatrix("matrix(1, 2, 3, 4, 5, 6)");
     119m2 = m.multiply();
     120shouldBe('m2', 'null');
     121
     122debug("");
     123debug("Test immutability of multiply");
     124shouldBe('parseFloat(m.a)', '1');
     125shouldBe('parseFloat(m.b)', '2');
     126shouldBe('parseFloat(m.c)', '3');
     127shouldBe('parseFloat(m.d)', '4');
     128shouldBe('parseFloat(m.e)', '5');
     129shouldBe('parseFloat(m.f)', '6');
     130
     131debug("");
    101132debug("Test inverse");
    102133m = new WebKitCSSMatrix("matrix(2, 0, 0, 2, 10, 20)");
     
    111142
    112143debug("");
     144debug("Test immutability of inverse");
     145shouldBe('parseFloat(m.a)', '2');
     146shouldBe('parseFloat(m.b)', '0');
     147shouldBe('parseFloat(m.c)', '0');
     148shouldBe('parseFloat(m.d)', '2');
     149shouldBe('parseFloat(m.e)', '10');
     150shouldBe('parseFloat(m.f)', '20');
     151
     152debug("");
    113153debug("Test throwing exception from inverse");
    114154m = new WebKitCSSMatrix("matrix(0, 0, 0, 0, 0, 0)"); // not invertible
     
    118158debug("Test translate");
    119159m = new WebKitCSSMatrix();
    120 m = m.translate(10, 20);
    121 shouldBe('m.a', '1');
    122 shouldBe('m.b', '0');
    123 shouldBe('m.c', '0');
    124 shouldBe('m.d', '1');
    125 shouldBe('m.e', '10');
    126 shouldBe('m.f', '20');
     160m2 = m.translate(10, 20);
     161shouldBe('m2.a', '1');
     162shouldBe('m2.b', '0');
     163shouldBe('m2.c', '0');
     164shouldBe('m2.d', '1');
     165shouldBe('m2.e', '10');
     166shouldBe('m2.f', '20');
     167
     168debug("");
     169debug("Test immutability of translate");
     170shouldBe('parseFloat(m.a)', '1');
     171shouldBe('parseFloat(m.b)', '0');
     172shouldBe('parseFloat(m.c)', '0');
     173shouldBe('parseFloat(m.d)', '1');
     174shouldBe('parseFloat(m.e)', '0');
     175shouldBe('parseFloat(m.f)', '0');
    127176
    128177debug("");
    129178debug("Test scale");
    130179m = new WebKitCSSMatrix();
    131 m = m.scale(10, 20);
    132 shouldBe('m.a', '10');
    133 shouldBe('m.b', '0');
    134 shouldBe('m.c', '0');
    135 shouldBe('m.d', '20');
     180m2 = m.scale(10, 20);
     181shouldBe('m2.a', '10');
     182shouldBe('m2.b', '0');
     183shouldBe('m2.c', '0');
     184shouldBe('m2.d', '20');
     185shouldBe('m2.e', '0');
     186shouldBe('m2.f', '0');
     187
     188debug("");
     189debug("Test immutability of scale");
     190shouldBe('parseFloat(m.a)', '1');
     191shouldBe('parseFloat(m.b)', '0');
     192shouldBe('parseFloat(m.c)', '0');
     193shouldBe('parseFloat(m.d)', '1');
     194shouldBe('parseFloat(m.e)', '0');
     195shouldBe('parseFloat(m.f)', '0');
     196
     197debug("");
     198debug("Test rotate");
     199m = new WebKitCSSMatrix();
     200m2 = m.rotate(10);
     201shouldBe('parseFloat(m2.a.toPrecision(6))', '0.984808');
     202shouldBe('parseFloat(m2.b.toPrecision(6))', '0.173648');
     203shouldBe('parseFloat(m2.c.toPrecision(6))', '-0.173648');
     204shouldBe('parseFloat(m2.d.toPrecision(6))', '0.984808');
    136205shouldBe('m.e', '0');
    137206shouldBe('m.f', '0');
    138207
    139208debug("");
    140 debug("Test rotate");
    141 m = new WebKitCSSMatrix();
    142 m = m.rotate(10);
    143 shouldBe('Math.round(m.a*1000000)/1000000', '0.984808');
    144 shouldBe('Math.round(m.b*1000000)/1000000', '0.173648');
    145 shouldBe('Math.round(m.c*1000000)/1000000', '-0.173648');
    146 shouldBe('Math.round(m.d*1000000)/1000000', '0.984808');
    147 shouldBe('m.e', '0');
    148 shouldBe('m.f', '0');
     209debug("Test immutability of rotate");
     210shouldBe('parseFloat(m.a)', '1');
     211shouldBe('parseFloat(m.b)', '0');
     212shouldBe('parseFloat(m.c)', '0');
     213shouldBe('parseFloat(m.d)', '1');
     214shouldBe('parseFloat(m.e)', '0');
     215shouldBe('parseFloat(m.f)', '0');
    149216
    150217debug("");
  • trunk/WebCore/ChangeLog

    r40804 r40807  
     12009-02-09  Chris Marrin  <cmarrin@apple.com>
     2
     3        Reviewed by Simon Fraser
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=23689
     6
     7        Added 3D functions to WebKitCSSMatrix. This depends on the 3D functions
     8        added to TransformationMatrix in https://bugs.webkit.org/show_bug.cgi?id=6868
     9
     10        Test: transforms/3d/cssmatrix-3d-interface.xhtml
     11
     12        * css/WebKitCSSMatrix.cpp:
     13        * css/WebKitCSSMatrix.h:
     14        * css/WebKitCSSMatrix.idl:
     15
    1162009-02-09  Mark Rowe  <mrowe@apple.com>
    217
  • trunk/WebCore/css/WebKitCSSMatrix.cpp

    r40761 r40807  
    2525
    2626#include "config.h"
     27#include "WebKitCSSMatrix.h"
    2728
    2829#include "CSSParser.h"
     
    3233#include "ExceptionCode.h"
    3334#include "RenderStyle.h"
    34 #include "WebKitCSSMatrix.h"
     35#include <wtf/MathExtras.h>
    3536
    3637namespace WebCore {
     
    9495
    9596// This is a multRight (this = this * secondMatrix)
    96 PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::multiply(WebKitCSSMatrix* secondMatrix)
     97PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::multiply(WebKitCSSMatrix* secondMatrix) const
    9798{
     99    if (!secondMatrix)
     100        return 0;
     101
    98102    TransformationMatrix tmp(m_matrix);
    99103    tmp.multiply(secondMatrix->m_matrix);
     
    101105}
    102106
    103 PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::inverse(ExceptionCode& ec)
     107PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::inverse(ExceptionCode& ec) const
    104108{
    105109    if (!m_matrix.isInvertible()) {
     
    111115}
    112116
    113 PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::translate(float x, float y)
     117PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::translate(double x, double y, double z) const
    114118{
    115119    if (isnan(x))
    116         x = 0; 
     120        x = 0;
    117121    if (isnan(y))
    118         y = 0;
    119     return WebKitCSSMatrix::create(m_matrix.translate(x, y));
     122        y = 0;
     123    if (isnan(z))
     124        z = 0;
     125    return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).translate3d(x, y, z));
    120126}
    121127
    122 PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::scale(float scaleX, float scaleY)
     128PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::scale(double scaleX, double scaleY, double scaleZ) const
    123129{
    124130    if (isnan(scaleX))
    125         scaleX = 1; 
     131        scaleX = 1;
    126132    if (isnan(scaleY))
    127         scaleY = scaleX;
    128     return WebKitCSSMatrix::create(m_matrix.scaleNonUniform(scaleX,scaleY));
     133        scaleY = scaleX;
     134    if (isnan(scaleZ))
     135        scaleZ = 1;
     136    return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).scale3d(scaleX, scaleY, scaleZ));
    129137}
    130138
    131 PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::rotate(float rot)
     139PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::rotate(double rotX, double rotY, double rotZ) const
    132140{
    133     if (isnan(rot))
    134         rot = 0;
    135     return WebKitCSSMatrix::create(m_matrix.rotate(rot));
     141    if (isnan(rotX))
     142        rotX = 0;
     143       
     144    if (isnan(rotY) && isnan(rotZ)) {
     145        rotZ = rotX;
     146        rotX = 0;
     147        rotY = 0;
     148    }
     149
     150    if (isnan(rotY))
     151        rotY = 0;
     152    if (isnan(rotZ))
     153        rotZ = 0;
     154    return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).rotate3d(rotX, rotY, rotZ));
    136155}
    137156
    138 String WebKitCSSMatrix::toString()
     157PassRefPtr<WebKitCSSMatrix> WebKitCSSMatrix::rotateAxisAngle(double x, double y, double z, double angle) const
    139158{
    140     return String::format("matrix(%f, %f, %f, %f, %f, %f)",
    141                             m_matrix.a(), m_matrix.b(), m_matrix.c(), m_matrix.d(), m_matrix.e(), m_matrix.f());
     159    if (isnan(x))
     160        x = 0;
     161    if (isnan(y))
     162        y = 0;
     163    if (isnan(z))
     164        z = 0;
     165    if (isnan(angle))
     166        angle = 0;
     167    if (x == 0 && y == 0 && z == 0)
     168        z = 1;
     169    return WebKitCSSMatrix::create(TransformationMatrix(m_matrix).rotate3d(x, y, z, angle));
     170}
     171
     172
     173String WebKitCSSMatrix::toString() const
     174{
     175    // FIXME - Need to ensure valid CSS floating point values (https://bugs.webkit.org/show_bug.cgi?id=20674)
     176    if (m_matrix.isAffine())
     177        return String::format("matrix(%f, %f, %f, %f, %f, %f)",
     178                                m_matrix.a(), m_matrix.b(), m_matrix.c(), m_matrix.d(), m_matrix.e(), m_matrix.f());
     179    return String::format("matrix3d(%f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f)",
     180                            m_matrix.m11(), m_matrix.m12(), m_matrix.m13(), m_matrix.m14(),
     181                            m_matrix.m21(), m_matrix.m22(), m_matrix.m23(), m_matrix.m24(),
     182                            m_matrix.m31(), m_matrix.m32(), m_matrix.m33(), m_matrix.m34(),
     183                            m_matrix.m41(), m_matrix.m42(), m_matrix.m43(), m_matrix.m44());
    142184}
    143185
  • trunk/WebCore/css/WebKitCSSMatrix.h

    r39922 r40807  
    2727#define WebKitCSSMatrix_h
    2828
     29#include "ExceptionCode.h"
     30#include "PlatformString.h"
    2931#include "StyleBase.h"
    30 #include "PlatformString.h"
    3132#include "TransformationMatrix.h"
    3233#include <wtf/PassRefPtr.h>
     
    5657    virtual ~WebKitCSSMatrix();
    5758
    58     float a() const { return static_cast<float>(m_matrix.a()); }
    59     float b() const { return static_cast<float>(m_matrix.b()); }
    60     float c() const { return static_cast<float>(m_matrix.c()); }
    61     float d() const { return static_cast<float>(m_matrix.d()); }
    62     float e() const { return static_cast<float>(m_matrix.e()); }
    63     float f() const { return static_cast<float>(m_matrix.f()); }
     59    double a() const { return m_matrix.a(); }
     60    double b() const { return m_matrix.b(); }
     61    double c() const { return m_matrix.c(); }
     62    double d() const { return m_matrix.d(); }
     63    double e() const { return m_matrix.e(); }
     64    double f() const { return m_matrix.f(); }
    6465   
    65     void setA(float f) { m_matrix.setA(f); }
    66     void setB(float f) { m_matrix.setB(f); }
    67     void setC(float f) { m_matrix.setC(f); }
    68     void setD(float f) { m_matrix.setD(f); }
    69     void setE(float f) { m_matrix.setE(f); }
    70     void setF(float f) { m_matrix.setF(f); }
     66    void setA(double f) { m_matrix.setA(f); }
     67    void setB(double f) { m_matrix.setB(f); }
     68    void setC(double f) { m_matrix.setC(f); }
     69    void setD(double f) { m_matrix.setD(f); }
     70    void setE(double f) { m_matrix.setE(f); }
     71    void setF(double f) { m_matrix.setF(f); }
     72 
     73    double m11() const { return m_matrix.m11(); }
     74    double m12() const { return m_matrix.m12(); }
     75    double m13() const { return m_matrix.m13(); }
     76    double m14() const { return m_matrix.m14(); }
     77    double m21() const { return m_matrix.m21(); }
     78    double m22() const { return m_matrix.m22(); }
     79    double m23() const { return m_matrix.m23(); }
     80    double m24() const { return m_matrix.m24(); }
     81    double m31() const { return m_matrix.m31(); }
     82    double m32() const { return m_matrix.m32(); }
     83    double m33() const { return m_matrix.m33(); }
     84    double m34() const { return m_matrix.m34(); }
     85    double m41() const { return m_matrix.m41(); }
     86    double m42() const { return m_matrix.m42(); }
     87    double m43() const { return m_matrix.m43(); }
     88    double m44() const { return m_matrix.m44(); }
     89   
     90    void setM11(double f) { m_matrix.setM11(f); }
     91    void setM12(double f) { m_matrix.setM12(f); }
     92    void setM13(double f) { m_matrix.setM13(f); }
     93    void setM14(double f) { m_matrix.setM14(f); }
     94    void setM21(double f) { m_matrix.setM21(f); }
     95    void setM22(double f) { m_matrix.setM22(f); }
     96    void setM23(double f) { m_matrix.setM23(f); }
     97    void setM24(double f) { m_matrix.setM24(f); }
     98    void setM31(double f) { m_matrix.setM31(f); }
     99    void setM32(double f) { m_matrix.setM32(f); }
     100    void setM33(double f) { m_matrix.setM33(f); }
     101    void setM34(double f) { m_matrix.setM34(f); }
     102    void setM41(double f) { m_matrix.setM41(f); }
     103    void setM42(double f) { m_matrix.setM42(f); }
     104    void setM43(double f) { m_matrix.setM43(f); }
     105    void setM44(double f) { m_matrix.setM44(f); }
    71106 
    72107    void setMatrixValue(const String& string, ExceptionCode&);
    73108   
    74     // this = this * secondMatrix
    75     PassRefPtr<WebKitCSSMatrix> multiply(WebKitCSSMatrix* secondMatrix);
     109    // The following math function return a new matrix with the
     110    // specified operation applied. The this value is not modified.
    76111   
    77     // FIXME: we really should have an exception here, for when matrix is not invertible
    78     PassRefPtr<WebKitCSSMatrix> inverse(ExceptionCode&);
    79     PassRefPtr<WebKitCSSMatrix> translate(float x, float y);
    80     PassRefPtr<WebKitCSSMatrix> scale(float scaleX, float scaleY);
    81     PassRefPtr<WebKitCSSMatrix> rotate(float rot);
     112    // Multiply this matrix by secondMatrix, on the right (result = this * secondMatrix)
     113    PassRefPtr<WebKitCSSMatrix> multiply(WebKitCSSMatrix* secondMatrix) const;
    82114   
    83     const TransformationMatrix& transform() { return m_matrix; }
     115    // Return the inverse of this matrix. Throw an exception if the matrix is not invertible
     116    PassRefPtr<WebKitCSSMatrix> inverse(ExceptionCode&) const;
    84117   
    85     String toString();
     118    // Return this matrix translated by the passed values.
     119    // Passing a NaN will use a value of 0. This allows the 3D form to used for 2D operations
     120    // Operation is performed as though the this matrix is multiplied by a matrix with
     121    // the translation values on the left (result = translation(x,y,z) * this)
     122    PassRefPtr<WebKitCSSMatrix> translate(double x, double y, double z) const;
     123   
     124    // Returns this matrix scaled by the passed values.
     125    // Passing scaleX or scaleZ as NaN uses a value of 1, but passing scaleY of NaN
     126    // makes it the same as scaleX. This allows the 3D form to used for 2D operations
     127    // Operation is performed as though the this matrix is multiplied by a matrix with
     128    // the scale values on the left (result = scale(x,y,z) * this)
     129    PassRefPtr<WebKitCSSMatrix> scale(double scaleX, double scaleY, double scaleZ) const;
     130
     131    // Returns this matrix rotated by the passed values.
     132    // If rotY and rotZ are NaN, rotate about Z (rotX=0, rotateY=0, rotateZ=rotX).
     133    // Otherwise use a rotation value of 0 for any passed NaN.   
     134    // Operation is performed as though the this matrix is multiplied by a matrix with
     135    // the rotation values on the left (result = rotation(x,y,z) * this)
     136    PassRefPtr<WebKitCSSMatrix> rotate(double rotX, double rotY, double rotZ) const;
     137   
     138    // Returns this matrix rotated about the passed axis by the passed angle.
     139    // Passing a NaN will use a value of 0. If the axis is (0,0,0) use a value
     140    // Operation is performed as though the this matrix is multiplied by a matrix with
     141    // the rotation values on the left (result = rotation(x,y,z,angle) * this)
     142    PassRefPtr<WebKitCSSMatrix> rotateAxisAngle(double x, double y, double z, double angle) const;
     143   
     144    const TransformationMatrix& transform() const { return m_matrix; }
     145   
     146    String toString() const;
    86147   
    87148protected:
  • trunk/WebCore/css/WebKitCSSMatrix.idl

    r39922 r40807  
    2929    interface WebKitCSSMatrix {
    3030
    31         attribute float a;
    32         attribute float b;
    33         attribute float c;
    34         attribute float d;
    35         attribute float e;
    36         attribute float f;
     31        // These attributes are simple aliases for certain elements of the 4x4 matrix
     32        attribute double a; // alias for m11
     33        attribute double b; // alias for m12
     34        attribute double c; // alias for m21
     35        attribute double d; // alias for m22
     36        attribute double e; // alias for m41
     37        attribute double f; // alias for m42
    3738
    38         void            setMatrixValue(in DOMString string) raises (DOMException);
    39         WebKitCSSMatrix multiply(in WebKitCSSMatrix secondMatrix);
    40         WebKitCSSMatrix inverse() raises (DOMException);
    41         WebKitCSSMatrix translate(in float x, in float y);
    42         WebKitCSSMatrix scale(in float scaleX, in float scaleY);
    43         WebKitCSSMatrix rotate(in float rot);
     39        attribute double m11;
     40        attribute double m12;
     41        attribute double m13;
     42        attribute double m14;
     43        attribute double m21;
     44        attribute double m22;
     45        attribute double m23;
     46        attribute double m24;
     47        attribute double m31;
     48        attribute double m32;
     49        attribute double m33;
     50        attribute double m34;
     51        attribute double m41;
     52        attribute double m42;
     53        attribute double m43;
     54        attribute double m44;
     55
     56        void setMatrixValue(in DOMString string) raises (DOMException);
     57       
     58        // Multiply this matrix by secondMatrix, on the right (result = this * secondMatrix)
     59        [Immutable] WebKitCSSMatrix multiply(in WebKitCSSMatrix secondMatrix);
     60       
     61        // Return the inverse of this matrix. Throw an exception if the matrix is not invertible
     62        [Immutable] WebKitCSSMatrix inverse() raises (DOMException);
     63       
     64        // Return this matrix translated by the passed values.
     65        // Passing a NaN will use a value of 0. This allows the 3D form to used for 2D operations   
     66        [Immutable] WebKitCSSMatrix translate(in double x, in double y, in double z);
     67       
     68        // Returns this matrix scaled by the passed values.
     69        // Passing scaleX or scaleZ as NaN uses a value of 1, but passing scaleY of NaN
     70        // makes it the same as scaleX. This allows the 3D form to used for 2D operations
     71        [Immutable] WebKitCSSMatrix scale(in double scaleX, in double scaleY, in double scaleZ);
     72       
     73        // Returns this matrix rotated by the passed values.
     74        // If rotY and rotZ are NaN, rotate about Z (rotX=0, rotateY=0, rotateZ=rotX).
     75        // Otherwise use a rotation value of 0 for any passed NaN.   
     76        [Immutable] WebKitCSSMatrix rotate(in double rotX, in double rotY, in double rotZ);
     77       
     78        // Returns this matrix rotated about the passed axis by the passed angle.
     79        // Passing a NaN will use a value of 0. If the axis is (0,0,0) use a value
     80        // of (0,0,1).
     81        [Immutable] WebKitCSSMatrix rotateAxisAngle(in double x, in double y, in double z, in double angle);
    4482       
    4583        [DontEnum] DOMString toString();
Note: See TracChangeset for help on using the changeset viewer.