tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

scroll-marker-group-snap-aligns-to-active.tentative.html (3086B)


      1 <!DOCTYPE html>
      2 <html class="reftest-wait">
      3  <head>
      4    <title>CSS Test: active :scroll-markers is snap-aligned when scroll-marker-group is scrollable </title>
      5    <link rel="help" href="https://drafts.csswg.org/css-overflow-5/#active-scroll-marker">
      6    <link rel="match" href="scroll-marker-group-snap-aligns-to-active-ref.html">
      7    <script src="/css/css-transitions/support/helper.js"></script>
      8    <script src="/dom/events/scrolling/scroll_support.js"></script>
      9    <script src="/common/reftest-wait.js"></script>
     10  </head>
     11  <body>
     12    <style>
     13    * {
     14      margin: 0px;
     15    }
     16    .scroller {
     17      height: 500px;
     18      width: 80vw;
     19      border: solid 1px;
     20      overflow-x: scroll;
     21      justify-self: center;
     22      white-space: nowrap;
     23      padding-top: 50px;
     24      scroll-snap-type: x mandatory;
     25      scroll-marker-group: after;
     26      &::scroll-marker-group {
     27        border: solid 1px black;
     28        height: 40px;
     29        width: 500px;
     30        display: grid;
     31        scroll-snap-type: x mandatory;
     32        grid-auto-flow: column;
     33        justify-self: center;
     34        overflow-x: scroll;
     35        white-space: nowrap;
     36      }
     37      counter-set: markeridx -1;
     38    }
     39 
     40    .box {
     41      height: 400px;
     42      width: 50%;
     43      border: 1px solid;
     44      display: inline-block;
     45      margin-left: 100px;
     46      margin-right: 100px;
     47      scroll-snap-align: center;
     48      align-content: center;
     49      text-align: center;
     50      &::scroll-marker {
     51        content: counter(markeridx);
     52        counter-increment: markeridx;
     53        width: 20px;
     54        height: 20px;
     55        background-color: red;
     56        margin-right: 100px;
     57        scroll-snap-align: center;
     58      }
     59      &::scroll-marker:target-current {
     60        background-color: green;
     61      }
     62    }
     63 
     64    </style>
     65    <div class="scroller" id="carousel">
     66      <div class="box" id="box0"><p>0</p></div>
     67      <div class="box" id="box1"><p>1</p></div>
     68      <div class="box" id="box2"><p>2</p></div>
     69      <div class="box" id="box3"><p>3</p></div>
     70      <div class="box" id="box4"><p>4</p></div>
     71      <div class="box" id="box5"><p>5</p></div>
     72      <div class="box" id="box6"><p>6</p></div>
     73      <div class="box" id="box7"><p>7</p></div>
     74      <div class="box" id="box8"><p>8</p></div>
     75      <div class="box" id="box9"><p>9</p></div>
     76      <div class="box" id="box10"><p>10</p></div>
     77      <div class="box" id="box11"><p>11</p></div>
     78      <div class="box" id="box12"><p>12</p></div>
     79      <div class="box" id="box13"><p>13</p></div>
     80      <div class="box" id="box14"><p>14</p></div>
     81      <div class="box" id="box15"><p>15</p></div>
     82    </div>
     83    <script>
     84      async function runTest() {
     85        const scrollend_promise =
     86          waitForScrollEndFallbackToDelayWithoutScrollEvent(carousel);
     87        // When box3 is scrolled into view, the scroll-marker-group should scroll
     88        // to ensure that its corresponding marker is scrolled into view.
     89        box3.scrollIntoView();
     90        await scrollend_promise;
     91        takeScreenshot();
     92      }
     93      waitForCompositorReady().then(runTest);
     94    </script>
     95  </body>
     96 </html>