Add parent-first-child top and parent-last-child bottom margin collapsing using a two-level approach (Level A shifts child inside parent, Level B adjusts grandparent for effective collapsed margin). Fix pre-existing bug in shift_subtree_x that incorrectly skipped absolute/fixed children. Extract shared MARGIN_EPSILON constant, add 9 unit tests and 4 golden tests (209-212), promote 31 WPT tests to pass. Includes code review fixes: pub(crate) visibility for is_root_element, known-limitation docs, and inline-content shift test coverage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
24 lines
732 B
HTML
24 lines
732 B
HTML
<!DOCTYPE html>
|
|
<!-- NOTE: This tests a 3-level nested parent-child margin collapsing chain.
|
|
Per CSS 2.1 §8.3.1, all three margins (10, 20, 30) should collapse to 30px.
|
|
Known limitation: our implementation propagates one level at a time, so
|
|
deeper chains may produce partially correct results. This golden captures
|
|
the current (correct for this case) behavior. -->
|
|
<html>
|
|
<head>
|
|
<style>
|
|
body { margin: 0; }
|
|
.outer { margin-top: 10px; background: lightblue; }
|
|
.middle { margin-top: 20px; background: lightgreen; }
|
|
.inner { margin-top: 30px; height: 50px; background: lightyellow; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="outer">
|
|
<div class="middle">
|
|
<div class="inner"></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|