tor-browser

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

scroll-marker-controls-scroll-tracking-003.html (2152B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>CSS Test: scroll tracking for ::scroll-marker with direction: rtl</title>
      4 <link rel="help" href="https://drafts.csswg.org/css-overflow-5/#scroll-container-scroll">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/css/css-transitions/support/helper.js"></script>
      8 <style>
      9  #scroller {
     10    direction: rtl;
     11    overflow: scroll;
     12    width: 100px;
     13    height: 150px;
     14    white-space: nowrap;
     15    scroll-marker-group: before;
     16  }
     17 
     18  #scroller::scroll-marker-group {
     19    border: 3px solid black;
     20    display: flex;
     21    width: 100px;
     22    height: 20px;
     23  }
     24 
     25  #scroller div {
     26    border: 3px solid black;
     27    background-color: blue;
     28    display: inline-block;
     29    margin: 10px;
     30    width: 100px;
     31    height: 100px;
     32  }
     33 
     34  #scroller div::scroll-marker {
     35    content: '';
     36    background-color: red;
     37    width: 10px;
     38    height: 10px;
     39    border-radius: 50%;
     40  }
     41 
     42  #scroller div::scroll-marker:target-current {
     43    background-color: green;
     44  }
     45 
     46  #target {
     47    background-color: purple;
     48  }
     49 </style>
     50 <div id='scroller'>
     51  <div></div>
     52  <div id='target'></div>
     53 </div>
     54 <script>
     55  function assertPseudoElementProperty(originatingElement, pseudoType, backgroundColor) {
     56    const pseudoStyle = getComputedStyle(originatingElement, pseudoType);
     57    const pseudoBackgroundColor = pseudoStyle.getPropertyValue('background-color');
     58    assert_equals(pseudoBackgroundColor, backgroundColor, pseudoType +
     59      " background-color should be " + backgroundColor.toString() +
     60      " but was " + pseudoBackgroundColor.toString());
     61  }
     62  promise_test(async () => {
     63    await waitForAnimationFrames(2);
     64    assertPseudoElementProperty(target, "::scroll-marker", "rgb(255, 0, 0)");
     65  }, "::scroll-marker is not activated when its originating element is not scrolled into the view");
     66  promise_test(async () => {
     67    scroller.scrollLeft = -150;
     68    await waitForAnimationFrames(2);
     69    assertPseudoElementProperty(target, "::scroll-marker", "rgb(0, 128, 0)");
     70  }, "::scroll-marker is activated when its originating element is scrolled into the view");
     71 </script>