<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>15535</bug_id>
          
          <creation_ts>2012-01-12 19:21:21 +0000</creation_ts>
          <short_desc>Specification for 3D getComputedStyle().transform does not match implementations</short_desc>
          <delta_ts>2012-03-12 21:32:58 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>CSS</product>
          <component>Transforms</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>15797</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Aryeh Gregor">ayg</reporter>
          <assigned_to name="Simon Fraser">smfr</assigned_to>
          <cc>ayg</cc>
    
    <cc>cmarrin</cc>
    
    <cc>dino</cc>
    
    <cc>dschulze</cc>
    
    <cc>eoconnor</cc>
    
    <cc>smfr</cc>
          
          <qa_contact name="This bug has no owner yet - up for the taking">dave.null</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>62609</commentid>
    <comment_count>0</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2012-01-12 19:21:21 +0000</bug_when>
    <thetext>&quot;&quot;&quot;
In addition to the interfaces listed above, the getComputedStyle method of the Window object has been updated. The transform property of the style object returned by getComputedStyle contains a single CSSTransformValue with a type of CSS_MATRIX3D. The 16 parameters represent the 4x4 matrix that is the result of applying the individual functions listed in the transform property.
&quot;&quot;&quot;
http://dev.w3.org/csswg/css3-3d-transforms/#dom-interfaces

This says getComputedStyle().transform should be an object rather than string in the 3D case.  But the test-case

data:text/html,&lt;!doctype html&gt;
&lt;body style=&quot;transform:rotateX(90deg)&quot;&gt;
&lt;script&gt;
document.documentElement.textContent =
typeof getComputedStyle(document.body).transform
+ &quot; &quot;
+ getComputedStyle(document.body).transform
&lt;/script&gt;

(adjusted for vendor prefixes) outputs

  string matrix3d(1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0px, 0px, 0px, 1)

or something close to it in both Firefox 12.0a1 and Chrome 17 dev.  (I wasn&apos;t able to test IE10.)  This matches the behavior of transform in the 2D case, and also every other CSS property I&apos;m aware of.  CSSOM gives DOMString as the type for all the properties it discusses: http://dev.w3.org/csswg/cssom/#cssstyledeclaration

I suggest the spec be changed to require that if the matrix is of the form

  [a c 0 e
   b d 0 f
   0 0 1 0
   0 0 0 1]

then the output be a DOMString &quot;matrix(a, b, c, d, e, f)&quot;.  Otherwise it should be &quot;matrix3d(...)&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63414</commentid>
    <comment_count>1</comment_count>
    <who name="Dirk Schulze">dschulze</who>
    <bug_when>2012-01-31 18:20:48 +0000</bug_when>
    <thetext>We should have more functionality for CSS Transforms in general and not differ between 2D or 3D at all. I created a Wiki http://www.w3.org/Graphics/fx/wiki/Merged_Transforms#CSSOM_issues with some issues on CSS OM and wanted to discuss that on the next CSS WG meeting or FX meeting.

But I used getComputedStyle(element).getPropertyCSSValue(&apos;transform&apos;) for my research. Why should the transform property return a matrix and not a list of the transformation functions, all objects?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63415</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Fraser">smfr</who>
    <bug_when>2012-01-31 18:28:20 +0000</bug_when>
    <thetext>I think it should return the transform list (with percentage values resolved, of course), but WebKit doesn&apos;t implement it this way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63444</commentid>
    <comment_count>3</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2012-01-31 20:56:28 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; We should have more functionality for CSS Transforms in general and not differ
&gt; between 2D or 3D at all.

2D behavior is already interoperable, and we don&apos;t want to break getComputedStyle() for existing sites that rely on 2D behavior.  So we have to switch between matrix() and matrix3d() as appropriate.

&gt; But I used getComputedStyle(element).getPropertyCSSValue(&apos;transform&apos;) for my
&gt; research.

As far as I can tell, getPropertyCSSValue() is nonstandard.  If someone standardizes it, we can talk about how it should behave, but not before then.

&gt; Why should the transform property return a matrix and not a list of
&gt; the transformation functions, all objects?

getComputedStyle()&apos;s properties are all strings, so &apos;transform&apos; shouldn&apos;t be any different.  If we want to expose nicer things like lists of transforms to authors, we should use some other API.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63450</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Fraser">smfr</who>
    <bug_when>2012-01-31 21:05:36 +0000</bug_when>
    <thetext>BTW, &quot;not matching implementations&quot; isn&apos;t necessarily a spec bug. The spec should describe what we want the behavior to be, not what it happens to be now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63534</commentid>
    <comment_count>5</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2012-02-01 16:35:32 +0000</bug_when>
    <thetext>If implementers want to change their behavior, yes, but it&apos;s rarely worth it for implementations to change when they&apos;re already interoperable, so I normally assume they don&apos;t want to change until proven otherwise.  Regardless, IMO it *should* be a string.  Every preexisting property on CSSStyleDeclaration that corresponds to a CSS property is a DOMString:

http://dev.w3.org/csswg/cssom/#the-cssstyledeclaration-interface

&apos;transform&apos; should not be treated differently from every existing property.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63539</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Fraser">smfr</who>
    <bug_when>2012-02-01 17:37:29 +0000</bug_when>
    <thetext>I&apos;m confused. We are talking about returning a string. The question is whether the string is &quot;matrix(....)&quot; or  &quot;translate(20px, 100px) scale(1.5)&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63540</commentid>
    <comment_count>7</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2012-02-01 17:59:41 +0000</bug_when>
    <thetext>Okay, I thought by &quot;transform list&quot; you meant &quot;CSSTransformList object&quot;.  I think that&apos;s what Dirk meant, based on &lt;http://www.w3.org/Graphics/fx/wiki/Merged_Transforms#CSSOM_issues&gt; and by the phrase &quot;all objects&quot; in comment #1.

It would very possibly have made sense to have the *string* be a list of transforms to start with, but it doesn&apos;t seem worth it to change now.  If implementers really want to change, that&apos;s okay with me, but we have almost complete interop at this point (modulo Gecko throwing in &quot;px&quot;, and slight disagreement about when to return &quot;none&quot;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65408</commentid>
    <comment_count>8</comment_count>
    <who name="Aryeh Gregor">ayg</who>
    <bug_when>2012-03-12 21:32:58 +0000</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 15797 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>