[Webkit-unassigned] [Bug 65535] A .style like API for setting transform values

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Aug 3 11:30:38 PDT 2011


--- Comment #3 from Chris Marrin <cmarrin at apple.com>  2011-08-03 11:30:38 PST ---
(In reply to comment #2)
> True, thanks for the pointer. It's important to note that the current JS way of modifying transforms via Matrices somehow is even slower than just setting the styles directly. Maybe somebody can shed some light into why that is.

Can you give an example of what you mean by "modifying transforms via matrices? If you're talking about something like:

    var mat = new webKitCSSMatrix();
    mat = mat.rotate(45);
    elt.style.webkitTransform = mat;

I believe WebKit will convert that CSSMatrix into a string and pass that to the CSS value. So that would explain your performance problem  there.

I believe what might be achievable with the CSS OM API is something like:

    node.style.transform.append(new CSSTransformTranslate(0, 0, 0));

That would be the equivalent of:

    node.style.transform = "translate3d(0, 0, 0);

Then to change translation values you'd go:

    node.style.transform[0][0] = 20;
    node.style.transform[0][1] = 10;
    node.style.transform[0][2] = 30;

That's as close you could get because the CSS transform is a CSSValueList of transform primitive objects. You need to be able to represent any primitive followed by any other, including multiple translates, scales, etc. So you'd first have to know the primitive order (or construct a CSS value with the desired order) and then interact with each primitive appropriately.

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list