PageRenderTime 1107ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/third_party/blink/web_tests/wpt_internal/css/css-overflow/scrollbar-gutter-003.html

https://github.com/chromium/chromium
HTML | 191 lines | 160 code | 31 blank | 0 comment | 0 complexity | 11af2dfcc07998a9c673e2c45e9fbc06 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, Apache-2.0, BSD-3-Clause
  1. <!doctype html>
  2. <meta charset="utf-8">
  3. <title>CSS Overflow: test scrollbar-gutter: stable both-edges (classic scrollbars, horizontal text)</title>
  4. <link rel="author" title="Felipe Erias Morandeira" href="mailto:felipeerias@gmail.com"/>
  5. <link rel="help" href="https://www.w3.org/TR/css-overflow-4/#scollbar-gutter-property"/>
  6. <meta name="assert" content="Test scrollbar-gutter: stable with custom classic scrollbars">
  7. <script src="/resources/testharness.js"></script>
  8. <script src="/resources/testharnessreport.js"></script>
  9. <script src="/css/support/parsing-testcommon.js"></script>
  10. <style>
  11. .container {
  12. scrollbar-gutter: stable both-edges;
  13. writing-mode: horizontal-tb;
  14. overflow-x: auto;
  15. height: 200px;
  16. width: 200px;
  17. margin: 1px;
  18. padding: 0px;
  19. border: none;
  20. background: deepskyblue;
  21. }
  22. .content {
  23. height: 100%;
  24. width: 100%;
  25. background: lightsalmon;
  26. }
  27. /* ensure that we are using classic scrollbars with a known thickness */
  28. .classic::-webkit-scrollbar {
  29. width: 20px;
  30. height: 20px;
  31. }
  32. .classic::-webkit-scrollbar-track {
  33. background-color: hsla(0, 0%, 40%, 0.4);
  34. }
  35. .classic::-webkit-scrollbar-thumb {
  36. background-color: hsla(0, 0%, 20%, 0.8);
  37. border-radius: 10px;
  38. }
  39. /* writing directions */
  40. .ltr {
  41. direction: ltr;
  42. }
  43. .rtl {
  44. direction: rtl;
  45. }
  46. /* overflow on the block direction */
  47. .container.auto { overflow-y: auto; }
  48. .container.scroll { overflow-y: scroll; }
  49. .container.visible { overflow: visible; }
  50. .container.hidden { overflow-y: hidden; }
  51. /* Note: not testing with overflow: clip; */
  52. </style>
  53. <script type="text/javascript">
  54. function performTest() {
  55. setup({explicit_done: true});
  56. // ltr
  57. test(function() {
  58. let container = document.getElementById('container_auto_ltr');
  59. let content = document.getElementById('content_auto_ltr');
  60. assert_equals(container.scrollWidth, 160, "auto/stable both-edges scrollWidth");
  61. assert_equals(container.clientWidth, 160, "auto/stable both-edges clientWidth");
  62. assert_equals(container.offsetLeft, content.offsetLeft - 20, "auto/stable both-edges offsetLeft");
  63. assert_equals(container.clientWidth, content.clientWidth, "auto/stable both-edges clientWidth");
  64. assert_not_equals(container.offsetWidth, content.offsetWidth, "auto/stable both-edges offsetWidth");
  65. }, "overflow auto, scrollbar-gutter stable both-edges, horizontal-tb, ltr");
  66. test(function() {
  67. let container = document.getElementById('container_scroll_ltr');
  68. let content = document.getElementById('content_scroll_ltr');
  69. assert_equals(container.scrollWidth, 160, "scroll/stable both-edges scrollWidth");
  70. assert_equals(container.clientWidth, 160, "scroll/stable both-edges clientWidth");
  71. assert_equals(container.offsetLeft, content.offsetLeft - 20, "scroll/stable both-edges offsetLeft");
  72. assert_equals(container.clientWidth, content.clientWidth, "scroll/stable both-edges clientWidth");
  73. assert_not_equals(container.offsetWidth, content.offsetWidth, "scroll/stable both-edges offsetWidth");
  74. }, "overflow scroll, scrollbar-gutter stable both-edges, horizontal-tb, ltr");
  75. test(function() {
  76. let container = document.getElementById('container_visible_ltr');
  77. let content = document.getElementById('content_visible_ltr');
  78. assert_equals(container.scrollWidth, 200, "visible/stable both-edges scrollWidth");
  79. assert_equals(container.clientWidth, 200, "visible/stable both-edges clientWidth");
  80. assert_equals(container.offsetLeft, content.offsetLeft, "visible/stable both-edges offsetLeft");
  81. assert_equals(container.clientWidth, content.clientWidth, "visible/stable both-edges clientWidth");
  82. assert_equals(container.offsetWidth, content.offsetWidth, "visible/stable both-edges offsetWidth");
  83. }, "overflow visible, scrollbar-gutter stable both-edges, horizontal-tb, ltr");
  84. test(function() {
  85. let container = document.getElementById('container_hidden_ltr');
  86. let content = document.getElementById('content_hidden_ltr');
  87. assert_equals(container.scrollWidth, 160, "hidden/stable both-edges scrollWidth");
  88. assert_equals(container.clientWidth, 160, "hidden/stable both-edges clientWidth");
  89. assert_equals(container.offsetLeft, content.offsetLeft - 20, "hidden/stable both-edges offsetLeft");
  90. assert_equals(container.clientWidth, content.clientWidth, "hidden/stable both-edges clientWidth");
  91. assert_not_equals(container.offsetWidth, content.offsetWidth, "hidden/stable both-edges offsetWidth");
  92. }, "overflow hidden, scrollbar-gutter stable both-edges, horizontal-tb, ltr");
  93. // rtl
  94. test(function() {
  95. let container = document.getElementById('container_auto_rtl');
  96. let content = document.getElementById('content_auto_rtl');
  97. assert_equals(container.scrollWidth, 160, "auto/stable both-edges scrollWidth");
  98. assert_equals(container.clientWidth, 160, "auto/stable both-edges clientWidth");
  99. assert_equals(container.offsetLeft, content.offsetLeft - 20, "auto/stable both-edges offsetLeft");
  100. assert_equals(container.clientWidth, content.clientWidth, "auto/stable both-edges clientWidth");
  101. assert_not_equals(container.offsetWidth, content.offsetWidth, "auto/stable both-edges offsetWidth");
  102. }, "overflow auto, scrollbar-gutter stable both-edges, horizontal-tb, rtl");
  103. test(function() {
  104. let container = document.getElementById('container_scroll_rtl');
  105. let content = document.getElementById('content_scroll_rtl');
  106. assert_equals(container.scrollWidth, 160, "scroll/stable both-edges scrollWidth");
  107. assert_equals(container.clientWidth, 160, "scroll/stable both-edges clientWidth");
  108. assert_equals(container.offsetLeft, content.offsetLeft - 20, "scroll/stable both-edges offsetLeft");
  109. assert_equals(container.clientWidth, content.clientWidth, "scroll/stable both-edges clientWidth");
  110. assert_not_equals(container.offsetWidth, content.offsetWidth, "scroll/stable both-edges offsetWidth");
  111. }, "overflow scroll, scrollbar-gutter stable both-edges, horizontal-tb, rtl");
  112. test(function() {
  113. let container = document.getElementById('container_visible_rtl');
  114. let content = document.getElementById('content_visible_rtl');
  115. assert_equals(container.scrollWidth, 200, "visible/stable both-edges scrollWidth");
  116. assert_equals(container.clientWidth, 200, "visible/stable both-edges clientWidth");
  117. assert_equals(container.offsetLeft, content.offsetLeft, "visible/stable both-edges offsetLeft");
  118. assert_equals(container.clientWidth, content.clientWidth, "visible/stable both-edges clientWidth");
  119. assert_equals(container.offsetWidth, content.offsetWidth, "visible/stable both-edges offsetWidth");
  120. }, "overflow visible, scrollbar-gutter stable both-edges, horizontal-tb, rtl");
  121. test(function() {
  122. let container = document.getElementById('container_hidden_rtl');
  123. let content = document.getElementById('content_hidden_rtl');
  124. assert_equals(container.scrollWidth, 160, "hidden/stable both-edges scrollWidth");
  125. assert_equals(container.clientWidth, 160, "hidden/stable both-edges clientWidth");
  126. assert_equals(container.offsetLeft, content.offsetLeft - 20, "hidden/stable both-edges offsetLeft");
  127. assert_equals(container.clientWidth, content.clientWidth, "hidden/stable both-edges clientWidth");
  128. assert_not_equals(container.offsetWidth, content.offsetWidth, "hidden/stable both-edges offsetWidth");
  129. }, "overflow hidden, scrollbar-gutter stable both-edges, horizontal-tb, rtl");
  130. done();
  131. }
  132. </script>
  133. <body onload="performTest()">
  134. Test scrollbar-gutter: stable both-edges, direction: ltr
  135. <div class="container classic ltr auto" id="container_auto_ltr">
  136. <div class="content" id="content_auto_ltr">overflow-y: auto</div>
  137. </div>
  138. <div class="container classic ltr scroll" id="container_scroll_ltr">
  139. <div class="content" id="content_scroll_ltr">overflow-y: scroll</div>
  140. </div>
  141. <div class="container classic ltr visible" id="container_visible_ltr">
  142. <div class="content" id="content_visible_ltr">overflow: visible</div>
  143. </div>
  144. <div class="container classic ltr hidden" id="container_hidden_ltr">
  145. <div class="content" id="content_hidden_ltr">overflow-y: hidden</div>
  146. </div>
  147. direction: rtl
  148. <div class="container classic rtl auto" id="container_auto_rtl">
  149. <div class="content" id="content_auto_rtl">overflow-x: auto</div>
  150. </div>
  151. <div class="container classic rtl scroll" id="container_scroll_rtl">
  152. <div class="content" id="content_scroll_rtl">overflow-x: scroll</div>
  153. </div>
  154. <div class="container classic rtl visible" id="container_visible_rtl">
  155. <div class="content" id="content_visible_rtl">overflow: visible</div>
  156. </div>
  157. <div class="container classic rtl hidden" id="container_hidden_rtl">
  158. <div class="content" id="content_hidden_rtl">overflow-x: hidden</div>
  159. </div>
  160. </body>