Closed
Bug 4483
Opened 26 years ago
Closed 26 years ago
{css spec} Incorrect vertical collapsing of nested margins
Categories
(Core :: Layout, defect, P5)
Tracking
()
VERIFIED
INVALID
M6
People
(Reporter: ian, Assigned: buster)
References
()
Details
On the quoted test page, some vertically collapsed margins become transparent
all the way to the canvas, instead of being only transparent to the parent.
For example, in the following markup:
<DIV style="border: solid 8px black; padding: 0;">
<DIV style="background: yellow; margin: 0;">
<DIV style="margin: 8px;">
</DIV>
</DIV>
</DIV>
...the inner DIV correctly collapses away, leaving only one set of 8px margins.
The colour of those margins, quite clearly, should be yellow. (This is because
margins are transparent and the inner DIV's container is yellow).
However, NGLayout of 1999-03-31 uses the BODY colour to draw that inner 8px bar.
Comment 1•26 years ago
|
||
Ian - I don't think this should be yellow, because the height changes according
to the *errata* to section 10.6.3. These basically say that the margins always
collapse, even if one is zero, and the resulting margins are applied to the
outermost box. However, the errata don't quite cover this case. Do you want to
write some errata errata for www-style, or should I?
I don't have NGLayout in front of me right now, so I'm not looking at the test.
The correct height of the middle div is either 0, -8px, or -\infty, depending on
how you interpret the 10.6.3 errata. It's not +8px.
If you agree, resolve the bug as invalid.
By the way, that was hakon's interpretation as well (he had created a test way
back in november that indicated how margins should work).
Severity: normal → critical
Priority: P3 → P5
Summary: Vertically collapsed margins lose background → {css spec} Vertically collapsed margins lose background
Reporter | ||
Updated•26 years ago
|
Summary: {css spec} Vertically collapsed margins lose background → {css spec} Incorrect vertical collapsing of nested margins
Whiteboard: (py8ieh: need tests for 10.6.3.errata)
Reporter | ||
Comment 3•26 years ago
|
||
Ah, I see. In that case, there _is_ a bug, but a different one.
For the purposes of clarity, let us use the following simplified snippet:
<A style="background: yellow; margin: 0;">
<B style="margin: 8px;"> </B>
</A>
1. The content height of B is zero.
2. The content height of A is from B's top border edge to B's bottom
border edge. This is zero (since the height of B is zero, meaning
that the top and bottom border edges touch).
Kipp - you are currently not collapsing the margins as described in:
http://www.w3.org/Style/css2-updates/REC-CSS2-19980512-errata.html
...section 10.6.3.
I will investigate this further soon. Expect the test page to be updated
within the next 48 hours.
Reporter | ||
Updated•26 years ago
|
Whiteboard: (py8ieh: need tests for 10.6.3.errata)
Reporter | ||
Comment 4•26 years ago
|
||
Well, it wasn't 48 hours, more like three weeks. :-/
The new test page:
http://www.bath.ac.uk/%7Epy8ieh/internet/eviltests/collapsemargins.html
...is very detailed in its explanations.
The problem is centered around section 10.6.3, as corrected by the errata
document. The relevant part of the corrected text reads:
# If [a block] has block-level children, the height is the distance
# between the top border-edge of the topmost block-level child box
# and the bottom border-edge of the bottommost block-level child box.
In other words, margin-top on the top element and margin-bottom on the last
element _should be ignored_ if the parent has neither padding nor borders.
NGLayout is not doing this.
Incidentally, in the previous comment section, elements A and B are assumed to
have display:block.
[updating uri; ccing david as he may wish to examine the tests]
Comment 5•26 years ago
|
||
Ian -
I think NGLayout is correct for everything except the first part of test 1,
where the rendering is undefined, since there is no content.
The margins still collapse, they don't disappear. All 10.6.3 says is *where*
the collapsed margins go. It says that if you have elements a and b with
collapsed margins:
<a>
<b>
Stuff
</b>
</a>
Then if their margins collapse (which doesn't necessarily happen), then the
resulting margin is placed *outside* of a so that a's height is the distance
from the top border-edge of b to the bottom border-edge of b.
Reporter | ||
Updated•26 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 26 years ago
Resolution: --- → INVALID
Whiteboard: (py8ieh: update test page and verify invalid)
Reporter | ||
Comment 6•26 years ago
|
||
Oh I _see_. Well that makes a whole lot more sense.
Sorry for being so dumb about this. :-/
In that case, NGL is doing the right thing throughout. I will correct the test
page later (probably 1999-04-26) and verify that NGL is indeed doing the right
thing at the same time.
Note. Based on the explanation above, the rendering for the first part of
test 1 _is_ defined: The 8px margins of the inner DIV extend either side of
the middle DIV, which has height of zero (as has the inner DIV). Since by this
time the margins of the inner and middle DIVs overlap, that means that the
margins of the middle DIV are equivalent to 8px each side. Since the sides are
adjacent, they are collapsed to 8px. Hence the outer DIV has an 8px gap between
its top padding edge and its bottom padding edge. This gap is filled with the
DIV's background colour, which is transparent. NGL does exactly this.
Reporter | ||
Updated•26 years ago
|
Status: RESOLVED → VERIFIED
Whiteboard: (py8ieh: update test page and verify invalid)
Reporter | ||
Comment 7•26 years ago
|
||
Yup, NGL is fine. Test page completely fixed.
You need to log in
before you can comment on or make changes to this bug.
Description
•