[Webkit-unassigned] [Bug 113305] New: getComputedStyle of -webkit-transform omits translateZ(0px)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 26 06:31:53 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=113305

           Summary: getComputedStyle of -webkit-transform omits
                    translateZ(0px)
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Layout and Rendering
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: johnme at chromium.org
                CC: alexis at webkit.org, skyostil at chromium.org


The following JS statement should be a no-op:

    el.style.WebkitTransform = getComputedStyle(el).WebkitTransform;

But if you have a transform of "translateY(48px) translateZ(0px)", getComputedStyle will return it as "matrix(1, 0, 0, 1, 0, 48)", which omits the translateZ(0px). Hence the statement above will cause the element to no longer be promoted to its own layer.

Not having its own layer will cause future transform changes to be less smooth on many ports (and on Chrome for Android it actually causes the layer to disappear completely, due to http://crbug.com/223903, though that should be fixed independently!).

Preventing round-tripping from getComputedStyle like this is bad, since AFAIK the only reliable way to stop a -webkit-transition (e.g. if the user touches an element that was sliding into position and starts dragging it) is to set the specified style to the computed style and then set -webkit-transition to none (if you just set -webkit-transition to none it'll snap to the specified style, i.e. to the end of the transition).

The workaround here is to do the following if you know the element was supposed to have its own layer:

    el.style.WebkitTransform = getComputedStyle(el).WebkitTransform + " translateZ(0)";

But we shouldn't require authors to do that...

-- 
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