-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can WebKitCSSMatrix be an alias of DOMMatrix? #19
Comments
This is something I had originally hoped was possible. Here are the 2 main differences, other than constructors you mention:
(Maybe it's better to define
|
I see that Firefox has shipped DOMMatrix already, but not Chrome, Edge or Safari. What do you think about simply changing DOMMatrix to match WebKitCSSMatrix? Since only Gecko has DOMMatrix so far, I don't suppose too much could depend on it, right? |
I don't really know, but I assume we can change it. |
@zcorpan @dirkschulze @cabanier, you're the editors of https://drafts.fxtf.org/geometry/Overview.html#DOMMatrix Do you see a problem with making |
There is also SVGMatrix which DOMMatrix is supposed to supersede and be compatible with, and SVGMatrix is widely supported. I don't know which of SVGMatrix and WebKitCSSMatrix are more widely used, but I suppose it is not possible to be compatible with both... |
Can't WebKitCSSMatrix inherit from DOMMatrix, and shadow |
A quick glance at Blink's IDL for SVGMatrix and WebKitCSSMatrix suggests that they could be merged. SVGMatrix has a few methods with the same names but fewer arguments, and a few extra methods, but I see no obvious conflicts in semantics. There is the trouble that SVGMatrix is a tear-off, but that seems to equally problematic if trying to merge it into DOMMatrix. |
As for inheriting and shadowing, that is what the spec currently does, but then you have to shadow everything so that it returns a WebKitCSSMatrix instead of a DOMMatrix. Just making all of the matrix types aliases ought to simplify things, if it actually works out. |
OK, yeah. Sorry for not paying proper attention; I should be sleeping. :-) I thought WebKitCSSMatrix#rotate with one argument would only scale X, but I see now it scales both X and Y in that case. If they are indeed compatible then I don't mind changing DOMMatrix. |
I think the most consequential differences between DOMMatrix and WebKitCSSMatrix are the ones pointed out in #19 (comment) There's also the fact that |
|
From a quick github search it looks like most invocations of the constructor either use no argument or a string -- not another WebKitCSSMatrix instance. |
It's When I commented I think |
Yep. Moving from required to optional shouldn't be a problem for Web compat. The other thing is whether we should drop some other methods in the Geometry spec, like |
Yeah, dropping anything that becomes redundant sounds like a good idea, assuming it's not shipped and used by web content. |
Change the arguments from (angle, originX, originY) to (rotX, rotY, rotZ), all optional. Part of whatwg/compat#19
Drop the scale() and scaleSelf() methods, and rename the scaleNonUniform()/scaleNonUniformSelf() methods to scale() and scaleSelf(), respectively. Make scaleX optional, with default value 1, and scaleY use the value of scaleX if omitted. Part of whatwg/compat#19
Make all arguments optional for DOMMatrix/DOMMatrixReadOnly methods, except for setMatrixValue() which throws in WebKit anyway (because "undefined" fails to parse). I made everything optional to be consistent; making the minimal set of arguments optional would be self-inconsistent and confusing (e.g. skewX vs. skewXSelf). Part of whatwg/compat#19
Change fromString() static method into overloaded constructor, since Web content depends on it for WebKitCSSMatrix constructor. However, I could not find (github search) content that depends on WebKitCSSMatrix(other), so leave as fromMatrix() static method. Also add a no-argument constructor. I think this was accidentally left out when switching to static methods. Part of whatwg/compat#19
Alias WebKitCSSMatrix to DOMMatrix in the same way as SVGMatrix. Part of whatwg/compat#19
OK so I've made a series of changes to Geometry to address this. Commits: w3c/fxtf-drafts@430bc88 Pls review :-) |
Thanks @zcorpan -- I had a quick glance but will take a closer look on Monday (flying home in a few hours). I assume we still want to do #34 (comment)? |
Yeah, IMO at least |
Anything I need to look at? Next step is to actually make |
I also don't know about any content that relies on |
OK looked in httparchive now as well:
results-20160127-070311.csv.zip All of these pass in
22 rows, all inspected manually; those that weren't 404 now were passing in So no instances that pass in another |
FWIW, Blink doesn't have a |
cc @grorg |
That's... a good question. I can't recall why I added it, now that I'm looking over WebKit's implementation. So probably just a mistake that can be removed. |
How does the following end up working (in Chrome)?
(this might be some WebIDL magic I don't know about) |
It |
In Geometry the WebIDL magic is |
Ah, there we go. So yes, that constructor is just a spec (editor) bug. |
@zcorpan here is some more feedback from wchen: https://bugzilla.mozilla.org/show_bug.cgi?id=1241575#c6
As for the "parse transform lists as a transform property" problem (issue #34), what do you think makes more sense -- leaving the DOMMatrix spec as-is or speccing the WebKitCSSMatrix alias to only take transform property syntax? (Seems kinda weird to have aliases with different behavior...). Or possibly a note that for historical reasons the WebKitCSSMatrix constructor is allowed to only use transform property syntax. |
And then in theory we can just delete this whole thing from the compat spec, once the small issues are worked out? (and file bugs for Gecko to update its DOMMatrix/DOMMatrixReadOnly implementation). |
Yes. See #34 (comment)
That doesn't make much sense IMO. People shouldn't use the constructor at all; they should use
Yep. Please file any bugs on the Geometry spec (link in bottom right corner of the spec). |
Oh, right. That reply got buried in my GitHub issues email folder. Agreed DOMMatrix shouldn't change that.
Yes, nobody should be using My concern is more about documenting how to parse One option is to update the compat spec to reflect the current state of what Gecko has (or will soon have, when 1241575 is fixed), and add a note pointing future implementers to |
Given #19 (comment), I think we can close this. 🎈 |
Thanks for this. I'll file a bug for WebKit to follow along (and implement DOMMatrix as well). |
Here's one issue I missed (around (As I said in the bug, there doesn't seem to be a huge usage of rotateAxisAngle out in the wild, from what I can tell -- but we should aim for compatibility) |
@zcorpan help my matrix-fried brain out. According to the Geometry spec's definition of
|
I think they should be the same. |
Yep, was a Gecko bug -- false alarm. The fix should be in tomorrow's nightly. 🚒 |
The support data here comes mainly from the following: mdn#1617 mdn#3644 mdn#3743 mdn#4902 mdn#4936 With the removal of the GeometryInterfaces flag from BCD, lint errors made it apparent that a lot of the versions were wrong, based on Chromium commits while the flag was still not enabled. In short, all of this shipped together in M61: https://storage.googleapis.com/chromium-find-releases-static/065.html#06592e080fd1cf4a188265ed4f9bcf826952671a The only exceptions are scaleNonUniform which shipped in M73: https://storage.googleapis.com/chromium-find-releases-static/57f.html#57f350e070536c7870cad53b3edf74f58cc51d50 And scaleNonUniformSelf isn't in the spec and was never in Chromium: w3c/fxtf-drafts#214 whatwg/compat#19
First, remove the GeometryInterfaces flag, removed over 2 years ago: https://chromium.googlesource.com/chromium/src/+/3e51c4becac41fe61dbd02a68bd875cc4a340457 Lint errors made it apparent that a lot of the versions were wrong. The support data here comes mainly from the following: mdn#1617 mdn#3644 mdn#3743 mdn#4902 mdn#4936 The root mistake was looking at commits which added/updated these APIs while it was still behind a flag, and some BCD entries using those releases without documenting it as behind a flag. In short, all of this shipped together in M61: https://storage.googleapis.com/chromium-find-releases-static/065.html#06592e080fd1cf4a188265ed4f9bcf826952671a The only exceptions are scaleNonUniform which shipped in M73: https://storage.googleapis.com/chromium-find-releases-static/57f.html#57f350e070536c7870cad53b3edf74f58cc51d50 And scaleNonUniformSelf isn't in the spec and was never in Chromium: w3c/fxtf-drafts#214 whatwg/compat#19 The data for opera, opera_android, samsung_internet and webview_android was mirrored.
) First, remove the GeometryInterfaces flag, removed over 2 years ago: https://chromium.googlesource.com/chromium/src/+/3e51c4becac41fe61dbd02a68bd875cc4a340457 Lint errors made it apparent that a lot of the versions were wrong. The support data here comes mainly from the following: #1617 #3644 #3743 #4902 #4936 The root mistake was looking at commits which added/updated these APIs while it was still behind a flag, and some BCD entries using those releases without documenting it as behind a flag. In short, all of this shipped together in M61: https://storage.googleapis.com/chromium-find-releases-static/065.html#06592e080fd1cf4a188265ed4f9bcf826952671a The only exceptions are scaleNonUniform which shipped in M73: https://storage.googleapis.com/chromium-find-releases-static/57f.html#57f350e070536c7870cad53b3edf74f58cc51d50 And scaleNonUniformSelf isn't in the spec and was never in Chromium: w3c/fxtf-drafts#214 whatwg/compat#19 The data for opera, opera_android, samsung_internet and webview_android was mirrored.
First, remove the GeometryInterfaces flag, removed over 2 years ago: https://chromium.googlesource.com/chromium/src/+/3e51c4becac41fe61dbd02a68bd875cc4a340457 Lint errors made it apparent that a lot of the versions were wrong. The support data here comes mainly from the following: mdn#1617 mdn#3644 mdn#3743 mdn#4902 mdn#4936 The root mistake was looking at commits which added/updated these APIs while it was still behind a flag, and some BCD entries using those releases without documenting it as behind a flag. In short, all of this shipped together in M61: https://storage.googleapis.com/chromium-find-releases-static/065.html#06592e080fd1cf4a188265ed4f9bcf826952671a The only exceptions are scaleNonUniform which shipped in M73: https://storage.googleapis.com/chromium-find-releases-static/57f.html#57f350e070536c7870cad53b3edf74f58cc51d50 And scaleNonUniformSelf isn't in the spec and was never in Chromium: w3c/fxtf-drafts#214 whatwg/compat#19 The data for edge, opera, opera_android, samsung_internet and webview_android was mirrored.
@miketaylr, can you help me figure out what's blocking making WebKitCSSMatrix an alias of DOMMatrix, so that
window.WebKitCSSMatrix
andwindow.DOMMatrix
are the same constructor?Looking at the current spec, it seems like the only things are
Constructor(DOMString transformList)
andConstructor(WebKitCSSMatrix other)
, the other overrides are just making sure that the returned object is a WebKitCSSMatrix.If there is nothing else, maybe we can have those constructors added to https://drafts.fxtf.org/geometry/#dommatrix ?
The text was updated successfully, but these errors were encountered: