Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: third_party/WebKit/LayoutTests/fast/scrolling/set-root-scroller.html

Issue 1970763002: Fixed up root scroller API to be more webby (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sigh...fix test expectation again, fix crash when there's no renderer Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/scrolling/set-root-scroller.html
diff --git a/third_party/WebKit/LayoutTests/fast/scrolling/set-root-scroller.html b/third_party/WebKit/LayoutTests/fast/scrolling/set-root-scroller.html
index 857f4fe7734ced6887e2501794dae28489eecaf5..ca9cdd4e8a6ceef29d12ef09d334aad0dee2b805 100644
--- a/third_party/WebKit/LayoutTests/fast/scrolling/set-root-scroller.html
+++ b/third_party/WebKit/LayoutTests/fast/scrolling/set-root-scroller.html
@@ -15,14 +15,23 @@
}
#container {
- width: 1000px;
- height: 1000px;
+ width: 100%;
+ height: 100%;
overflow: auto;
}
#spacer {
width: 2000px;
- height: 1900px;
+ height: 2000px;
+ }
+
+ #rootspacer {
+ width: 1000px;
+ height: 1000px;
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ z-index: -1;
}
</style>
@@ -31,33 +40,33 @@
<span id="spanner">TEST</span>
</div>
</div>
+<div id="rootspacer"></div>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
test(function() {
- assert_false(typeof document.setRootScroller === 'undefined');
+ assert_false(typeof document.rootScroller === 'undefined');
}, 'setRootScroller API enabled');
+
+ // TODO(bokan): Break this test up, failing asserts are hard to find.
test(function() {
// Setting the container object should succeed.
- assert_equals(document.rootScroller, document.documentElement);
+ assert_equals(document.rootScroller, null);
var container = document.querySelector('#container');
- document.setRootScroller(container);
+ document.rootScroller = container;
assert_equals(document.rootScroller, container);
- // Trying to set the <span> should fail with an exception thrown since a
- // span is not a valid scroller.
- assert_throws(
- 'InvalidStateError',
- function() {
- document.setRootScroller(document.querySelector('#spanner'));
- },
- 'Trying to set a non-block flow element should throw');
- assert_equals(document.rootScroller, container);
+ // Trying to set the <span> should succeed even though it's not a valid
+ // scroller.
+ var spanner = document.querySelector('#spanner');
+ document.rootScroller = spanner;
+ assert_equals(document.rootScroller, spanner);
// Scroll the container <div> past the end. The scrolls should not chain
// past the rootScroller to the scrollingElement.
+ document.rootScroller = container;
if (typeof eventSender !== 'undefined') {
eventSender.gestureScrollBegin(500, 500);
eventSender.gestureScrollUpdate(-300, -300);
@@ -70,24 +79,24 @@
eventSender.gestureScrollEnd(0, 0);
eventSender.gestureScrollBegin(500, 500);
eventSender.gestureScrollUpdate(-300, -300);
+ eventSender.gestureScrollUpdate(-300, -300);
+ eventSender.gestureScrollUpdate(-300, -300);
eventSender.gestureScrollEnd(0, 0);
- assert_equals(container.scrollTop, 900);
- assert_equals(container.scrollLeft, 1000);
+ assert_equals(container.scrollTop, 2000 - 600);
+ assert_equals(container.scrollLeft, 2000 - 800);
assert_equals(document.scrollingElement.scrollTop, 0);
assert_equals(document.scrollingElement.scrollLeft, 0);
}
- // Making the current rootScroller an invalid scroller should reset the
- // rootScroller to the default, the documentElement.
- container.style.display = "none";
- newRootScroller = document.rootScroller;
- assert_equals(newRootScroller, document.documentElement);
-
- container.style.display = "block";
- assert_equals(newRootScroller, document.documentElement);
+ // Making the current rootScroller an invalid scroller should fallback to
+ // the default element, the documentElement, but the rootScroller property
+ // should remain the same.
+ container.style.width = "95%";
+ assert_equals(document.rootScroller, container);
- // Now scrolling over the <div> should scroll the scrollingElement.
+ // Now scrolling over the <div> should scroll the scrollingElement since the
+ // rootElement is invalid (doesn't fill the viewport).
if (typeof eventSender !== 'undefined') {
eventSender.gestureScrollBegin(500, 500);
eventSender.gestureScrollUpdate(-300, -300);
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698