<?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>16036</bug_id>
          
          <creation_ts>2012-02-20 18:04:59 +0000</creation_ts>
          <short_desc>Margin collapsing: pathological collapsing behaviour for auto-height, non-zero min-height elements with self-collapsing child (Issue 211)</short_desc>
          <delta_ts>2012-05-21 16:31:01 +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>CSS Level 2</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>ASSIGNED</bug_status>
          <resolution></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="Anton P">antonsforums</reporter>
          <assigned_to name="Bert Bos">bert</assigned_to>
          
          
          <qa_contact>public-css-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>64313</commentid>
    <comment_count>0</comment_count>
    <who name="Anton P">antonsforums</who>
    <bug_when>2012-02-20 18:04:59 +0000</bug_when>
    <thetext>Reported by David Baron.

The 2010-12-07 WD (http://www.w3.org/TR/2010/WD-CSS2-20101207/box.html#collapsing-margins) and some previous CRs contained an internal contradiction in the case of an auto-height, non-zero min-height element with a single self-collapsing child.  Section 8.3.1 said:

  % The bottom margin of an in-flow block box with a &apos;height&apos; of &apos;auto&apos;
  % is adjoining to its last in-flow block-level child&apos;s bottom margin
  % if the element has no bottom padding or border.
  % 
  % An element&apos;s own margins are adjoining if the &apos;min-height&apos; property
  % is zero, and it has neither top or bottom borders nor top or bottom
  % padding, and it has a &apos;height&apos; of either 0 or &apos;auto&apos;, and it does
  % not contain a line box, and all of its in-flow children&apos;s margins
  % (if any) are adjoining.

The former paragraph says that the parent&apos;s bottom margin adjoins the child&apos;s bottom margin (which adjoins its own top margin which adjoins the parent&apos;s top margin [via other rules not quoted here]).  Yet the latter paragraph doesn&apos;t cover the case in question (since min-height is non-zero) and so the implication is that that the parent&apos;s top and bottom margin are not adjoining; this was either a contradiction (if one believes that adjointness was implicitly transitive) or else it was the exact same problem that the current spec, with its new wording and terminology, now explicitly suffers from:

In the current spec, 8.3.1 (Collapsing margins) says:

  # Adjoining vertical margins collapse, except [omitted special cases]
  # [...]
  #
  # Two margins are adjoining if and only if:
  # [omitted conditions]
  # * both belong to vertically-adjacent box edges, i.e. form one of
  # the following pairs:
  #   - top margin of a box and top margin of its first in-flow child
  #   [omitted pair]
  #   - bottom margin of a last in-flow child and bottom margin of
  #     its parent if the parent has &apos;auto&apos; computed height
  #   - top and bottom margins of a box that does not establish a new
  #     block formatting context and that has zero computed &apos;min-height&apos;,
  #     zero or &apos;auto&apos; computed &apos;height&apos;, and no in-flow children
  #
  # A collapsed margin is considered adjoining to another margin if any
  # of its component margins is adjoining to that margin. 

So in the case being discussed, the parent&apos;s bottom margin adjoins the child&apos;s bottom margin, which adjoins its own top margin which adjoins the parent&apos;s top margin... and rather than this resulting in a contradiction, it simply means that all margins explicitly collapse together, a pathalogical behaviour given that the parent has non-zero used height.


A sensible resolution which handles this case is needed.



Issue 211: http://wiki.csswg.org/spec/css2.1#issue-211

Summary
    Transitivity error in margin collapsing
URI
    http://lists.w3.org/Archives/Public/www-style/2010Sep/0439.html
    http://lists.w3.org/Archives/Public/www-style/2010Sep/0451.html
Status
    Open. =errata= Deferred to Errata</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>64319</commentid>
    <comment_count>1</comment_count>
    <who name="Anton P">antonsforums</who>
    <bug_when>2012-02-20 20:08:54 +0000</bug_when>
    <thetext>At the F2F in Paris 2012
[http://lists.w3.org/Archives/Public/www-style/2012Feb/0529.html] it was tentatively decided to prevent collapsing in the case described:

Replace:

  #   - bottom margin of a last in-flow child and bottom margin of its
  #     parent if the parent has &apos;auto&apos; computed height

with:

  |   - bottom margin of a last in-flow child and bottom margin of its
  |     parent if the parent has &apos;auto&apos; computed height and either the
  |     parent has a zero computed min-height or the bottom margin of
  |     the last in-flow child does not collapse with the top margin of
  |     the parent


See also the proposals in Bug 16037.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66616</commentid>
    <comment_count>2</comment_count>
    <who name="Anton P">antonsforums</who>
    <bug_when>2012-04-11 15:56:17 +0000</bug_when>
    <thetext>An updated proposal is: [http://lists.w3.org/Archives/Public/www-style/2012Mar/0052.html]

Add a new bullet to:
   # &quot;Adjoining vertical margins collapse, except:&quot;

   | - If the top margin of a box with non-zero computed &apos;min-height&apos;
   |   and &apos;auto&apos; computed &apos;height&apos; collapses with the bottom margin of
   |   its last in-flow child, then the child&apos;s bottom margin does not
   |   collapse with the parent&apos;s bottom margin.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67971</commentid>
    <comment_count>3</comment_count>
    <who name="Anton P">antonsforums</who>
    <bug_when>2012-05-21 16:25:53 +0000</bug_when>
    <thetext>The WG resolved to accept the change in Comment 2 to close this issue.

Minutes of resolution: http://lists.w3.org/Archives/Public/www-style/2012Apr/0101.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>67974</commentid>
    <comment_count>4</comment_count>
      <attachid>1132</attachid>
    <who name="Anton P">antonsforums</who>
    <bug_when>2012-05-21 16:31:01 +0000</bug_when>
    <thetext>Created attachment 1132
testcase</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1132</attachid>
            <date>2012-05-21 16:31:01 +0000</date>
            <delta_ts>2012-05-21 16:31:01 +0000</delta_ts>
            <desc>testcase</desc>
            <filename>testcase_bug-16036.html</filename>
            <type>text/html</type>
            <size>591</size>
            <attacher name="Anton P">antonsforums</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxoZWFkPg0KCTx0aXRsZT5UZXN0Y2FzZSBmb3IgQnVn
IDE2MDM2PC90aXRsZT4NCjwvaGVhZD4NCjxib2R5Pg0KPGRpdiBjbGFzcz0idGVzdC1jb25kaXRp
b24iPg0KCTxwPlRoZXJlIHNob3VsZCBiZSB0d28gc29saWQgZ3JlZW4gc3F1YXJlcyBhbmQgbm8g
cmVkIG9uIHRoaXMgcGFnZTwvcD4NCjwvZGl2Pg0KDQo8ZGl2IGlkPSJjb250YWluZXIiIHN0eWxl
PSJ3aWR0aDo1MHB4OyBoZWlnaHQ6NTBweDsgYm9yZGVyLXRvcDoxcHggc29saWQgdHJhbnNwYXJl
bnQ7IGJvcmRlci1ib3R0b206MTAwcHggc29saWQgcmVkOyBiYWNrZ3JvdW5kOmdyZWVuIj4NCgk8
ZGl2IGlkPSJwYXJlbnQiIHN0eWxlPSJoZWlnaHQ6YXV0bzsgbWluLWhlaWdodDo1MHB4OyBiYWNr
Z3JvdW5kLWNvbG9yOndoaXRlOyI+DQoJCTxkaXYgaWQ9ImNoaWxkIiBzdHlsZT0ibWFyZ2luLWJv
dHRvbTo1MHB4Ij48L2Rpdj4NCgk8L2Rpdj4NCgk8ZGl2IGlkPSJmb2xsb3dpbmctc2libGluZyIg
c3R5bGU9ImhlaWdodDo1MHB4OyBiYWNrZ3JvdW5kLWNvbG9yOmdyZWVuIj48L2Rpdj4NCjwvZGl2
Pg0KDQo8L2JvZHk+DQo8L2h0bWw+
</data>

          </attachment>
      

    </bug>

</bugzilla>