wpt / css / css-gaps / grid / grid-gap-decorations-repaint-on-item-position-change.html

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

/css/css-gaps/grid/grid-gap-decorations-repaint-on-item-position-change.html

<!DOCTYPE html>
<html class="reftest-wait">
<head>
  <title>CSS Gap Decorations: repaint when grid item position changes</title>
  <link rel="help" href="https://drafts.csswg.org/css-gaps-1/">
  <link rel="match" href="grid-gap-decorations-repaint-on-item-position-change-ref.html">
  <link rel="author" title="Kevin Babbitt" href="mailto:kbabbitt@microsoft.com">
  <meta name="assert" content="Gap decorations repaint correctly when a grid item's position changes with rule-visibility-items: around">
  <style>
    .grid-container {
      display: grid;
      grid-template: repeat(2, 50px) / repeat(2, 50px);
      gap: 20px;
      column-rule: 20px solid green;
      row-rule: 20px solid green;
      rule-break: intersection;
      rule-inset-junction: -20px;
      rule-visibility-items: around;
    }

    .grid-item {
      background: green;
    }

    #walking-item {
      /* Start at row 1, col 1; will move to row 2, col 2 */
      grid-row: 1;
      grid-column: 1;
    }
  </style>
</head>
<body>
  <p>Test passes if there is a filled green square.</p>
  <div class="grid-container">
    <div id="walking-item" class="grid-item"></div>
  </div>
  <script>
    // Use double requestAnimationFrame to ensure style is computed and painted.
    requestAnimationFrame(() => {
      requestAnimationFrame(() => {
        // Move walking-item from (1,1) to (2,2).
        // With rule-visibility-items: around, this changes which gap segments
        // are visible. The gap decorations should repaint to reflect this.
        const item = document.getElementById('walking-item');
        item.style.gridRow = '2';
        item.style.gridColumn = '2';
        document.documentElement.classList.remove("reftest-wait");
      });
    });
  </script>
</body>
</html>

/css/css-gaps/grid/grid-gap-decorations-repaint-on-item-position-change-ref.html

<!DOCTYPE html>
<html>
<head>
  <title>CSS Gap Decorations: repaint when grid item position changes (reference)</title>
  <link rel="author" title="Kevin Babbitt" href="mailto:kbabbitt@microsoft.com">
  <style>
    .grid-container {
      display: grid;
      grid-template: repeat(2, 50px) / repeat(2, 50px);
      gap: 20px;
      column-rule: 20px solid green;
      row-rule: 20px solid green;
      rule-break: intersection;
      rule-inset-junction: -20px;
      rule-visibility-items: around;
    }

    .grid-item {
      background: green;
    }
  </style>
</head>
<body>
  <p>Test passes if there is a filled green square.</p>
  <div class="grid-container">
    <!-- Walking item: final position at row 2, col 2 -->
    <div class="grid-item" style="grid-row: 2; grid-column: 2;"></div>
  </div>
</body>
</html>