layer-splitting-3.html 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <!DOCTYPE html>
  2. <html lang="en" class="reftest-wait"
  3. reftest-displayport-x="0"
  4. reftest-displayport-y="0"
  5. reftest-displayport-w="800"
  6. reftest-displayport-h="1000">
  7. <meta charset="utf-8">
  8. <title>Scrolling shouldn't invalidate the fixed items</title>
  9. <style>
  10. .content {
  11. box-sizing: border-box;
  12. width: 200px;
  13. height: 200px;
  14. border: 1px solid black;
  15. }
  16. .fixed {
  17. position: fixed;
  18. top: 20px;
  19. left: 20px;
  20. }
  21. .reftest-no-paint {
  22. border-color: lime;
  23. }
  24. .distanceFromTop {
  25. margin-top: 240px;
  26. }
  27. .clip {
  28. width: 200px;
  29. height: 200px;
  30. overflow: hidden;
  31. }
  32. .transform {
  33. position: relative;
  34. will-change: transform;
  35. }
  36. body {
  37. margin: 0;
  38. padding: 20px;
  39. height: 3000px;
  40. }
  41. </style>
  42. <div class="fixed reftest-no-paint content">
  43. <!--
  44. This fixed layer gets its own PaintedLayer above the page.
  45. -->
  46. </div>
  47. <div class="distanceFromTop clip">
  48. <!--
  49. This clip determines the potential pixels that can be affected by the
  50. animated transform, *in relation to the scrolled page*. If the page
  51. is scrolled, the clip moves relative to the fixed items, so the fixed
  52. items need to anticipate the transform getting between them.
  53. -->
  54. <div class="transform content">
  55. <!--
  56. This is an animated transform item. It can move freely but will be
  57. clipped by the .clip element.
  58. -->
  59. </div>
  60. </div>
  61. <div class="fixed reftest-no-paint content">
  62. <!--
  63. This fixed layer is above the animated transform, in z-order. The
  64. transform is clipped in such a way that initially, the clip doesn't
  65. intersect the fixed items, but once the page is scrolled, it does.
  66. So this fixed item must not share a layer with the lower fixed item.
  67. -->
  68. </div>
  69. <script>
  70. function doTest() {
  71. document.documentElement.scrollTop = 100;
  72. document.documentElement.removeAttribute("class");
  73. }
  74. document.documentElement.scrollTop = 0;
  75. document.addEventListener("MozReftestInvalidate", doTest, false);
  76. // setTimeout(doTest, 500);
  77. </script>