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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>30238</bug_id>
          
          <creation_ts>2009-10-08 16:41:48 -0700</creation_ts>
          <short_desc>getComputedStyle-transform.html accidentally relies on float formatting details</short_desc>
          <delta_ts>2009-10-14 14:55:22 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CSS</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>18994</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Evan Martin">evan</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>darin</cc>
    
    <cc>simon.fraser</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>153565</commentid>
    <comment_count>0</comment_count>
    <who name="Evan Martin">evan</who>
    <bug_when>2009-10-08 16:41:48 -0700</bug_when>
    <thetext>Relevant code:
        // set one of our test transforms
        testBox.style.webkitTransform = curTest.transform;
        // read back computed style
        var oldTransform = window.getComputedStyle(testBox).webkitTransform;
        // set that matrix() back on the element
        testBox.style.webkitTransform = oldTransform;
        // read back computed style
        var computedTransform = window.getComputedStyle(testBox).webkitTransform;

Suppose the following.
In step 1, when when we apply the transform one of the elements of the underlying matrix ends up being 0.23000005.
In step 2, when we read it back as a string, WebKit passes it through a printf(), which prints it to 6 significant digits as &quot;0.230000&quot;.
In step 3, when we write it out again, that that string is parsed into the float 0.23.
In step 4, when it&apos;s read out again, it&apos;s now the string &quot;0.23&quot;.


I ran into this in fixing float handling.  I&apos;d like to remove the second two lines of the above code (the test input has a string for the expected output).  What do you think?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>153567</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2009-10-08 16:45:11 -0700</bug_when>
    <thetext>I think the test should stay the same, but we should round when printing the output and comparing with the expected values.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>153570</commentid>
    <comment_count>2</comment_count>
    <who name="Evan Martin">evan</who>
    <bug_when>2009-10-08 16:59:15 -0700</bug_when>
    <thetext>The strings in question look like
  &quot;matrix(1, 0.36397, -0.842288, 1, 0, 0)&quot;

So are you suggesting parsing those strings into separate fields?
Or can I read each field of the matrix as a float in js code, like by doing domnode.webKitTransform.&lt;something here&gt;?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>153572</commentid>
    <comment_count>3</comment_count>
    <who name="Evan Martin">evan</who>
    <bug_when>2009-10-08 17:05:41 -0700</bug_when>
    <thetext>Oh, I think I found a better option: printf is actually specified to have this behavior (where trailing significant digits are chopped if they are 0).  I think I can hack my float-printer to emulate it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>153573</commentid>
    <comment_count>4</comment_count>
    <who name="Evan Martin">evan</who>
    <bug_when>2009-10-08 17:06:49 -0700</bug_when>
    <thetext>(I still think the test is kinda wrong for the reason I mentioned though.)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>