Files
sousa-gecko/layout/reftests/scrolling/webkit-scrollbar-dynamic-remove.html
T
Hiroyuki Ikezoe 0ab2ebb66b Bug 1977511 - Add reftests for ::-webkit-scrollbar. r=layout-reviewers,emilio
There are 11 test cases;

1) webkit-scrollbar-in-at-supports.html:
  `@supports selector(::-webkit-scrollbar)` is evaluated as true
2) webkit-scrollbar.html:
   a normal scroll container and two scroll containers having
   `::-webkit-scrollbar { width: XXpx; height: XXpx; }`,
   the scrollbars on the normal scroll container are overlay, but
   with ui.scrollbarFadeBeginDelay=0, there's no visible scrollbar
3) webkit-scrollbar-zero-width.html:
   `::-webkit-scrollbar { width: 0px; }` case
4) webkit-scrollbar-no-width-height.html:
  `::-webkit-scrollbar { background-color: #aaa; }`
5) webkit-scrollbar-percent-width-height.html:
  `::-webkit-scrollbar { width: XX%; height: XX%; }`,
6) disable-horizontal-scrollbar-dynamically.html:
   no ::-webkit-scrollbar styles, it checks with disabling overlay
   scrollbars (i.e. ui.useOverlayScrollbars=0) the scrollbar
   properly don't appear once after the contents in the scroll container
   is no longer overflowed
7) webkit-scrollbar-focus.html:
  `:focus::-webkit-scrollbar  { width: 8px; height: 8px; }`
8) webkit-scrollbar-dynamic-add.html:
  `::-webkit-scrollbar  { width: 8px; }` is dynamically added
9) webkit-scrollbar-dynamic-remove.html:
  `::-webkit-scrollbar  { width: 8px; }` is dynamically removed
10) webkit-scrollbar-display-none-with-scrollbar-width-none.html:
  `::webkit-scrollbar { width: 8px; display: none; }` with
  `scrollbar-width: none`
11) webkit-scrollbar-display-none.html:
  `::webkit-scrollbar { width: 8px; display: none; }`

As of now 11) doesn't work as expected, will be handled in bug 2014011.

Differential Revision: https://phabricator.services.mozilla.com/D280697
2026-03-27 04:32:23 +00:00

39 lines
932 B
HTML

<!DOCTYPE html>
<html class="reftest-wait">
<style>
.scrollable {
overflow: scroll;
height: 100px;
width: 100px;
border: 2px solid black;
}
.scrollable::before {
display: block;
content: "overflowing content";
height: 300px;
width: 300px;
}
.pseudo8::-webkit-scrollbar-thumb {
background: cyan;
}
</style>
<div class="scrollable pseudo8"></div>
<script>
document.addEventListener('MozReftestInvalidate', async () => {
const extraStyle = document.createElement("style");
document.head.appendChild(extraStyle);
const sheet = extraStyle.sheet;
sheet.insertRule(".pseudo8::-webkit-scrollbar { width: 8px; }");
// Flush the style rule change.
document.documentElement.getBoundingClientRect();
// Await a frame and remove the style.
await new Promise(resolve => requestAnimationFrame(resolve));
extraStyle.remove();
document.documentElement.classList.remove("reftest-wait");
});
</script>
</html>