wpt / css / css-gaps / grid / grid-gap-decorations-repaint-on-child-resize.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-child-resize.html

<!DOCTYPE html>
<html class="reftest-wait">
<head>
  <title>CSS Gap Decorations: repaint when grid item width changes</title>
  <link rel="help" href="https://drafts.csswg.org/css-gaps-1/">
  <link rel="match" href="grid-gap-decorations-repaint-on-child-resize-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 width changes">
  <style>
    .grid-container {
      display: grid;
      grid-template-columns: auto auto;
      column-gap: 20px;
      width: 160px;
      height: 50px;
      background: red;
      column-rule: 20px solid green;
    }

    .grid-item {
      background: green;
      height: 50px;
    }

    #item1 {
      /* Start at 40px, will change to 90px */
      width: 40px;
    }

    #item2 {
      width: 50px;
    }
  </style>
</head>
<body>
  <p>Test passes if there is a filled green rectangle and <strong>no red</strong>.</p>
  <div class="grid-container">
    <div id="item1" class="grid-item"></div>
    <div id="item2" class="grid-item"></div>
  </div>
  <script>
    // Use double requestAnimationFrame to ensure style is computed and painted.
    requestAnimationFrame(() => {
      requestAnimationFrame(() => {
        // Change the grid item width. The gap decoration should repaint
        // at the new position (covering what was previously red).
        document.getElementById('item1').style.width = '90px';
        document.documentElement.classList.remove("reftest-wait");
      });
    });
  </script>
</body>
</html>

/css/css-gaps/grid/grid-gap-decorations-repaint-on-child-resize-ref.html

<!DOCTYPE html>
<html>
<head>
  <title>CSS Gap Decorations: repaint when grid item width changes (reference)</title>
  <link rel="author" title="Kevin Babbitt" href="mailto:kbabbitt@microsoft.com">
  <style>
    .grid-container {
      display: grid;
      grid-template-columns: auto auto;
      column-gap: 20px;
      width: 160px;
      height: 50px;
      background: red;
      column-rule: 20px solid green;
    }

    .grid-item {
      background: green;
      height: 50px;
    }

    #item1 {
      /* Final width after change */
      width: 90px;
    }

    #item2 {
      width: 50px;
    }
  </style>
</head>
<body>
  <p>Test passes if there is a filled green rectangle and <strong>no red</strong>.</p>
  <div class="grid-container">
    <div id="item1" class="grid-item"></div>
    <div id="item2" class="grid-item"></div>
  </div>
</body>
</html>