<?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>126844</bug_id>
          
          <creation_ts>2014-01-12 08:14:09 -0800</creation_ts>
          <short_desc>Subpixel Layout: getComputedStyle rounds off fractional pixel values</short_desc>
          <delta_ts>2014-06-10 19:56:06 -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>Layout and Rendering</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac (Intel)</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</resolution>
          
          
          <bug_file_loc>http://codepen.io/desandro/pen/CEfJF</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>126283</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="David DeSandro">desandrocodes</reporter>
          <assigned_to name="alan">zalan</assigned_to>
          <cc>jonlee</cc>
    
    <cc>mathias</cc>
    
    <cc>m.goleb+bugzilla</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>966959</commentid>
    <comment_count>0</comment_count>
    <who name="David DeSandro">desandrocodes</who>
    <bug_when>2014-01-12 08:14:09 -0800</bug_when>
    <thetext>See example http://codepen.io/desandro/pen/CEfJF

The value of getComputedStyle( elem ).width is returned as 199px for an element that has CSS `width: 66.666%`, and it&apos;s parent element has `width: 300px`. Other browsers keep the fractional pixel value, i.e. 199.98px.  I expected the value to either have the fractional pixel, or round up to the nearest integer, instead of rounding off any fractional pixel value.

I imagine this behavior might be by design, as it 199px is the rendered width of the element, and it prevents rounding errors to overshoot the true value.  That said, I thought it was worth documenting.

I have found that using `calc()` values for `width` produces closer-to-expected values. So for that example, changing width to `calc( 100% * 2 /3 )` returns `200px`. See http://codepen.io/desandro/pen/CKwfd</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>969674</commentid>
    <comment_count>1</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2014-01-19 18:27:47 -0800</bug_when>
    <thetext>&lt;rdar://problem/15855798&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1014639</commentid>
    <comment_count>2</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2014-06-10 19:56:06 -0700</bug_when>
    <thetext>getComputedStyle( box ).width now returns 199.984375px as expected. This has been fixed by one of the patches while transitioning to subpixel rendering.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>