pull-background-animated-position-2.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <!DOCTYPE html>
  2. <html lang="en" class="reftest-wait">
  3. <meta charset="utf-8">
  4. <title>Scrollboxes with non-uniform backgrounds should prevent their contents from pulling background colors, even if those contents start out above uniform backgrounds and have an animated position</title>
  5. <style>
  6. div {
  7. min-height: 50px;
  8. box-model: border-box;
  9. }
  10. .first, .second {
  11. border: 1px solid blue;
  12. margin: 50px 0;
  13. position: relative;
  14. }
  15. .border {
  16. border: 1px solid black;
  17. }
  18. .underlap {
  19. border: 1px solid #088;
  20. margin-left: 120px;
  21. width: 80px;
  22. margin-bottom: -30px;
  23. }
  24. .scrollable {
  25. height: auto;
  26. overflow: auto;
  27. }
  28. .scrollarea {
  29. width: 5000px;
  30. border: none;
  31. padding: 10px 0 20px;
  32. height: auto;
  33. }
  34. .scrolled {
  35. margin-left: 220px;
  36. width: 100px;
  37. height: 100px;
  38. border-color: red;
  39. }
  40. .animated-position {
  41. position: relative;
  42. left: 20px;
  43. }
  44. body {
  45. margin: 0;
  46. padding: 0 100px;
  47. height: 3000px;
  48. }
  49. </style>
  50. <div class="first" reftest-assigned-layer="page-background">
  51. <!--
  52. This is just a regular box, it should end up in the page background layer.
  53. -->
  54. </div>
  55. <div class="underlap">
  56. <!--
  57. This item intersects with the scrollable box and is positioned below
  58. .scrollable, in z-order.
  59. -->
  60. </div>
  61. <div class="scrollable border">
  62. <div class="scrollarea">
  63. <div class="scrolled border animated-position reftest-no-paint">
  64. <!--
  65. This box starts out above solid white background, but it will move so
  66. that it intersects .underlap, so it shouldn't pull up a background
  67. color to begin with so that it doesn't need to invalidate.
  68. -->
  69. </div>
  70. </div>
  71. </div>
  72. <div class="second" reftest-assigned-layer="page-background">
  73. <!--
  74. This should share a layer with .first and the page background.
  75. -->
  76. </div>
  77. <script>
  78. var scrollable = document.querySelector(".scrollable");
  79. // Make .scrollable start out with active scrolling.
  80. scrollable.scrollLeft = 0;
  81. scrollable.scrollLeft = 20;
  82. var animatedLeft = document.querySelector(".animated-position");
  83. function doTest() {
  84. animatedLeft.style.left = "-40px";
  85. document.documentElement.removeAttribute("class");
  86. }
  87. // Layerize #animatedLeft
  88. animatedLeft.offsetLeft;
  89. animatedLeft.style.left = "40px";
  90. animatedLeft.offsetLeft;
  91. animatedLeft.style.left = "60px";
  92. animatedLeft.offsetLeft;
  93. document.addEventListener("MozReftestInvalidate", doTest, false);
  94. setTimeout(doTest, 200);
  95. </script>