Re: [CSS2.1] Clarifying 8.3.1 Collapsing Margins

On 07/28/2010 08:56 PM, L. David Baron wrote:
>
>> Hm, need to add
>>   | * if one belongs to a last in-flow child and the other belongs to
>>   |   its parent, the parent's used height is not the result of a
>>   |   specified height constraint (via 'height', 'max-height', or
>>   |   'min-height').
>
> I agree you need to add something to this effect.
>
> However, what you propose adding here is a substantive change.  It
> makes 'max-height' have an effect on margin collapsing, and also
> significantly changes the way 'min-height' does.  I believe the
> current definitions of those are, in at least some regards, written
> quite carefully to avoid the spec having infinite loops or
> unsatisfiable constraints.  (For example, I believe your rule
> introduces an unsatisfiable constraint for some cases of elements
> with max-height and a last child with a negative margin, and also
> some cases of min-height and a last child with a positive margin.)
> We had significant discussions of such issues at some point in the
> past (possibly the Oslo F2F in August 2003, though likely not).

Sorry, it was sloppily worded. I'll try again. :)

I'm actually very surprised that min-height and max-height constraints
aren't introducing a break in adjoiningness. Like, it doesn't make sense
to me for the orange and yellow DIVs' margins to collapse in these cases:

<!DOCTYPE html>
<div style="border: solid green">
   <div style="max-height: 2em; margin-bottom: 1em; border-left: solid thick yellow;">
     <div style="height: 6em; margin-bottom: 4em; border-left: solid thick orange;">
     </div>
   </div>
</div>

<!DOCTYPE html>
<div style="border: solid green">
   <div style="min-height: 6em; margin-bottom: 1em; border-left: solid thick yellow;">
     <div style="height: 1em; margin-bottom: 4em; border-left: solid thick orange;">
     </div>
   </div>
</div>

But I suppose this was all discussed in detail before.

It does introduce a conflict with the "no non-empty content area"
clause, though, so I'll have to remove that.

> Also, the way you wrote it makes the definition of adjoining-ness
> non-transitive.  It absolutely needs to be transitive.
> ...
> One further note on transitivity [1]:  I've often thought that
> collapsing margins are easier to explain using a relation that's not
> transitive.  In other words, we could define adjoining as a
> nontransitive relation such that:
>  * the bottom margin of an element and the top margin of its next
>    sibling are adjoining when ...
>  * the top and bottom margins of an element are adjoining when ...
>  * the top margin of an element and the top margin of its first
>    in-flow child are adjoining when ...
>  * the bottom margin of an element's last in-flow child and the
>    element's bottom margin are adjoining when ...
> and then say that two margins A and B collapse when there is some
> sequence of margins beginning with A and ending with B such that
> each pair of adjacent margins in the sequence are adjoining.

I tried that at first, but it came out rather hard to follow.
Let me give this another spin and see what comes out...

> I'd note that the *current* rule in the spec regarding 'min-height'
> *also* violates transitivity of adjoining-ness, and I'm not entirely
> sure what it meant to say (or whether it should be there at all).

Take a look at the rewording and let me know if it makes sense now.

~fantasai

Received on Wednesday, 18 August 2010 08:11:49 UTC