W3C home > Mailing lists > Public > www-style@w3.org > May 2011

[css3-box] Sign error in collapsing of negative margins?

From: Simon Sapin <simon.sapin@kozea.fr>
Date: Tue, 17 May 2011 10:52:05 +0200
Message-ID: <4DD23735.4040000@kozea.fr>
To: www-style@w3.org
Dear list members,

As a part of WeasyPrint (an HTML/CSS to PDF converter: 
http://weasyprint.org) I am working on an implementation of CSS visual 
rendering. The project is still in very early stages: I have a 
mostly-working cascade, and am starting with the box model. I started 
with CSS 2.1, but I find the explanations in the Basic Box Model module 
of CSS3 much easier to follow.

While reading, I came across what seems to be a mistake. 
http://www.w3.org/TR/css3-box/#collapsing-margins says:

If a set of adjoining margins collapses, then the width of the resulting 
margin is M - N, where M is the maximum of the adjoining margins that 
are positive, or zero if there are none; and N is the minimum of the 
adjoining margins that are negative, or zero if there are none.

If I am reading right, N is negative or zero. When collapsing margins 
that are all negative, the resulting margin is 0 - N which is positive. 
I believe that either the resulting margin should be M + N, or N should 
be the maximum of the absolute values of margins that are negative.

For reference, CSS 2.1 
(http://www.w3.org/TR/CSS21/box.html#collapsing-margins) says:

When two or more margins collapse, the resulting margin width is the 
maximum of the collapsing margins' widths. In the case of negative 
margins, the maximum of the absolute values of the negative adjoining 
margins is deducted from the maximum of the positive adjoining margins. 
If there are no positive margins, the maximum of the absolute values of 
the adjoining margins is deducted from zero.

PS: what would be the right mailing-list to discuss not the specs 
themselves but their interpretation and implementation? Thanks.

Best regards,
-- 
Simon Sapin
Received on Tuesday, 17 May 2011 10:14:28 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:40 GMT