-
Notifications
You must be signed in to change notification settings - Fork 50
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
[geometry] DOMMatrix should not depend on the CSS parser #122
Comments
Is there data on how often the CSS parsing happens for Maybe we could specify a simpler non-CSS parser that is compatible enough with deployed content? |
Blink and Gecko do not have use counter data at present for how how often the CSS parsing happens, In httparchive:har.2017_01_15_chrome_requests_bodies there are 571 hits for 'setMatrixValue', and most of them are various versions of this library: We also have data that DOMMatrix in Mozilla is very rarely used: However, WebkitCSSMatrix in Chrome is used in some way on 1% of pages, according to https://www.chromestatus.com/metrics/feature/popularity#WebKitCSSMatrix. |
As reported by @chrishtr on blink-dev, he added separate use counters for setMatrixValue and the string constructor. They haven't reached the stable channel yet, but getting rid of the constructor does not look promising. A related Chromium issue is https://bugs.chromium.org/p/chromium/issues/detail?id=703908 Since the string-parsing is already shipping for WebKitCSSMatrix or DOMMatrix in all engines, I propose to leave that intact and just limit it to the main thread. Concretely:
(The idea is to behave as if the string constructor didn't exist, even though it does. If the third |
@esprehn, would you consider this issue resolved if the spec is changed as suggested in #122 (comment) or are there other options still? |
Another option is #122 (comment) but that is nothing concrete and would probably need a bit of compat research. |
I dunno. In a worker context there's arguably much less need for the parser, since the input probably comes from |
With "two parsers" you mean the result of My idea would be to use a single parser for |
I mean that |
It is, and clearly we shouldn't change what I agree that it would be a bit confusing if e.g. CSS comments wouldn't work in That said, I'm happy to go either way, just wanted to make sure we consider the options at hand. |
Annotate setMatrixValue with [Exposed=Window] and throw TypeError when DOMMatrix/DOMMatrixReadOnly is constructed with a string if the current global is not a Window. Fixes #122.
Annotate setMatrixValue with [Exposed=Window] and throw TypeError when DOMMatrix/DOMMatrixReadOnly is constructed with a string if the current global is not a Window. Fixes #122. Tests: web-platform-tests/wpt#5769
Spec PR #141 |
Annotate setMatrixValue with [Exposed=Window] and throw TypeError when DOMMatrix/DOMMatrixReadOnly is constructed with a string if the current global is not a Window. Fixes #122. Tests: web-platform-tests/wpt#5769
I do not think the low level geometry types should depend on having a CSS tokenizer and parser available.
The spec does not provide affordances to parse any other CSS syntax, for example
rect()
into DOMRect, and parsing CSS is better handled by the Typed OM spec which uses an operation list to represent transforms instead of a matrix (which is a better fit for CSS anyway).If authors wish to create a DOMMatrix from a list of steps they can do:
which will also be faster since it doesn't require parsing all of the numbers back out of a string.
@shans @tabatkins @bfgeek
The text was updated successfully, but these errors were encountered: