<?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>5531</bug_id>
          
          <creation_ts>2005-10-28 03:24:15 -0700</creation_ts>
          <short_desc>1px gap appears between percent-sized floats adding to 100%</short_desc>
          <delta_ts>2022-07-06 13:12:13 -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>412</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc>http://problemattic.net/files/round-error.html</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Minor</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>5164</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Matt Wilson">matt</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>ian</cc>
    
    <cc>leviw</cc>
    
    <cc>robert</cc>
    
    <cc>scheglov</cc>
    
    <cc>waldelefant+bugzilla</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>23114</commentid>
    <comment_count>0</comment_count>
    <who name="Matt Wilson">matt</who>
    <bug_when>2005-10-28 03:24:15 -0700</bug_when>
    <thetext>With two floats, widths 22% and 78%, and floated in opposite directions, a 1 pixel gap appears between 
them. 22 + 78 = 100, therefore there should be no gap. Likely a rounding problem.

Expected result: no gap
Actual result: 1 pixel gap</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23118</commentid>
    <comment_count>1</comment_count>
      <attachid>4507</attachid>
    <who name="Matt Wilson">matt</who>
    <bug_when>2005-10-28 03:26:30 -0700</bug_when>
    <thetext>Created attachment 4507
Test Case/Reduction for bug</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>23235</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2005-10-29 10:50:04 -0700</bug_when>
    <thetext>Firefox 1.0.5, MacIE and WinIE render the test without a gap; Opera 8.50 renders it like Safari.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26865</commentid>
    <comment_count>3</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2005-12-27 15:44:29 -0800</bug_when>
    <thetext>Yes, we use integers for storing these sorts of values.  It&apos;s possible this might also be due to the QRect 
width/height off-by-one confusion found so often in our code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>16042</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2007-03-31 11:42:39 -0700</bug_when>
    <thetext>Actually, Firefox 1.5 doesn&apos;t always render this test case without a gap: it appears at certain page widths.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11401</commentid>
    <comment_count>5</comment_count>
    <who name="Li Luo">waldelefant+bugzilla</who>
    <bug_when>2007-05-03 07:53:43 -0700</bug_when>
    <thetext>This bug also appears, if both divs are floated with left. The gab appears simply at end (i.e. right) of the line.

Also it seems the bug does not depend on the values (22%, 78%). For example: use 50%, 50% as width. you will also see a gab at end. If you don&apos;t, resize the window and you will see the gab. Possibly it depends on whether the window&apos;s width can be divided integrally in 50%, 50%.

The gab becomes bigger with number of the divs.


This bug is quite anoying for peoples who try to eliminate tables from their layouts XD</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>11402</commentid>
    <comment_count>6</comment_count>
      <attachid>14318</attachid>
    <who name="Li Luo">waldelefant+bugzilla</who>
    <bug_when>2007-05-03 08:03:01 -0700</bug_when>
    <thetext>Created attachment 14318
testcase with more than two divs

a testcase for last comment of mine.

Four divs floated within a container (div). You see a gap at the end of the line/container. The gap&apos;s size changes (kind of flicker), if you resize the window.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>473123</commentid>
    <comment_count>7</comment_count>
    <who name="Konstantin Shcheglov">scheglov</who>
    <bug_when>2011-09-26 08:53:06 -0700</bug_when>
    <thetext>Just for records.
Problem is that integer type is used to store width and location.
So, when Length::calcMinValue  calculates:
return static_cast&lt;int&gt;(static_cast&lt;float&gt;(maxValue * percent() / 100.0f));

For maxValue=201px we get 100 for one float 50% and for another float 50%.
So, we get 1px gap at the right.

I&apos;m not sure how to solve this without using floating point.
It seems that Firefox uses floating point here, because it shows 100.5px in calculated style.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>478546</commentid>
    <comment_count>8</comment_count>
    <who name="Konstantin Shcheglov">scheglov</who>
    <bug_when>2011-10-05 11:41:11 -0700</bug_when>
    <thetext>May be https://bugs.webkit.org/show_bug.cgi?id=60318 will fix this, or at least will make solution easier.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>746427</commentid>
    <comment_count>9</comment_count>
    <who name="Robert Hogan">robert</who>
    <bug_when>2012-10-19 10:36:48 -0700</bug_when>
    <thetext>Both test cases look fine to me as of r131397. Can the reporters confirm and we can close?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>746994</commentid>
    <comment_count>10</comment_count>
    <who name="Matt Wilson">matt</who>
    <bug_when>2012-10-20 14:26:00 -0700</bug_when>
    <thetext>I just tested in r131989, and my two-div test case still shows the problem. There should be no white space between the two divs.

(Note that resizing your browser window will cause the gap to appear and disappear at certain points.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>746997</commentid>
    <comment_count>11</comment_count>
    <who name="Li Luo">waldelefant+bugzilla</who>
    <bug_when>2012-10-20 14:40:14 -0700</bug_when>
    <thetext>I see gaps in both test cases, running r131989 on 10.8</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>747058</commentid>
    <comment_count>12</comment_count>
    <who name="Robert Hogan">robert</who>
    <bug_when>2012-10-21 02:33:36 -0700</bug_when>
    <thetext>I though all ports were using subpixel precision but maybe that&apos;s not the case - http://trac.webkit.org/wiki/LayoutUnit.

Adding Levi as this seems subpixel-related - and I can&apos;t recreate on Chrome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1881062</commentid>
    <comment_count>13</comment_count>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2022-07-06 13:11:45 -0700</bug_when>
    <thetext>Safari, Firefox, and Chrome match behavior here. Both test cases work identically on all browsers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1881063</commentid>
    <comment_count>14</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-07-06 13:12:13 -0700</bug_when>
    <thetext>&lt;rdar://problem/96543246&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>4507</attachid>
            <date>2005-10-28 03:26:30 -0700</date>
            <delta_ts>2005-10-28 03:26:30 -0700</delta_ts>
            <desc>Test Case/Reduction for bug</desc>
            <filename>round-error.html</filename>
            <type>text/html</type>
            <size>775</size>
            <attacher name="Matt Wilson">matt</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWwgUFVCTElDICItLy9XM0MvL0RURCBYSFRNTCAxLjAgU3RyaWN0Ly9FTiIg
DSJodHRwOi8vd3d3LnczLm9yZy9UUi94aHRtbDEvRFREL3hodG1sMS1zdHJpY3QuZHRkIj4NPGh0
bWwgeG1sbnM9Imh0dHA6Ly93d3cuYXBwbGUuY29tLzIwMDQveGh0bWwtZXh0ZW5kZWQvIj4NPGhl
YWQ+DQk8bWV0YSBodHRwLWVxdWl2PSJDb250ZW50LVR5cGUiIGNvbnRlbnQ9InRleHQvaHRtbDsg
Y2hhcnNldD1VVEYtOCIgLz4NCTx0aXRsZT5QZXJjZW50IFJvdW5kaW5nIEVycm9yIEJ1ZzogVGVz
dCBDYXNlPC90aXRsZT4KCTxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+CiAgICAgICAgI2xhcmdlIHsK
ICAgICAgICAgICAgd2lkdGg6IDc4JTsKICAgICAgICAgICAgZmxvYXQ6IGxlZnQ7CiAgICAgICAg
ICAgIGJhY2tncm91bmQtY29sb3I6ICMwMDA7CiAgICAgICAgICAgIGNvbG9yOiAjZmZmOwogICAg
ICAgIH0KICAgICAgICAKICAgICAgICAjc21hbGwgewogICAgICAgICAgICB3aWR0aDogMjIlOwog
ICAgICAgICAgICBmbG9hdDogcmlnaHQ7CiAgICAgICAgICAgIGJhY2tncm91bmQtY29sb3I6ICMz
MzM7CiAgICAgICAgICAgIGNvbG9yOiAjZmZmOwogICAgICAgIH0KCTwvc3R5bGU+DTwvaGVhZD4N
PGJvZHk+CiAgICAgICAgPGRpdiBpZD0ibGFyZ2UiPgogICAgICAgICAgICBEaXYgMQogICAgICAg
IDwvZGl2PgogICAgICAgIAogICAgICAgIDxkaXYgaWQ9InNtYWxsIj4KICAgICAgICAgICAgRGl2
IDIKICAgICAgICA8L2Rpdj4NPC9ib2R5Pg08L2h0bWw+DQ==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>14318</attachid>
            <date>2007-05-03 08:03:01 -0700</date>
            <delta_ts>2007-05-03 08:03:01 -0700</delta_ts>
            <desc>testcase with more than two divs</desc>
            <filename>index.htm</filename>
            <type>text/html</type>
            <size>504</size>
            <attacher name="Li Luo">waldelefant+bugzilla</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMDEvL0VOIiAiaHR0cDov
L3d3dy53My5vcmcvVFIvaHRtbDQvc3RyaWN0LmR0ZCI+CjxodG1sPgo8aGVhZD4KPG1ldGEgaHR0
cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9aXNvLTg4
NTktMSIgLz4KPHN0eWxlPgoKLmNvbHMgewoJb3ZlcmZsb3c6IGhpZGRlbjsKCWJvcmRlcjogMXB4
IHNvbGlkICMwOGY7Cn0KCi5jb2xzID4gZGl2IHsKCWZsb2F0OiBsZWZ0OwoJd2lkdGg6IDI1JTsK
fQoKLmNvbHMgPiBkaXYgPiBkaXYgewoJYm9yZGVyOiAxcHggc29saWQgcmVkOwp9Cgo8L3N0eWxl
Pgo8L2hlYWQ+Cjxib2R5Pgo8ZGl2IGNsYXNzPSJjb2xzIj4KPGRpdj48ZGl2PiAxIDwvZGl2Pjwv
ZGl2Pgo8ZGl2PjxkaXY+IDIgPC9kaXY+PC9kaXY+CjxkaXY+PGRpdj4gMyA8L2Rpdj48L2Rpdj4K
PGRpdj48ZGl2PiA0IDwvZGl2PjwvZGl2Pgo8L2Rpdj4KPC9ib2R5Pgo8L2h0bWw+
</data>

          </attachment>
      

    </bug>

</bugzilla>