-
Notifications
You must be signed in to change notification settings - Fork 142
[css-typed-om] Describe what setting is2D on CSSTransformComponent should do #414
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
Comments
No, under the current spec setting it to |
In other words: let rotation = new CSSRotation(1, 2, 3, CSS.deg(10));
assert_false(rotation.is2D);
assert_equals(rotation.z, 3);
assert_equals(rotation+"", "rotate3d(1, 2, 3, 10deg)");
rotation.is2D = true;
assert_true(rotation.is2D);
assert_equals(rotation.z, 3);
assert_equals(rotation+"", "rotate(10deg)"); (Actually defining the stringifiers is still on my TODO list, but this is what's intended.) |
Oh, so the getters should still return "3d" values for the transform, even when the component is set to being 2D? So you can set things, and see that they've been set, but they don't get applied. Isn't that potentially confusing for authors? |
Oh, and for CSSTransformValue, if all the contained components have is2D set to true, should toMatrix still return the 3D matrix? If yes, should there be a way for developers to be able to get the 2D matrix? |
Yes, yes, and potentially yes, but the alternatives were more confusing and/or had very bad ergonomics. For example, say that when is2D is set, we replace the 3d components with appropriately "null" objects, and ignore any writes to those values. But the values are objects themselves in some cases, like
The spec says that it multiplies their "equivalent 4x4 transform matrix"es. This should change based on whether it's 2d or not, just like the serialization does; I should put in a note making that clearer. Then I need to see if DOMMatrix automatically gets is2D set correctly for this case; if not, I'll need an explicit check for it. |
I see what you mean - I had prototyped returning a new value for CSSTranslation.z each time if is2D was true, but that's a bit weird too. Cool, I'll implement CSSTransformValue changing the resultant matrix depending on the is2D-ness. |
Yeah, that's precisely the behavior that bz complained about elsewhere - attributes "feel" cheap/static, so they shouldn't create fresh objects on every read, only methods should do that. |
Okay, added a note about this in 7873bee |
And just checked - the is2D flag of DOMMatrix is not automagically set, so the algorithm now handles that. |
…tch new spec - is2D is now handled at the base class (CSSTransformComponent) level - Setting is2D doesn't affect values returned from getters, but does affect ToCSSValue and AsMatrix (used by CSSTransformValue) (w3c/css-houdini-drafts#414) - CSSMatrixComponent takes an options dictionary to specify its 2D-ness. Spec: https://drafts.css-houdini.org/css-typed-om/#dom-csstransformcomponent-is2d BUG=545318 Review-Url: https://codereview.chromium.org/2943303002 Cr-Commit-Position: refs/heads/master@{#483944}
Uh oh!
There was an error while loading. Please reload this page.
https://drafts.css-houdini.org/css-typed-om/#dom-csstransformcomponent-is2d
Should setting is2D to true clear out any 3D attributes on a component? For example:
Additionally, should setting is2D to false again after that restore the previous value? My guess is no, but if it did, then the following would work
The difference is whether the 3D attributes are still "there but hidden" when is2D is set to true, or whether setting is2D clobbers them.
The text was updated successfully, but these errors were encountered: