layer-splitting-4.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <meta charset="utf-8">
  4. <title>The two items in the scroll box should share a layer, despite all the other stuff that's going on around them</title>
  5. <style>
  6. .content {
  7. box-sizing: border-box;
  8. width: 200px;
  9. height: 200px;
  10. border: 1px solid blue;
  11. background: white;
  12. }
  13. body {
  14. margin: 0;
  15. padding: 20px;
  16. height: 3000px;
  17. }
  18. .opacity {
  19. opacity: 0.9;
  20. width: 200px;
  21. height: 200px;
  22. background-color: yellow;
  23. will-change: opacity;
  24. }
  25. .overlap {
  26. margin-top: -100px;
  27. }
  28. .scrollable {
  29. position: absolute;
  30. top: 20px;
  31. left: 240px;
  32. width: 400px;
  33. height: 400px;
  34. border: 1px solid black;
  35. overflow: auto;
  36. }
  37. .scrollarea {
  38. height: 800px;
  39. padding: 40px;
  40. }
  41. .low-z, .mid-z, .high-z {
  42. position: relative;
  43. }
  44. .low-z { z-index: 1; }
  45. .mid-z { z-index: 2; }
  46. .high-z { z-index: 3; }
  47. </style>
  48. <div class="content" reftest-assigned-layer="page-background"></div>
  49. <div class="overlap opacity"></div>
  50. <div class="overlap mid-z content" reftest-assigned-layer="on-top-of-opacity">
  51. <!--
  52. This item cannot merge into the page background layer because there's an
  53. active container layer for the opacity in between.
  54. -->
  55. </div>
  56. <div class="scrollable">
  57. <div class="scrollarea">
  58. <div class="low-z content" reftest-assigned-layer="scrolled-content"></div>
  59. <div class="high-z overlap content" reftest-assigned-layer="scrolled-content"></div>
  60. </div>
  61. </div>
  62. <script>
  63. var scrollable = document.querySelector(".scrollable");
  64. // Make .scrollable start out with active scrolling.
  65. scrollable.scrollTop = 0;
  66. scrollable.scrollTop = 20;
  67. </script>