Bug 15443 - CSSMatrix is defined, but there's no way to get one
Summary: CSSMatrix is defined, but there's no way to get one
Status: RESOLVED LATER
Alias: None
Product: CSS
Classification: Unclassified
Component: Transforms (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Simon Fraser
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-06 18:39 UTC by Aryeh Gregor
Modified: 2012-02-23 05:20 UTC (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Aryeh Gregor 2012-01-06 18:39:41 UTC
http://dev.w3.org/csswg/css3-transforms/ defines a CSSMatrix interface with a bunch of methods.  However, nothing in the spec provides any way to obtain a CSSMatrix, except by calling methods on an existing CSSMatrix.  Either there should be some way to create a CSSMatrix -- maybe define a constructor? -- or the definition should be removed.

(FWIW, window.CSSMatrix is undefined in all browsers I tested in.  Either browsers don't actually implement the interface, or they implement it with [NoInterfaceObject].  grep -IR CSSMatrix . in mozilla-central returns no results.)
Comment 1 Simon Fraser 2012-01-06 19:02:52 UTC
foo = new CSSMatrix('rotate(10deg)') works in webkit.
Comment 2 Aryeh Gregor 2012-01-06 19:46:33 UTC
Is this only the Safari port?  In Chrome 17 dev, I get "Uncaught ReferenceError: CSSMatrix is not defined".
Comment 3 Chris Marrin 2012-01-12 21:35:04 UTC
(In reply to comment #2)
> Is this only the Safari port?  In Chrome 17 dev, I get "Uncaught
> ReferenceError: CSSMatrix is not defined".

In WebKit you have to say WebKitCSSMatrix, for instance:

    javascript:alert(new WebKitCSSMatrix('rotate(10deg)'))

in the address bar works for me.
Comment 4 Aryeh Gregor 2012-01-13 17:03:47 UTC
Aha, okay.  Then I think the IDL should have this line added before it:

  [Constructor(optional DOMString transform)]

and some prose like

"""
When the constructor for CSSMatrix is invoked, the parameter <var>transform</var> must be parsed according to the rules for parsing the <a href=#transform-property>transform property</a>.  If parsing succeeds, return a CSSMatrix representing the matrix corresponding to <var>transform</var>.  Otherwise, if <var>transform</var> is the empty string or is omitted, return a CSSMatrix representing the identity matrix.  Otherwise, <a href=http://dvcs.w3.org/hg/domcore/raw-file/tip/dom-core.html#concept-throw>throw</a> a SyntaxError exception.
"""

(This doesn't define how whitespace stripping works, but that's not a big deal for now.)
Comment 5 Dirk Schulze 2012-02-23 05:20:24 UTC
This gets delayed to CSS4 Transforms.