OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- Inspired by https://github.com/othree/jquery.rtl-scroll-type which is used |
| 3 in various JS frameworks to determine what scroll "type" the engine has |
| 4 when it comes to RTL. When at the initial scroll position (i.e. all the way |
| 5 to the right), some engines sets scrollLeft to 0 and decrement to negative |
| 6 values when scrolling leftwards (Gecko). Others set it to 0 and increment |
| 7 the value when scrolling leftwards (IE / Edge). Others again set it to the |
| 8 width of the scrollable area and decrement it when scrolling leftwards |
| 9 (Blink / WebKit). There are further complications in the latter engine if |
| 10 there's a vertical scrollbar [1], and it's wider than the border box. All |
| 11 we need to worry about here though, is that the script is able to detect |
| 12 that we are "default". |
| 13 |
| 14 [1] crbug.com/724255 --> |
| 15 <div id="definer" dir="rtl" style="font-size: 14px; width: 1px; height: 1px; pos
ition: absolute; top: -1000px; overflow: scroll">A</div> |
| 16 <script src="../../resources/testharness.js"></script> |
| 17 <script src="../../resources/testharnessreport.js"></script> |
| 18 <script> |
| 19 // This test is only expected to pass in Blink / WebKit. |
| 20 test(function() { |
| 21 var definer = document.getElementById('definer'); |
| 22 var type = 'reverse'; |
| 23 if (definer.scrollLeft > 0) { |
| 24 type = 'default'; |
| 25 } |
| 26 else { |
| 27 definer.scrollLeft = 1; |
| 28 if (definer.scrollLeft === 0) { |
| 29 type = 'negative'; |
| 30 } |
| 31 } |
| 32 assert_equals(type, 'default'); |
| 33 }, "Blink should have 'default' RTL scroll behavior"); |
| 34 </script> |
OLD | NEW |