Index: third_party/WebKit/LayoutTests/fast/scrolling/scroll-non-descendant-of-root-scroller.html |
diff --git a/third_party/WebKit/LayoutTests/fast/scrolling/scroll-non-descendant-of-root-scroller.html b/third_party/WebKit/LayoutTests/fast/scrolling/scroll-non-descendant-of-root-scroller.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..702f8f51b34861fff5d998d002c063427a25bae4 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/scrolling/scroll-non-descendant-of-root-scroller.html |
@@ -0,0 +1,111 @@ |
+<!DOCTYPE html> |
+<style> |
+ ::-webkit-scrollbar { |
+ width: 0px; |
+ height: 0px; |
+ } |
+ |
+ body, html { |
+ width: 100%; |
+ height: 100%; |
+ margin: 0px; |
+ } |
+ |
+ #rootscroller { |
+ width: 100%; |
+ height: 100%; |
+ overflow: auto; |
+ } |
+ |
+ #dialog { |
+ position: fixed; |
+ left: 50px; |
+ right: 50px; |
+ top: 50px; |
+ bottom: 50px; |
+ overflow: auto; |
+ } |
+ |
+ .bigspace { |
+ width: 2000px; |
+ height: 2000px; |
+ background-image: repeating-linear-gradient( |
+ 45deg, |
+ yellow, |
+ yellow 80px, |
+ orange 80px, |
+ orange 160px); |
+ } |
+ |
+ .bigspace2 { |
+ width: 2000px; |
+ height: 2000px; |
+ background-image: repeating-linear-gradient( |
+ -45deg, |
+ blue, |
+ blue 80px, |
+ red 80px, |
+ red 160px); |
+ } |
+ |
+</style> |
+ |
+<div id="rootscroller"> |
+ To test manually, try scrolling the red/orange box past the end. Scrolling |
+ shouldn't chain up to this blue/red box. |
+ <div class="bigspace2"></div> |
+</div> |
+<div id="dialog"> |
+ <div class="bigspace"></div> |
+</div> |
+ |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+ |
+<script> |
+ var rootScroller = document.querySelector('#rootscroller'); |
+ var dialog = document.querySelector('#dialog'); |
+ |
+ document.rootScroller = rootScroller; |
+ |
+ var dialogRect = dialog.getBoundingClientRect(); |
+ |
+ var x = dialogRect.left + dialogRect.width / 2; |
+ var y = dialogRect.top + dialogRect.height / 2; |
+ |
+ test(function() { |
+ if (!window.eventSender) |
+ return; |
+ |
+ // Sanity check - there should be no initial scroll. |
+ assert_equals(dialog.scrollLeft, 0); |
+ assert_equals(dialog.scrollTop, 0); |
+ assert_equals(rootscroller.scrollLeft, 0); |
+ assert_equals(rootscroller.scrollTop, 0); |
+ |
+ // This scroll should fully scroll the dialog |
+ eventSender.gestureScrollBegin(x, y); |
+ eventSender.gestureScrollUpdate(-3000, 0); |
+ eventSender.gestureScrollUpdate(0, -3000); |
+ eventSender.gestureScrollEnd(0, 0); |
+ |
+ assert_equals(dialog.scrollLeft, dialog.scrollWidth - dialog.clientWidth); |
+ assert_equals(dialog.scrollTop, dialog.scrollHeight - dialog.clientHeight); |
+ assert_equals(rootscroller.scrollLeft, 0); |
+ assert_equals(rootscroller.scrollTop, 0); |
+ |
+ // This scroll would normally chain up to the viewport but the "real" |
+ // viewport has no scrolling. Make sure we don't scroll the |
+ // document.rootScroller. |
+ eventSender.gestureScrollBegin(x, y); |
+ eventSender.gestureScrollUpdate(-3000, 0); |
+ eventSender.gestureScrollUpdate(0, -3000); |
+ eventSender.gestureScrollEnd(0, 0); |
+ |
+ assert_equals(dialog.scrollLeft, dialog.scrollWidth - dialog.clientWidth); |
+ assert_equals(dialog.scrollTop, dialog.scrollHeight - dialog.clientHeight); |
+ assert_equals(rootscroller.scrollLeft, 0); |
+ assert_equals(rootscroller.scrollTop, 0); |
+ |
+ }, 'Scrolls on the dialog should not chain to the sibling root scroller.'); |
+</script> |