Index: third_party/WebKit/LayoutTests/fast/scrolling/jquery-rtl-scroll-type.html |
diff --git a/third_party/WebKit/LayoutTests/fast/scrolling/jquery-rtl-scroll-type.html b/third_party/WebKit/LayoutTests/fast/scrolling/jquery-rtl-scroll-type.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b230eba62f57ab6fa9c59e9c03eecc74b8ad8627 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/scrolling/jquery-rtl-scroll-type.html |
@@ -0,0 +1,34 @@ |
+<!DOCTYPE html> |
+<!-- Inspired by https://github.com/othree/jquery.rtl-scroll-type which is used |
+ in various JS frameworks to determine what scroll "type" the engine has |
+ when it comes to RTL. When at the initial scroll position (i.e. all the way |
+ to the right), some engines sets scrollLeft to 0 and decrement to negative |
+ values when scrolling leftwards (Gecko). Others set it to 0 and increment |
+ the value when scrolling leftwards (IE / Edge). Others again set it to the |
+ width of the scrollable area and decrement it when scrolling leftwards |
+ (Blink / WebKit). There are further complications in the latter engine if |
+ there's a vertical scrollbar [1], and it's wider than the border box. All |
+ we need to worry about here though, is that the script is able to detect |
+ that we are "default". |
+ |
+ [1] crbug.com/724255 --> |
+<div id="definer" dir="rtl" style="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll">A</div> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+ // This test is only expected to pass in Blink / WebKit. |
+ test(function() { |
+ var definer = document.getElementById('definer'); |
+ var type = 'reverse'; |
+ if (definer.scrollLeft > 0) { |
+ type = 'default'; |
+ } |
+ else { |
+ definer.scrollLeft = 1; |
+ if (definer.scrollLeft === 0) { |
+ type = 'negative'; |
+ } |
+ } |
+ assert_equals(type, 'default'); |
+ }, "Blink should have 'default' RTL scroll behavior"); |
+</script> |