PageRenderTime 752ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/third_party/blink/web_tests/external/wpt/css/css-scrollbars/scrollbar-width-002.html

https://github.com/chromium/chromium
HTML | 167 lines | 138 code | 29 blank | 0 comment | 0 complexity | 7bf236476a0c36bcaa2ad28fa593a0ab 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 Scrollbars: scrollbar-width with vertical text and horizontal scrollbar</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-scrollbars-1/" />
  6. <script src="/resources/testharness.js"></script>
  7. <script src="/resources/testharnessreport.js"></script>
  8. <script src="/css/support/parsing-testcommon.js"></script>
  9. <style>
  10. /* Use scrollbar-gutter to reserve space for the scrollbar. */
  11. .container {
  12. scrollbar-gutter: stable;
  13. overflow: auto;
  14. height: 200px;
  15. width: 200px;
  16. margin: 1px;
  17. padding: 0px;
  18. border: none;
  19. background: deepskyblue;
  20. }
  21. .content {
  22. height: 100%;
  23. width: 300px;
  24. background: lightsalmon;
  25. }
  26. /* writing directions */
  27. .vertical-lr {
  28. writing-mode: vertical-lr;
  29. }
  30. .vertical-rl {
  31. writing-mode: vertical-rl;
  32. }
  33. .container.auto {
  34. scrollbar-width: auto;
  35. }
  36. .container.thin {
  37. scrollbar-width: thin;
  38. }
  39. .container.none {
  40. scrollbar-width: none;
  41. }
  42. </style>
  43. <script type="text/javascript">
  44. function performTest() {
  45. setup({ explicit_done: true });
  46. // vertical-lr
  47. test(function () {
  48. let container = document.getElementById('container_vlr_auto');
  49. let content = document.getElementById('content_vlr_auto');
  50. assert_less_than(container.scrollHeight, container.offsetHeight, "vertical-lr auto scrollHeight");
  51. assert_less_than(container.clientHeight, container.offsetHeight, "vertical-lr auto clientHeight");
  52. assert_equals(container.clientHeight, content.clientHeight, "vertical-lr auto clientHeight");
  53. assert_not_equals(container.offsetHeight, content.offsetHeight, "vertical-lr auto offsetHeight");
  54. }, "vertical-lr, scrollbar-width auto");
  55. test(function () {
  56. let container = document.getElementById('container_vlr_thin');
  57. let content = document.getElementById('content_vlr_thin');
  58. assert_less_than(container.scrollHeight, container.offsetHeight, "vertical-lr thin scrollHeight");
  59. assert_less_than(container.clientHeight, container.offsetHeight, "vertical-lr thin clientHeight");
  60. assert_equals(container.clientHeight, content.clientHeight, "vertical-lr thin clientHeight");
  61. assert_not_equals(container.offsetHeight, content.offsetHeight, "vertical-lr thin offsetHeight");
  62. }, "vertical-lr, scrollbar-width thin");
  63. test(function () {
  64. let auto_scrollbar_height =
  65. document.getElementById('container_vlr_auto').offsetHeight -
  66. document.getElementById('container_vlr_auto').clientHeight;
  67. let thin_scrollbar_height =
  68. document.getElementById('container_vlr_thin').offsetHeight -
  69. document.getElementById('container_vlr_thin').clientHeight;
  70. assert_less_than_equal(thin_scrollbar_height, auto_scrollbar_height, "vertical-lr, thin <= auto");
  71. }, 'vertical-lr, scrollbar-width "thin" is same or thinner than "auto"');
  72. test(function () {
  73. let container = document.getElementById('container_vlr_none');
  74. let content = document.getElementById('content_vlr_none');
  75. assert_equals(container.scrollHeight, 200, "vertical-lr none scrollHeight");
  76. assert_equals(container.clientHeight, 200, "vertical-lr none clientHeight");
  77. assert_equals(container.clientHeight, content.clientHeight, "vertical-lr none clientHeight");
  78. assert_equals(container.offsetHeight, content.offsetHeight, "vertical-lr none offsetHeight");
  79. }, "vertical-lr, scrollbar-width none");
  80. // vertical-rl
  81. test(function () {
  82. let container = document.getElementById('container_vrl_auto');
  83. let content = document.getElementById('content_vrl_auto');
  84. assert_less_than(container.scrollHeight, container.offsetHeight, "vertical-rl auto scrollHeight");
  85. assert_less_than(container.clientHeight, container.offsetHeight, "vertical-rl auto clientHeight");
  86. assert_equals(container.clientHeight, content.clientHeight, "vertical-rl auto clientHeight");
  87. assert_not_equals(container.offsetHeight, content.offsetHeight, "vertical-rl auto offsetHeight");
  88. }, "vertical-rl, scrollbar-width auto");
  89. test(function () {
  90. let container = document.getElementById('container_vrl_thin');
  91. let content = document.getElementById('content_vrl_thin');
  92. assert_less_than(container.scrollHeight, container.offsetHeight, "vertical-rl thin scrollHeight");
  93. assert_less_than(container.clientHeight, container.offsetHeight, "vertical-rl thin clientHeight");
  94. assert_equals(container.clientHeight, content.clientHeight, "vertical-rl thin clientHeight");
  95. assert_not_equals(container.offsetHeight, content.offsetHeight, "vertical-rl thin offsetHeight");
  96. }, "vertical-rl, scrollbar-width thin");
  97. test(function () {
  98. let auto_scrollbar_height =
  99. document.getElementById('container_vrl_auto').offsetHeight -
  100. document.getElementById('container_vrl_auto').clientHeight;
  101. let thin_scrollbar_height =
  102. document.getElementById('container_vrl_thin').offsetHeight -
  103. document.getElementById('container_vrl_thin').clientHeight;
  104. assert_less_than_equal(thin_scrollbar_height, auto_scrollbar_height, "vertical-rl, thin <= auto");
  105. }, 'vertical-rl, scrollbar-width "thin" is same or thinner than "auto"');
  106. test(function () {
  107. let container = document.getElementById('container_vrl_none');
  108. let content = document.getElementById('content_vrl_none');
  109. assert_equals(container.scrollHeight, 200, "vertical-rl none scrollHeight");
  110. assert_equals(container.clientHeight, 200, "vertical-rl none clientHeight");
  111. assert_equals(container.clientHeight, content.clientHeight, "vertical-rl none clientHeight");
  112. assert_equals(container.offsetHeight, content.offsetHeight, "vertical-rl none offsetHeight");
  113. }, "vertical-rl, scrollbar-width none");
  114. done();
  115. }
  116. </script>
  117. <body onload="performTest()">
  118. Test scrollbar-width: horizontal scrollbar, vertical-lr direction
  119. <div class="container vertical-lr auto" id="container_vlr_auto">
  120. <div class="content" id="content_vlr_auto">auto</div>
  121. </div>
  122. <div class="container vertical-lr thin" id="container_vlr_thin">
  123. <div class="content" id="content_vlr_thin">thin</div>
  124. </div>
  125. <div class="container vertical-lr none" id="container_vlr_none">
  126. <div class="content" id="content_vlr_none">none</div>
  127. </div>
  128. Test scrollbar-width: horizontal scrollbar, vertical-rl direction
  129. <div class="container vertical-rl auto" id="container_vrl_auto">
  130. <div class="content" id="content_vrl_auto">auto</div>
  131. </div>
  132. <div class="container vertical-rl thin" id="container_vrl_thin">
  133. <div class="content" id="content_vrl_thin">thin</div>
  134. </div>
  135. <div class="container vertical-rl none" id="container_vrl_none">
  136. <div class="content" id="content_vrl_none">none</div>
  137. </div>
  138. </body>