<?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>54613</bug_id>
          
          <creation_ts>2011-02-16 20:56:51 -0800</creation_ts>
          <short_desc>percentage based margin-top for an absolute positioned element is incorrectly computed based on the height of the viewport.</short_desc>
          <delta_ts>2012-12-14 17:07:18 -0800</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>All</rep_platform>
          <op_sys>All</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Philippe Wittenbergh">phiw2</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>betravis</cc>
    
    <cc>drophierjespam</cc>
    
    <cc>paroga</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>352594</commentid>
    <comment_count>0</comment_count>
      <attachid>82750</attachid>
    <who name="Philippe Wittenbergh">phiw2</who>
    <bug_when>2011-02-16 20:56:51 -0800</bug_when>
    <thetext>Created attachment 82750
test case

An absolute positioned element whose containing block is the viewport (initial containing block) has percentages for its margin-top computed based on the height of the viewport (instead of the width).

Css 2.1:8.3 is formal in specifying that percentages for margin (and padding) are computed based on the *width* of the containing block.
http://www.w3.org/TR/CSS21/box.html#propdef-margin

In the testcase, the div has a 5% margin-top. Widening or narrowing the window horizontally doesn’t change the position of the block.

Gecko and Opera behave correctly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>352606</commentid>
    <comment_count>1</comment_count>
      <attachid>82755</attachid>
    <who name="Philippe Wittenbergh">phiw2</who>
    <bug_when>2011-02-16 21:29:18 -0800</bug_when>
    <thetext>Created attachment 82755
test case 2

There should be no red in this test case (resize window vertically…)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>354180</commentid>
    <comment_count>2</comment_count>
    <who name="Patrick R. Gansterer">paroga</who>
    <bug_when>2011-02-19 08:52:09 -0800</bug_when>
    <thetext>Reproduced with r79118.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>526848</commentid>
    <comment_count>3</comment_count>
    <who name="Mattijs">drophierjespam</who>
    <bug_when>2011-12-23 06:35:47 -0800</bug_when>
    <thetext>I can confirm that this bug is still there. Tested on Safari 5.1.1 (6534.51.22) and Chrome 16.0.912.63</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>613102</commentid>
    <comment_count>4</comment_count>
      <attachid>139552</attachid>
    <who name="Alexandre">alex2champeaux</who>
    <bug_when>2012-04-30 17:46:11 -0700</bug_when>
    <thetext>Created attachment 139552
test case 3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>613107</commentid>
    <comment_count>5</comment_count>
      <attachid>139552</attachid>
    <who name="Alexandre">alex2champeaux</who>
    <bug_when>2012-04-30 17:50:12 -0700</bug_when>
    <thetext>Comment on attachment 139552
test case 3

Tested on  30 April 2012 webkit night build on Mac OSX.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>686723</commentid>
    <comment_count>6</comment_count>
      <attachid>156378</attachid>
    <who name="Mark Rabjohn">mark</who>
    <bug_when>2012-08-03 07:30:35 -0700</bug_when>
    <thetext>Created attachment 156378
This clearly shows percentage as being calculated as 50% of height of parent, not width of parent.

This shows margin-top configured relative to parent element. On compliant browser, the green box is outside the red box. On Chrome and Safari, the green box is fully inside of the red box.

This clearly shows percentage as being calculated as 50% of height of parent, not width of parent.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>791702</commentid>
    <comment_count>7</comment_count>
    <who name="Bear Travis">betravis</who>
    <bug_when>2012-12-14 10:43:11 -0800</bug_when>
    <thetext>I believe this has been fixed with bug 103246 and can be closed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>791984</commentid>
    <comment_count>8</comment_count>
    <who name="Philippe Wittenbergh">phiw2</who>
    <bug_when>2012-12-14 17:07:18 -0800</bug_when>
    <thetext>Yes this does work correctly now. Thanks!

Tested with WebKit nightly @r137751, the attached test cases and my real world usage work as expected.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>82750</attachid>
            <date>2011-02-16 20:56:51 -0800</date>
            <delta_ts>2011-02-16 20:56:51 -0800</delta_ts>
            <desc>test case</desc>
            <filename>ap-marginTop-percent.html</filename>
            <type>text/html</type>
            <size>478</size>
            <attacher name="Philippe Wittenbergh">phiw2</attacher>
            
              <data encoding="base64">PCFkb2N0eXBlIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KPGhlYWQ+CjxtZXRhIGNoYXJzZXQ9InV0
Zi04Ij4KPHRpdGxlPnRlc3Q6IHBvc2l0aW9uOiBhYnNvbHV0ZSDigJMgcGVyY2VudGFnZSBiYXNl
ZCBtYXJnaW5zPC90aXRsZT4KPCEtLTxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0
aD1kZXZpY2Utd2lkdGg7IGluaXRpYWwtc2NhbGU9MS4wOyAiPi0tPgoKPHN0eWxlIHR5cGU9InRl
eHQvY3NzIj4KCmh0bWwgewoJYmFja2dyb3VuZDogcmdiKDI1MCwyNTAsMjUwKTsKCQp9Cgpib2R5
eyBtYXJnaW46MDsgfQoKZGl2IHsKCWJhY2tncm91bmQ6IGdyYXk7Cgl3aWR0aDogMzAlOwoJaGVp
Z2h0OiAxNTBweDsKCXBvc2l0aW9uOiBhYnNvbHV0ZTsKCS8qcmlnaHQ6IDA7Ki8KCS8qdG9wOiAw
OyovCgltYXJnaW4tdG9wOiA1JTsKCX0KPC9zdHlsZT4KCgo8L2hlYWQ+Cgo8Ym9keT4KCjxkaXY+
PC9kaXY+CjwvYm9keT4KPC9odG1sPg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>82755</attachid>
            <date>2011-02-16 21:29:18 -0800</date>
            <delta_ts>2011-02-16 21:29:18 -0800</delta_ts>
            <desc>test case 2</desc>
            <filename>ap-marginTop-percent2.html</filename>
            <type>text/html</type>
            <size>541</size>
            <attacher name="Philippe Wittenbergh">phiw2</attacher>
            
              <data encoding="base64">PCFkb2N0eXBlIGh0bWw+CjxodG1sIGxhbmc9ImVuIj4KPGhlYWQ+CjxtZXRhIGNoYXJzZXQ9InV0
Zi04Ij4KPHRpdGxlPnRlc3Q6IHBvc2l0aW9uOiBhYnNvbHV0ZSDigJMgcGVyY2VudGFnZSBiYXNl
ZCBtYXJnaW5zPC90aXRsZT4KPCEtLTxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0
aD1kZXZpY2Utd2lkdGg7IGluaXRpYWwtc2NhbGU9MS4wOyAiPi0tPgoKPHN0eWxlIHR5cGU9InRl
eHQvY3NzIj4KCmh0bWwgewoJYmFja2dyb3VuZDogcmdiKDI1MCwyNTAsMjUwKTsKCQp9Cgpib2R5
eyBtYXJnaW46MDsgfQoKZGl2IHsKCXdpZHRoOiAzMCU7CgloZWlnaHQ6IDE1MHB4OwoJbWFyZ2lu
LWxlZnQ6IDA7CgltYXJnaW4tdG9wOiA1JTsKfQouYSB7CgliYWNrZ3JvdW5kOiBncmVlbjsKCXBv
c2l0aW9uOiBhYnNvbHV0ZTsKCXRvcDogMDsKCX0KLmIgeyBiYWNrZ3JvdW5kOiByZWQ7IH0KPC9z
dHlsZT4KCgo8L2hlYWQ+Cgo8Ym9keT4KCjxkaXYgY2xhc3M9ImEiPjwvZGl2Pgo8ZGl2IGNsYXNz
PSJiIj48L2Rpdj4KCjwvYm9keT4KPC9odG1sPg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>139552</attachid>
            <date>2012-04-30 17:46:11 -0700</date>
            <delta_ts>2012-04-30 17:50:12 -0700</delta_ts>
            <desc>test case 3</desc>
            <filename>margin-bug.html</filename>
            <type>text/html</type>
            <size>609</size>
            <attacher name="Alexandre">alex2champeaux</attacher>
            
              <data encoding="base64">PERPQ1RZUEUgaHRtbD4KPGhlYWQ+CjxzdHlsZT4gCglodG1sLGJvZHl7CgkJd2lkdGg6MTAwJTsK
CQloZWlnaHQ6MTAwJTsKICAgICAgICBtYXJnaW46MDsKICAgICAgICBwYWRkaW5nOjA7Cgl9CgoJ
Ym9keXsKCQliYWNrZ3JvdW5kLWNvbG9yOmJsdWU7Cgl9CiAgICAKICAgIC5jb250YWluZXJ7CiAg
ICAgICAgd2lkdGg6MTAwJTsKICAgICAgICBoZWlnaHQ6MTAlOwogICAgICAgIGJhY2tncm91bmQt
Y29sb3I6Z3JlZW47CiAgICAgICAgcG9zaXRpb246cmVsYXRpdmU7CiAgICAgICAgdG9wOjA7CiAg
ICAgICAgbGVmdDowOwogICAgfQogICAgCiAgICAuY29udGVudHsKICAgICAgICB3aWR0aDoxMDBw
eDsKICAgICAgICBoZWlnaHQ6MTAwcHg7CiAgICAgICAgYmFja2dyb3VuZC1jb2xvcjpyZWQ7CiAg
ICAgICAgbWFyZ2luLXRvcDoxMDAlOwogICAgICAgIHBvc2l0aW9uOmFic29sdXRlOyAgCiAgICB9
Cjwvc3R5bGU+Cgo8L2hlYWQ+Cjxib2R5PgoJPGRpdiBjbGFzcz0iY29udGFpbmVyIj4KICAgIDwh
LS0gSSBzaG91bGQgYmUgYXQgdGhlIGJvdHRvbSBvZiB0aGUgcGFnZS0tPgoJCTxkaXYgY2xhc3M9
ImNvbnRlbnQiPgoJCQoJCTwvZGl2PgkKCTwvZGl2Pgo8L2JvZHk+
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>156378</attachid>
            <date>2012-08-03 07:30:35 -0700</date>
            <delta_ts>2012-08-03 07:30:35 -0700</delta_ts>
            <desc>This clearly shows percentage as being calculated as 50% of height of parent, not width of parent.</desc>
            <filename>default.htm</filename>
            <type>text/html</type>
            <size>309</size>
            <attacher name="Mark Rabjohn">mark</attacher>
            
              <data encoding="base64">PGh0bWw+DQoJPGhlYWQ+DQoJCTx0aXRsZT5UZXN0PC90aXRsZT4NCgk8L2hlYWQ+DQoJPGJvZHk+
DQoJCTxkaXYgc3R5bGU9IndpZHRoOiAxMDAwcHg7IGhlaWdodDogNTAwcHg7IGJhY2tncm91bmQ6
IHJlZDsgcG9zaXRpb246IGFic29sdXRlOyI+DQoJCQk8ZGl2IHN0eWxlPSJ3aWR0aDogNTAwcHg7
IGhlaWdodDogMjUwcHg7IGJhY2tncm91bmQ6IGdyZWVuOyBwb3NpdGlvbjogYWJzb2x1dGU7IHRv
cDogMDsgbWFyZ2luLXRvcDogNTAlOyBtYXJnaW4tbGVmdDogNTAlIj4NCgkJCTwvZGl2Pg0KCQk8
L2Rpdj4NCgk8L2JvZHk+DQo8L2h0bWw+
</data>

          </attachment>
      

    </bug>

</bugzilla>