wpt / css / css-grid / grid-lanes / item-placement / row-negative-margin-002.html

Status: FAIL | Duration: 15ms | Subtests: 0/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/css-grid/grid-lanes/item-placement/row-negative-margin-002.html

<!DOCTYPE html>
<html>
<link rel="help" href="https://drafts.csswg.org/css-grid-3">
<link rel="match" href="row-negative-margin-002-ref.html">
<link rel="author" title="Celeste Pan" href="mailto:celestepan@microsoft.com">
<style>
body {
    margin-left: 40px;
}

.grid-lanes {
    display: grid-lanes;
    flow-tolerance: 0;
    grid-template-rows: repeat(3, 50px);
}
</style>
<body>
  <p>If an item's negative margin is clamped to its own size, and it will never cause the running position to regress.</p>
  <div class="grid-lanes">
    <div style="background: aquamarine; width: 50px;" >
      item 1
    </div>
    <!-- This should have a running position of 0. -->
    <div style="background: lightsteelblue; width: 50px; margin-right: -60px; margin-left: -40px;" >
      item 2
    </div>
    <!-- This should be placed in track 2 because track 2 has a running position of 0 from item 2. -->
    <div style="background: aquamarine; grid-row: 2; width: 50px;" >
      item 3
    </div>
    <div style="background: lightblue; width: 30px;" >
      item 4
    </div>
    <div style="background: lightpink; width: 30px; margin-left: -70px;">
      item 5
    </div>
    <!-- This should visually be on the right of item 4, because even though item 5 is placed far left, the running position should not have regressed in the track. -->
    <div style="background: yellow; width: 20px;">
      item 6
    </div>
    <div style="background: orange; width: 40px; margin-left: -10px; margin-right: -30px;">
      item 7
    </div>
    <div style="background: lightblue; width: 20px;">
      item 8
    </div>
  </div>
</body>
</html>

/css/css-grid/grid-lanes/item-placement/row-negative-margin-002-ref.html

<!DOCTYPE html>
<html>
<style>
body {
    margin-left: 40px;
}

.grid {
    display: grid;
    grid-template-rows: repeat(3, 50px);
}
</style>
<body>
  <p>If an item's negative margin is clamped to its own size, and it will never cause the running position to regress.</p>
  <div class="grid">
    <div style="display: flex;">
      <div style="background: aquamarine; width: 50px;" >
        item 1
      </div>
      <div style="background: orange; width: 40px; margin-left: -10px; margin-right: -30px;">
        item 7
      </div>
    </div>
    <div style="grid-row: 2; display: flex; flex-shrink: 0;">
     <div style="background: lightsteelblue; width: 50px; margin-left: -40px; margin-right: -10px;" >
        item 2
      </div>
      <div style="background: aquamarine; width: 50px;" >
        item 3
      </div>
      <div style="background: lightblue; width: 20px;">
        item 8
      </div>
    </div>
    <div style="grid-row: 3; display: flex;">
      <div style="background: lightpink; width: 30px; margin-left: -40px; margin-right: 10px;">
        item 5
      </div>
      <div style="background: lightblue; width: 30px;" >
        item 4
      </div>
      <div style="background: yellow; width: 20px;">
        item 6
      </div>
    </div>
  </div>
</body>
</html>