OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <style> |
| 3 .bfc { display:flow-root; } |
| 4 .vertical { overflow-y:scroll !important; overflow-x:hidden; } |
| 5 .horizontal { overflow-x:scroll !important; overflow-y:hidden; } |
| 6 .small { width:0; padding:1px; border:1px solid; margin-right:10px; float:le
ft; } |
| 7 .size_border_box { box-sizing:border-box; } |
| 8 .rtl { direction:rtl; } |
| 9 </style> |
| 10 |
| 11 <div id="measure_block" style="position:absolute; visibility:hidden; width:100px
; height:100px; overflow:scroll;"> |
| 12 <div id="measure_block_child" style="height:100%;"></div> |
| 13 </div> |
| 14 |
| 15 <script src="../../resources/testharness.js"></script> |
| 16 <script src="../../resources/testharnessreport.js"></script> |
| 17 <script> |
| 18 var measure_block = document.getElementById("measure_block"); |
| 19 var measure_block_child = document.getElementById("measure_block_child"); |
| 20 var vertical_scrollbar_width = measure_block.offsetWidth - measure_block_chi
ld.offsetWidth; |
| 21 var horizontal_scrollbar_width = measure_block.offsetHeight - measure_block_
child.offsetHeight; |
| 22 var padding_and_border = 4; |
| 23 var width_with_scrollbar = vertical_scrollbar_width + padding_and_border; |
| 24 var width_without_scrollbar = padding_and_border; |
| 25 var height_with_scrollbar = horizontal_scrollbar_width + padding_and_border; |
| 26 var height_without_scrollbar = padding_and_border; |
| 27 </script> |
| 28 |
| 29 <p>There should be some figures with the same size below, at least as |
| 30 wide as the width of a vertical scrollbar:</p> |
| 31 <div id="vertical_only" class="bfc"> |
| 32 <div class="small vertical"></div> |
| 33 <div class="small vertical size_border_box"></div> |
| 34 <div class="small vertical rtl"></div> |
| 35 <div class="small vertical size_border_box rtl"></div> |
| 36 </div> |
| 37 |
| 38 <p>There should be some figures with the same size below, at least as |
| 39 tall as the height of a horizontal scrollbar:</p> |
| 40 <div id="horizontal_only" class="bfc"> |
| 41 <div class="small horizontal"></div> |
| 42 <div class="small horizontal size_border_box"></div> |
| 43 <div class="small horizontal rtl"></div> |
| 44 <div class="small horizontal size_border_box rtl"></div> |
| 45 </div> |
| 46 |
| 47 <p>There should be some figures with the same size below, at least as |
| 48 wide and tall as the width and height of a vertical and horizontal |
| 49 scrollbar:</p> |
| 50 <div id="vertical_and_horizontal" class="bfc"> |
| 51 <div class="small vertical horizontal"></div> |
| 52 <div class="small vertical horizontal size_border_box"></div> |
| 53 <div class="small vertical horizontal rtl"></div> |
| 54 <div class="small vertical horizontal size_border_box rtl"></div> |
| 55 </div> |
| 56 |
| 57 <script> |
| 58 document.querySelectorAll("#vertical_only > div").forEach(function(elm) { |
| 59 test(function() { |
| 60 assert_equals(elm.offsetWidth, width_with_scrollbar); |
| 61 assert_equals(elm.offsetHeight, height_without_scrollbar); |
| 62 }, elm.className); |
| 63 }); |
| 64 |
| 65 document.querySelectorAll("#horizontal_only > div").forEach(function(elm) { |
| 66 test(function() { |
| 67 assert_equals(elm.offsetWidth, width_without_scrollbar); |
| 68 assert_equals(elm.offsetHeight, height_with_scrollbar); |
| 69 }, elm.className); |
| 70 }); |
| 71 |
| 72 document.querySelectorAll("#vertical_and_horizontal > div").forEach(function
(elm) { |
| 73 test(function() { |
| 74 assert_equals(elm.offsetWidth, width_with_scrollbar); |
| 75 assert_equals(elm.offsetHeight, height_with_scrollbar); |
| 76 }, elm.className); |
| 77 }); |
| 78 </script> |
OLD | NEW |