diff options
author | ajuma@chromium.org <ajuma@chromium.org> | 2014-12-08 20:02:01 +0000 |
---|---|---|
committer | ajuma@chromium.org <ajuma@chromium.org> | 2014-12-08 20:02:01 +0000 |
commit | d74d18675c698866dbe158ac2093412323a7e3f3 (patch) | |
tree | 11ea955fc6117dc91dabc1adecae4fb07f5524ec /third_party/WebKit/LayoutTests/fast/scroll-behavior | |
parent | c5de1fb4827143bbf473f176029ad64aee65e49f (diff) | |
download | chromium_src-d74d18675c698866dbe158ac2093412323a7e3f3.zip chromium_src-d74d18675c698866dbe158ac2093412323a7e3f3.tar.gz chromium_src-d74d18675c698866dbe158ac2093412323a7e3f3.tar.bz2 |
Update Element API for CSSOM smooth scrolling to match the spec
This updates the Element API for smooth scrolling to match changes to
the CSSOM View spec. Previously, the spec overloaded the setters for
scrollTop and scrollLeft, allowing these to take a ScrollOptions
dictionary. Now, the spec instead adds scroll, scrollTo, and scrollBy
methods that each take either a pair of doubles or a single
ScrollToOptions dictionary (just like the corresponding methods on
Window).
Smooth scrolling is behing a runtime flag.
Spec: http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface
BUG=243871
Review URL: https://codereview.chromium.org/782793002
git-svn-id: svn://svn.chromium.org/blink/trunk@186725 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/scroll-behavior')
49 files changed, 1661 insertions, 371 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll-expected.txt deleted file mode 100644 index d92a674..0000000 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll-expected.txt +++ /dev/null @@ -1,10 +0,0 @@ -Test that interrupting a smooth scroll on a listbox works with both scroll behaviors and with input - - -This is a testharness.js-based test. -FAIL instant scroll assert_equals: expected 3400 but got 6800 -FAIL smooth scroll assert_equals: expected 3400 but got 6800 -FAIL touch scroll assert_equals: expected 3400 but got 6800 -FAIL wheel scroll assert_equals: expected 3400 but got 6800 -Harness: the test ran to completion. - diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll.html deleted file mode 100644 index a05344c..0000000 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll.html +++ /dev/null @@ -1,69 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <script src="../../resources/testharness.js"></script> - <script src="../../resources/testharnessreport.js"></script> - <script src="resources/scroll-interruption-test.js"></script> - <script type="text/javascript"> - const numItems = 500; - - function jsScroll(y) { - document.getElementById('listbox').scrollTop = {y: y, behavior: 'smooth'}; - } - - function initializeContents(listbox) { - for (var i = 0; i < numItems; i++) { - var option = document.createElement('option'); - option.appendChild(document.createTextNode(i)); - listbox.appendChild(option); - } - } - - function convertIndexToScrollOffset(index, listbox, approximateItemHeight) { - var scrollOffset = Math.floor(index * approximateItemHeight); - - // The scroll offset set on a list box can get rounded to the nearest whole-item - // offset. We set and then readback the scroll offset to get the rounded value - // (so that the scroll offsets used during the test won't be subject to further - // rounding). - listbox.scrollTop = scrollOffset; - scrollOffset = listbox.scrollTop; - return scrollOffset; - } - - function initializeTest(indexTargets, targets, innerPoint, listbox) { - var approximateItemHeight = listbox.clientHeight / listbox.size; - - // Convert from listbox item index to scroll offset. - targets.y_min = convertIndexToScrollOffset(indexTargets.index_min, listbox, approximateItemHeight); - targets.y_mid = convertIndexToScrollOffset(indexTargets.index_mid, listbox, approximateItemHeight); - targets.y_max = convertIndexToScrollOffset(indexTargets.index_max, listbox, approximateItemHeight); - - var boundingRect = listbox.getBoundingClientRect(); - innerPoint.x = (boundingRect.left + boundingRect.right)/2; - innerPoint.y = (boundingRect.top + boundingRect.bottom)/2; - } - - function doTest() { - var indexTargets = {index_min: 3, index_mid: 200, index_max: 400}; - var targets = {}; - var innerPoint = {}; - var element = document.getElementById('listbox'); - initializeContents(element); - initializeTest(indexTargets, targets, innerPoint, element); - var scrollInterruptionTest = new SmoothScrollInterruptionTest(element, - innerPoint, - targets, - jsScroll); - scrollInterruptionTest.run(); - } - - window.addEventListener('load', doTest, false); - </script> -</head> - -<body> - <p>Test that interrupting a smooth scroll on a listbox works with both scroll behaviors and with input</p> - <select size="4" id="listbox"></select> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/listbox-scrollTop.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/listbox-scrollTop.html deleted file mode 100644 index 46e5483..0000000 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/listbox-scrollTop.html +++ /dev/null @@ -1,79 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <script src="../../resources/testharness.js"></script> - <script src="../../resources/testharnessreport.js"></script> - <script src="resources/scroll-behavior-test.js"></script> - <script type="text/javascript"> - const numItems = 500; - - function getEndPosition(testCase, startPosition) { - var endPosition = {}; - endPosition.x = startPosition.x; - endPosition.y = testCase.y; - return endPosition; - } - - function jsScroll(testCase) { - var element = document.getElementById("listbox"); - if (testCase.js) { - element.scrollTop = {y: testCase.y, behavior: testCase.js}; - } else { - element.scrollTop = testCase.y; - } - } - - var testScrolls = [ - {js: "instant", css: "auto", index: 2}, - {js: "instant", css: "smooth", index: 3}, - {js: "auto", css: "auto", index: 4}, - {js: "", css: "auto", index: 5}, - {js: "smooth", css: "auto", waitForEnd: true, index: 15}, - {js: "smooth", css: "smooth", waitForEnd: true, index: 20}, - {js: "auto", css: "smooth", waitForEnd: true, index: 30}, - {js: "", css: "smooth", waitForEnd: true, index: 35}, - {js: "smooth", css: "auto", waitForEnd: false, index: 410}, - {js: "smooth", css: "smooth", waitForEnd: false, index: 20}, - {js: "auto", css: "smooth", waitForEnd: false, index: 400}, - {js: "", css: "smooth", waitForEnd: false, index: 5}, - ]; - - function initializeContents(listbox) - { - for (var i = 0; i < numItems; i++) { - var option = document.createElement("option"); - option.appendChild(document.createTextNode(i)); - listbox.appendChild(option); - } - } - -function doTest() - { - var element = document.getElementById("listbox"); - initializeContents(element); - var itemHeight = Math.floor(listbox.clientHeight / listbox.size); - var testCases = []; - for (var i = 0; i < testScrolls.length; i++) { - // Convert from list box item index to a scroll offset. - testScrolls[i].y = testScrolls[i].index * itemHeight; - testScrolls[i].x = 0; - testCases.push(new ScrollBehaviorTestCase(testScrolls[i])); - } - - var scrollBehaviorTest = new ScrollBehaviorTest(element, - element, - testCases, - getEndPosition, - jsScroll); - scrollBehaviorTest.run(); - } - - window.addEventListener('load', doTest, false); - </script> -</head> - -<body> - <p>Test that setting scrollTop on a listbox works with both scroll behaviors</p> - <select size="4" id="listbox"></select> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scroll-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scroll-expected.txt new file mode 100644 index 0000000..8064c9d --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scroll-expected.txt @@ -0,0 +1,22 @@ +Test that calling scroll on the main frame's document element works with both scroll behaviors + +This is a testharness.js-based test. +PASS Scroll x:1, y:2, smooth:false +PASS Scroll x:2, y:3, smooth:false +PASS Scroll x:3, y:4, smooth:false +PASS Scroll x:4, y:5, smooth:false +PASS Scroll x:3, y:undefined, smooth:false +PASS Scroll x:undefined, y:4, smooth:false +PASS Scroll x:undefined, y:undefined, smooth:false +PASS Scroll x:10, y:15, smooth:true +PASS Scroll x:20, y:25, smooth:true +PASS Scroll x:30, y:35, smooth:true +PASS Scroll x:40, y:45, smooth:true +PASS Scroll x:45, y:undefined, smooth:true +PASS Scroll x:undefined, y:40, smooth:true +PASS Scroll x:4000, y:4100, smooth:true +PASS Scroll x:15, y:20, smooth:true +PASS Scroll x:4100, y:4000, smooth:true +PASS Scroll x:10, y:5, smooth:true +Harness: the test ran to completion. + diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scroll.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scroll.html new file mode 100644 index 0000000..102e56e --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scroll.html @@ -0,0 +1,86 @@ +<!DOCTYPE html> +<html> +<head> + <style> + #content { + width: 7500px; + height: 7500px; + background-color: blue; + } + </style> + <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharnessreport.js"></script> + <script src="resources/scroll-behavior-test.js"></script> + <script type="text/javascript"> + function getEndPosition(testCase, startPosition) { + var endPosition = {}; + if (testCase.x) + endPosition.x = testCase.x; + else + endPosition.x = startPosition.x; + + if (testCase.y) + endPosition.y = testCase.y; + else + endPosition.y = startPosition.y; + + return endPosition; + } + + function jsScroll(testCase) { + if (testCase.js) { + var scrollToOptions = {behavior: testCase.js}; + if (testCase.x) + scrollToOptions.left = testCase.x; + if (testCase.y) + scrollToOptions.top = testCase.y; + document.documentElement.scroll(scrollToOptions); + } else { + document.documentElement.scroll(testCase.x, testCase.y); + } + } + + const testScrolls = [ + {js: "instant", css: "auto", x: 1, y: 2}, + {js: "instant", css: "smooth", x: 2, y: 3}, + {js: "auto", css: "auto", x: 3, y: 4}, + {js: "", css: "auto", x: 4, y: 5}, + {js: "auto", css: "auto", x: 3}, + {js: "auto", css: "auto", y: 4}, + {js: "auto", css: "auto"}, + {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 15}, + {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 25}, + {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 35}, + {js: "", css: "smooth", waitForEnd: true, x: 40, y: 45}, + {js: "auto", css: "smooth", waitForEnd: true, x: 45}, + {js: "auto", css: "smooth", waitForEnd: true, y: 40}, + {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 4100}, + {js: "smooth", css: "smooth", waitForEnd: false, x: 15, y: 20}, + {js: "auto", css: "smooth", waitForEnd: false, x: 4100, y: 4000}, + {js: "", css: "smooth", waitForEnd: false, x: 10, y: 5}, + ]; + + function doTest() + { + var testCases = []; + for (var i = 0; i < testScrolls.length; i++) { + testCases.push(new ScrollBehaviorTestCase(testScrolls[i])); + } + + var scrollBehaviorTest = new ScrollBehaviorTest(document.documentElement, + document, + testCases, + getEndPosition, + jsScroll); + scrollBehaviorTest.run(); + } + + window.addEventListener('load', doTest, false); + </script> +</head> + +<body> + <p>Test that calling scroll on the main frame's document element works with both scroll behaviors</p> + <div id="content"></div> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scrollBy-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scrollBy-expected.txt new file mode 100644 index 0000000..b372df5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scrollBy-expected.txt @@ -0,0 +1,22 @@ +Test that calling scrollBy on the main frame's document element works with both scroll behaviors + +This is a testharness.js-based test. +PASS Scroll x:1, y:2, smooth:false +PASS Scroll x:2, y:3, smooth:false +PASS Scroll x:3, y:4, smooth:false +PASS Scroll x:4, y:5, smooth:false +PASS Scroll x:3, y:undefined, smooth:false +PASS Scroll x:undefined, y:4, smooth:false +PASS Scroll x:undefined, y:undefined, smooth:false +PASS Scroll x:10, y:15, smooth:true +PASS Scroll x:20, y:25, smooth:true +PASS Scroll x:30, y:35, smooth:true +PASS Scroll x:40, y:45, smooth:true +PASS Scroll x:-30, y:undefined, smooth:true +PASS Scroll x:undefined, y:-35, smooth:true +PASS Scroll x:4000, y:4100, smooth:true +PASS Scroll x:-3900, y:-3850, smooth:true +PASS Scroll x:4050, y:4000, smooth:true +PASS Scroll x:-4000, y:-4100, smooth:true +Harness: the test ran to completion. + diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scrollBy.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scrollBy.html new file mode 100644 index 0000000..4290157 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scrollBy.html @@ -0,0 +1,85 @@ +<!DOCTYPE html> +<html> +<head> + <style> + #content { + width: 7500px; + height: 7500px; + background-color: blue; + } + </style> + <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharnessreport.js"></script> + <script src="resources/scroll-behavior-test.js"></script> + <script type="text/javascript"> + function getEndPosition(testCase, startPosition) { + var endPosition = {}; + if (testCase.x) + endPosition.x = startPosition.x + testCase.x; + else + endPosition.x = startPosition.x; + + if (testCase.y) + endPosition.y = startPosition.y + testCase.y; + else + endPosition.y = startPosition.y; + return endPosition; + } + + function jsScroll(testCase) { + if (testCase.js) { + var scrollToOptions = {behavior: testCase.js}; + if (testCase.x) + scrollToOptions.left = testCase.x; + if (testCase.y) + scrollToOptions.top = testCase.y; + document.documentElement.scrollBy(scrollToOptions); + } else { + document.documentElement.scrollBy(testCase.x, testCase.y); + } + } + + const testScrolls = [ + {js: "instant", css: "auto", x: 1, y: 2}, + {js: "instant", css: "smooth", x: 2, y: 3}, + {js: "auto", css: "auto", x: 3, y: 4}, + {js: "", css: "auto", x: 4, y: 5}, + {js: "auto", css: "auto", x: 3}, + {js: "auto", css: "auto", y: 4}, + {js: "auto", css: "auto"}, + {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 15}, + {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 25}, + {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 35}, + {js: "", css: "smooth", waitForEnd: true, x: 40, y: 45}, + {js: "auto", css: "smooth", waitForEnd: true, x: -30}, + {js: "auto", css: "smooth", waitForEnd: true, y: -35}, + {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 4100}, + {js: "smooth", css: "smooth", waitForEnd: false, x: -3900, y: -3850}, + {js: "auto", css: "smooth", waitForEnd: false, x: 4050, y: 4000}, + {js: "", css: "smooth", waitForEnd: false, x: -4000, y: -4100}, + ]; + + function doTest() + { + var testCases = []; + for (var i = 0; i < testScrolls.length; i++) { + testCases.push(new ScrollBehaviorTestCase(testScrolls[i])); + } + + var scrollBehaviorTest = new ScrollBehaviorTest(document.documentElement, + document, + testCases, + getEndPosition, + jsScroll); + scrollBehaviorTest.run(); + } + + window.addEventListener('load', doTest, false); + </script> +</head> + +<body> + <p>Test that calling scrollBy on the main frame's document element works with both scroll behaviors</p> + <div id="content"></div> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scrollTo-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scrollTo-expected.txt new file mode 100644 index 0000000..a627167 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scrollTo-expected.txt @@ -0,0 +1,22 @@ +Test that calling scrollTo on the main frame's document element works with both scroll behaviors + +This is a testharness.js-based test. +PASS Scroll x:1, y:2, smooth:false +PASS Scroll x:2, y:3, smooth:false +PASS Scroll x:3, y:4, smooth:false +PASS Scroll x:4, y:5, smooth:false +PASS Scroll x:3, y:undefined, smooth:false +PASS Scroll x:undefined, y:4, smooth:false +PASS Scroll x:undefined, y:undefined, smooth:false +PASS Scroll x:10, y:15, smooth:true +PASS Scroll x:20, y:25, smooth:true +PASS Scroll x:30, y:35, smooth:true +PASS Scroll x:40, y:45, smooth:true +PASS Scroll x:45, y:undefined, smooth:true +PASS Scroll x:undefined, y:40, smooth:true +PASS Scroll x:4000, y:4100, smooth:true +PASS Scroll x:15, y:20, smooth:true +PASS Scroll x:4100, y:4000, smooth:true +PASS Scroll x:10, y:5, smooth:true +Harness: the test ran to completion. + diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scrollTo.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scrollTo.html new file mode 100644 index 0000000..da86301 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-element-scrollTo.html @@ -0,0 +1,86 @@ +<!DOCTYPE html> +<html> +<head> + <style> + #content { + width: 7500px; + height: 7500px; + background-color: blue; + } + </style> + <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharnessreport.js"></script> + <script src="resources/scroll-behavior-test.js"></script> + <script type="text/javascript"> + function getEndPosition(testCase, startPosition) { + var endPosition = {}; + if (testCase.x) + endPosition.x = testCase.x; + else + endPosition.x = startPosition.x; + + if (testCase.y) + endPosition.y = testCase.y; + else + endPosition.y = startPosition.y; + + return endPosition; + } + + function jsScroll(testCase) { + if (testCase.js) { + var scrollToOptions = {behavior: testCase.js}; + if (testCase.x) + scrollToOptions.left = testCase.x; + if (testCase.y) + scrollToOptions.top = testCase.y; + document.documentElement.scrollTo(scrollToOptions); + } else { + document.documentElement.scrollTo(testCase.x, testCase.y); + } + } + + const testScrolls = [ + {js: "instant", css: "auto", x: 1, y: 2}, + {js: "instant", css: "smooth", x: 2, y: 3}, + {js: "auto", css: "auto", x: 3, y: 4}, + {js: "", css: "auto", x: 4, y: 5}, + {js: "auto", css: "auto", x: 3}, + {js: "auto", css: "auto", y: 4}, + {js: "auto", css: "auto"}, + {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 15}, + {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 25}, + {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 35}, + {js: "", css: "smooth", waitForEnd: true, x: 40, y: 45}, + {js: "auto", css: "smooth", waitForEnd: true, x: 45}, + {js: "auto", css: "smooth", waitForEnd: true, y: 40}, + {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 4100}, + {js: "smooth", css: "smooth", waitForEnd: false, x: 15, y: 20}, + {js: "auto", css: "smooth", waitForEnd: false, x: 4100, y: 4000}, + {js: "", css: "smooth", waitForEnd: false, x: 10, y: 5}, + ]; + + function doTest() + { + var testCases = []; + for (var i = 0; i < testScrolls.length; i++) { + testCases.push(new ScrollBehaviorTestCase(testScrolls[i])); + } + + var scrollBehaviorTest = new ScrollBehaviorTest(document.documentElement, + document, + testCases, + getEndPosition, + jsScroll); + scrollBehaviorTest.run(); + } + + window.addEventListener('load', doTest, false); + </script> +</head> + +<body> + <p>Test that calling scrollTo on the main frame's document element works with both scroll behaviors</p> + <div id="content"></div> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scroll-in-quirks-mode-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scroll-in-quirks-mode-expected.txt new file mode 100644 index 0000000..94ebb00 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scroll-in-quirks-mode-expected.txt @@ -0,0 +1,44 @@ +Test that calling scroll methods on the body element scrolls the viewport in quirks mode + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS successfullyParsed is true + +TEST COMPLETE +Test that "scroll" on the document element does not scroll +PASS document.documentElement.scrollTop is 0 +PASS document.documentElement.scrollLeft is 0 +PASS document.body.scrollTop is 0 +PASS document.body.scrollLeft is 0 + +Test that "scrollTo" on the document element does not scroll +PASS document.documentElement.scrollTop is 0 +PASS document.documentElement.scrollLeft is 0 +PASS document.body.scrollTop is 0 +PASS document.body.scrollLeft is 0 + +Test that "scrollBy" on the document element does not scroll +PASS document.documentElement.scrollTop is 0 +PASS document.documentElement.scrollLeft is 0 +PASS document.body.scrollTop is 0 +PASS document.body.scrollLeft is 0 + +Test that "scroll" on the body element scrolls +PASS document.documentElement.scrollTop is 0 +PASS document.documentElement.scrollLeft is 0 +PASS document.body.scrollTop is 100 +PASS document.body.scrollLeft is 50 + +Test that "scrollTo" on the body element scrolls +PASS document.documentElement.scrollTop is 0 +PASS document.documentElement.scrollLeft is 0 +PASS document.body.scrollTop is 200 +PASS document.body.scrollLeft is 450 + +Test that "scrollBy" on the body element scrolls +PASS document.documentElement.scrollTop is 0 +PASS document.documentElement.scrollLeft is 0 +PASS document.body.scrollTop is 300 +PASS document.body.scrollLeft is 750 + diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scroll-in-quirks-mode.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scroll-in-quirks-mode.html new file mode 100644 index 0000000..bbf45c5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scroll-in-quirks-mode.html @@ -0,0 +1,68 @@ +<html> +<head> + <style> + #content { + width: 7500px; + height: 7500px; + background-color: blue; + } + </style> + <script src="../../resources/js-test.js"></script> + <script> + onload = function() { + description('Test that calling scroll methods on the body element scrolls the viewport in quirks mode'); + + debug('Test that "scroll" on the document element does not scroll'); + document.documentElement.scroll(100, 100); + shouldBe("document.documentElement.scrollTop", "0"); + shouldBe("document.documentElement.scrollLeft", "0"); + shouldBe("document.body.scrollTop", "0"); + shouldBe("document.body.scrollLeft", "0"); + + debug(''); + debug('Test that "scrollTo" on the document element does not scroll'); + document.documentElement.scrollTo(100, 100); + shouldBe("document.documentElement.scrollTop", "0"); + shouldBe("document.documentElement.scrollLeft", "0"); + shouldBe("document.body.scrollTop", "0"); + shouldBe("document.body.scrollLeft", "0"); + + debug(''); + debug('Test that "scrollBy" on the document element does not scroll'); + document.documentElement.scrollBy(100, 100); + shouldBe("document.documentElement.scrollTop", "0"); + shouldBe("document.documentElement.scrollLeft", "0"); + shouldBe("document.body.scrollTop", "0"); + shouldBe("document.body.scrollLeft", "0"); + + debug(''); + debug('Test that "scroll" on the body element scrolls'); + document.body.scroll(50, 100); + shouldBe("document.documentElement.scrollTop", "0"); + shouldBe("document.documentElement.scrollLeft", "0"); + shouldBe("document.body.scrollTop", "100"); + shouldBe("document.body.scrollLeft", "50"); + + debug(''); + debug('Test that "scrollTo" on the body element scrolls'); + document.body.scrollTo(450, 200); + shouldBe("document.documentElement.scrollTop", "0"); + shouldBe("document.documentElement.scrollLeft", "0"); + shouldBe("document.body.scrollTop", "200"); + shouldBe("document.body.scrollLeft", "450"); + + debug(''); + debug('Test that "scrollBy" on the body element scrolls'); + document.body.scrollBy(300, 100); + shouldBe("document.documentElement.scrollTop", "0"); + shouldBe("document.documentElement.scrollLeft", "0"); + shouldBe("document.body.scrollTop", "300"); + shouldBe("document.body.scrollLeft", "750"); + } + </script> +</head> + +<body> + <div id="content"></div> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scroll-in-standards-mode-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scroll-in-standards-mode-expected.txt new file mode 100644 index 0000000..400583a --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scroll-in-standards-mode-expected.txt @@ -0,0 +1,44 @@ +Test that calling scroll methods on the body element does not scroll the viewport in standards mode + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS successfullyParsed is true + +TEST COMPLETE +Test that "scroll" on the body element does not scroll +PASS document.body.scrollTop is 0 +PASS document.body.scrollLeft is 0 +PASS document.documentElement.scrollTop is 0 +PASS document.documentElement.scrollLeft is 0 + +Test that "scrollTo" on the body element does not scroll +PASS document.body.scrollTop is 0 +PASS document.body.scrollLeft is 0 +PASS document.documentElement.scrollTop is 0 +PASS document.documentElement.scrollLeft is 0 + +Test that "scrollBy" on the body element does not scroll +PASS document.body.scrollTop is 0 +PASS document.body.scrollLeft is 0 +PASS document.documentElement.scrollTop is 0 +PASS document.documentElement.scrollLeft is 0 + +Test that "scroll" on the document element scrolls +PASS document.body.scrollTop is 0 +PASS document.body.scrollLeft is 0 +PASS document.documentElement.scrollTop is 100 +PASS document.documentElement.scrollLeft is 50 + +Test that "scrollTo" on the document element scrolls +PASS document.body.scrollTop is 0 +PASS document.body.scrollLeft is 0 +PASS document.documentElement.scrollTop is 200 +PASS document.documentElement.scrollLeft is 450 + +Test that "scrollBy" on the document element scrolls +PASS document.body.scrollTop is 0 +PASS document.body.scrollLeft is 0 +PASS document.documentElement.scrollTop is 300 +PASS document.documentElement.scrollLeft is 750 + diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scroll-in-standards-mode.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scroll-in-standards-mode.html new file mode 100644 index 0000000..0e530f1 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scroll-in-standards-mode.html @@ -0,0 +1,69 @@ +<!DOCTYPE html> +<html> +<head> + <style> + #content { + width: 7500px; + height: 7500px; + background-color: blue; + } + </style> + <script src="../../resources/js-test.js"></script> + <script> + onload = function() { + description('Test that calling scroll methods on the body element does not scroll the viewport in standards mode'); + + debug('Test that "scroll" on the body element does not scroll'); + document.body.scroll(100, 100); + shouldBe("document.body.scrollTop", "0"); + shouldBe("document.body.scrollLeft", "0"); + shouldBe("document.documentElement.scrollTop", "0"); + shouldBe("document.documentElement.scrollLeft", "0"); + + debug(''); + debug('Test that "scrollTo" on the body element does not scroll'); + document.body.scrollTo(100, 100); + shouldBe("document.body.scrollTop", "0"); + shouldBe("document.body.scrollLeft", "0"); + shouldBe("document.documentElement.scrollTop", "0"); + shouldBe("document.documentElement.scrollLeft", "0"); + + debug(''); + debug('Test that "scrollBy" on the body element does not scroll'); + document.body.scrollBy(100, 100); + shouldBe("document.body.scrollTop", "0"); + shouldBe("document.body.scrollLeft", "0"); + shouldBe("document.documentElement.scrollTop", "0"); + shouldBe("document.documentElement.scrollLeft", "0"); + + debug(''); + debug('Test that "scroll" on the document element scrolls'); + document.documentElement.scroll(50, 100); + shouldBe("document.body.scrollTop", "0"); + shouldBe("document.body.scrollLeft", "0"); + shouldBe("document.documentElement.scrollTop", "100"); + shouldBe("document.documentElement.scrollLeft", "50"); + + debug(''); + debug('Test that "scrollTo" on the document element scrolls'); + document.documentElement.scrollTo(450, 200); + shouldBe("document.body.scrollTop", "0"); + shouldBe("document.body.scrollLeft", "0"); + shouldBe("document.documentElement.scrollTop", "200"); + shouldBe("document.documentElement.scrollLeft", "450"); + + debug(''); + debug('Test that "scrollBy" on the document element scrolls'); + document.documentElement.scrollBy(300, 100); + shouldBe("document.body.scrollTop", "0"); + shouldBe("document.body.scrollLeft", "0"); + shouldBe("document.documentElement.scrollTop", "300"); + shouldBe("document.documentElement.scrollLeft", "750"); + } + </script> +</head> + +<body> + <div id="content"></div> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollLeft-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollLeft-expected.txt index a601aad..dec060a 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollLeft-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollLeft-expected.txt @@ -2,16 +2,10 @@ Test that setting scrollLeft on the main frame works with both scroll behaviors This is a testharness.js-based test. PASS Scroll x:1, y:0, smooth:false -PASS Scroll x:2, y:0, smooth:false -PASS Scroll x:3, y:0, smooth:false PASS Scroll x:4, y:0, smooth:false -FAIL Scroll x:10, y:0, smooth:true assert_equals: expected "4, 0" but got "10, 0" -FAIL Scroll x:20, y:0, smooth:true assert_equals: expected "10, 0" but got "20, 0" -FAIL Scroll x:30, y:0, smooth:true assert_equals: expected "20, 0" but got "30, 0" -FAIL Scroll x:40, y:0, smooth:true assert_equals: expected "30, 0" but got "40, 0" -FAIL Scroll x:4000, y:0, smooth:true assert_equals: expected "40, 0" but got "4000, 0" -FAIL Scroll x:15, y:0, smooth:true assert_equals: expected "4000, 0" but got "15, 0" -FAIL Scroll x:4100, y:0, smooth:true assert_equals: expected "15, 0" but got "4100, 0" -FAIL Scroll x:10, y:0, smooth:true assert_equals: expected "4100, 0" but got "10, 0" +PASS Scroll x:20, y:0, smooth:true +PASS Scroll x:40, y:0, smooth:true +PASS Scroll x:4000, y:0, smooth:true +PASS Scroll x:10, y:0, smooth:true Harness: the test ran to completion. diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollLeft.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollLeft.html index 175593d..68c3f69 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollLeft.html +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollLeft.html @@ -20,26 +20,16 @@ } function jsScroll(testCase) { - if (testCase.js) { - document.documentElement.scrollLeft = {x: testCase.x, behavior: testCase.js}; - } else { - document.documentElement.scrollLeft = testCase.x; - } + document.documentElement.scrollLeft = testCase.x; } const testScrolls = [ - {js: "instant", css: "auto", x: 1, y: 0}, - {js: "instant", css: "smooth", x: 2, y: 0}, - {js: "auto", css: "auto", x: 3, y: 0}, - {js: "", css: "auto", x: 4, y: 0}, - {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 0}, - {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 0}, - {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 0}, - {js: "", css: "smooth", waitForEnd: true, x: 40, y: 0}, - {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 0}, - {js: "smooth", css: "smooth", waitForEnd: false, x: 15, y: 0}, - {js: "auto", css: "smooth", waitForEnd: false, x: 4100, y: 0}, - {js: "", css: "smooth", waitForEnd: false, x: 10, y: 0}, + {css: "auto", x: 1, y: 0}, + {css: "auto", x: 4, y: 0}, + {css: "smooth", waitForEnd: true, x: 20, y: 0}, + {css: "smooth", waitForEnd: true, x: 40, y: 0}, + {css: "smooth", waitForEnd: false, x: 4000, y: 0}, + {css: "smooth", waitForEnd: false, x: 10, y: 0}, ]; function doTest() diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollTop-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollTop-expected.txt index 61153e4..47e368d 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollTop-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollTop-expected.txt @@ -2,16 +2,10 @@ Test that setting scrollTop on the main frame works with both scroll behaviors This is a testharness.js-based test. PASS Scroll x:0, y:2, smooth:false -PASS Scroll x:0, y:3, smooth:false PASS Scroll x:0, y:4, smooth:false -PASS Scroll x:0, y:5, smooth:false -FAIL Scroll x:0, y:15, smooth:true assert_equals: expected "0, 5" but got "0, 15" -FAIL Scroll x:0, y:25, smooth:true assert_equals: expected "0, 15" but got "0, 25" -FAIL Scroll x:0, y:35, smooth:true assert_equals: expected "0, 25" but got "0, 35" -FAIL Scroll x:0, y:45, smooth:true assert_equals: expected "0, 35" but got "0, 45" -FAIL Scroll x:0, y:4100, smooth:true assert_equals: expected "0, 45" but got "0, 4100" -FAIL Scroll x:0, y:20, smooth:true assert_equals: expected "0, 4100" but got "0, 20" -FAIL Scroll x:0, y:4000, smooth:true assert_equals: expected "0, 20" but got "0, 4000" -FAIL Scroll x:0, y:5, smooth:true assert_equals: expected "0, 4000" but got "0, 5" +PASS Scroll x:0, y:25, smooth:true +PASS Scroll x:0, y:45, smooth:true +PASS Scroll x:0, y:4100, smooth:true +PASS Scroll x:0, y:20, smooth:true Harness: the test ran to completion. diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollTop.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollTop.html index c947043..7445e80 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollTop.html +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/main-frame-scrollTop.html @@ -20,26 +20,16 @@ } function jsScroll(testCase) { - if (testCase.js) { - document.documentElement.scrollTop = {y: testCase.y, behavior: testCase.js}; - } else { - document.documentElement.scrollTop = testCase.y; - } + document.documentElement.scrollTop = testCase.y; } const testScrolls = [ - {js: "instant", css: "auto", x: 0, y: 2}, - {js: "instant", css: "smooth", x: 0, y: 3}, - {js: "auto", css: "auto", x: 0, y: 4}, - {js: "", css: "auto", x: 0, y: 5}, - {js: "smooth", css: "auto", waitForEnd: true, x: 0, y: 15}, - {js: "smooth", css: "smooth", waitForEnd: true, x: 0, y: 25}, - {js: "auto", css: "smooth", waitForEnd: true, x: 0, y: 35}, - {js: "", css: "smooth", waitForEnd: true, x: 0, y: 45}, - {js: "smooth", css: "auto", waitForEnd: false, x: 0, y: 4100}, - {js: "smooth", css: "smooth", waitForEnd: false, x: 0, y: 20}, - {js: "auto", css: "smooth", waitForEnd: false, x: 0, y: 4000}, - {js: "", css: "smooth", waitForEnd: false, x: 0, y: 5}, + {css: "auto", x: 0, y: 2}, + {css: "auto", x: 0, y: 4}, + {css: "smooth", waitForEnd: true, x: 0, y: 25}, + {css: "smooth", waitForEnd: true, x: 0, y: 45}, + {css: "smooth", waitForEnd: false, x: 0, y: 4100}, + {css: "smooth", waitForEnd: false, x: 0, y: 20}, ]; function doTest() diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scroll-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scroll-expected.txt new file mode 100644 index 0000000..aab1432 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scroll-expected.txt @@ -0,0 +1,22 @@ +Test that calling scroll on an overflow:hidden element works with both scroll behaviors + +This is a testharness.js-based test. +PASS Scroll x:1, y:2, smooth:false +PASS Scroll x:2, y:3, smooth:false +PASS Scroll x:3, y:4, smooth:false +PASS Scroll x:4, y:5, smooth:false +PASS Scroll x:3, y:undefined, smooth:false +PASS Scroll x:undefined, y:4, smooth:false +PASS Scroll x:undefined, y:undefined, smooth:false +FAIL Scroll x:10, y:15, smooth:true assert_equals: expected "3, 4" but got "10, 15" +FAIL Scroll x:20, y:25, smooth:true assert_equals: expected "10, 15" but got "20, 25" +FAIL Scroll x:30, y:35, smooth:true assert_equals: expected "20, 25" but got "30, 35" +FAIL Scroll x:40, y:45, smooth:true assert_equals: expected "30, 35" but got "40, 45" +FAIL Scroll x:45, y:undefined, smooth:true assert_equals: expected "40, 45" but got "45, 45" +FAIL Scroll x:undefined, y:40, smooth:true assert_equals: expected "45, 45" but got "45, 40" +FAIL Scroll x:4000, y:4100, smooth:true assert_equals: expected "45, 40" but got "4000, 4100" +FAIL Scroll x:15, y:20, smooth:true assert_equals: expected "4000, 4100" but got "15, 20" +FAIL Scroll x:4100, y:4000, smooth:true assert_equals: expected "15, 20" but got "4100, 4000" +FAIL Scroll x:10, y:5, smooth:true assert_equals: expected "4100, 4000" but got "10, 5" +Harness: the test ran to completion. + diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scroll.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scroll.html new file mode 100644 index 0000000..b4bf3d4 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scroll.html @@ -0,0 +1,95 @@ +<!DOCTYPE html> +<html> +<head> + <style> + #container { + width: 200px; + height: 200px; + overflow: hidden; + } + + #content { + width: 7500px; + height: 7500px; + background-color: blue; + } + </style> + <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharnessreport.js"></script> + <script src="resources/scroll-behavior-test.js"></script> + <script type="text/javascript"> + function getEndPosition(testCase, startPosition) { + var endPosition = {}; + if (testCase.x) + endPosition.x = testCase.x; + else + endPosition.x = startPosition.x; + + if (testCase.y) + endPosition.y = testCase.y; + else + endPosition.y = startPosition.y; + + return endPosition; + } + + function jsScroll(testCase) { + if (testCase.js) { + var scrollToOptions = {behavior: testCase.js}; + if (testCase.x) + scrollToOptions.left = testCase.x; + if (testCase.y) + scrollToOptions.top = testCase.y; + document.getElementById("container").scroll(scrollToOptions); + } else { + document.getElementById("container").scroll(testCase.x, testCase.y); + } + } + + const testScrolls = [ + {js: "instant", css: "auto", x: 1, y: 2}, + {js: "instant", css: "smooth", x: 2, y: 3}, + {js: "auto", css: "auto", x: 3, y: 4}, + {js: "", css: "auto", x: 4, y: 5}, + {js: "auto", css: "auto", x: 3}, + {js: "auto", css: "auto", y: 4}, + {js: "auto", css: "auto"}, + {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 15}, + {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 25}, + {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 35}, + {js: "", css: "smooth", waitForEnd: true, x: 40, y: 45}, + {js: "auto", css: "smooth", waitForEnd: true, x: 45}, + {js: "auto", css: "smooth", waitForEnd: true, y: 40}, + {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 4100}, + {js: "smooth", css: "smooth", waitForEnd: false, x: 15, y: 20}, + {js: "auto", css: "smooth", waitForEnd: false, x: 4100, y: 4000}, + {js: "", css: "smooth", waitForEnd: false, x: 10, y: 5}, + ]; + + function doTest() + { + var testCases = []; + for (var i = 0; i < testScrolls.length; i++) { + testCases.push(new ScrollBehaviorTestCase(testScrolls[i])); + } + + var element = document.getElementById("container"); + var scrollBehaviorTest = new ScrollBehaviorTest(element, + element, + testCases, + getEndPosition, + jsScroll); + scrollBehaviorTest.run(); + } + + window.addEventListener('load', doTest, false); + </script> +</head> + +<body> + <p>Test that calling scroll on an overflow:hidden element works with both scroll behaviors</p> + <div id="container"> + <div id="content"></div> + </div> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollBy-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollBy-expected.txt new file mode 100644 index 0000000..616028d --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollBy-expected.txt @@ -0,0 +1,22 @@ +Test that calling scrollBy on an overflow:hidden element works with both scroll behaviors + +This is a testharness.js-based test. +PASS Scroll x:1, y:2, smooth:false +PASS Scroll x:2, y:3, smooth:false +PASS Scroll x:3, y:4, smooth:false +PASS Scroll x:4, y:5, smooth:false +PASS Scroll x:3, y:undefined, smooth:false +PASS Scroll x:undefined, y:4, smooth:false +PASS Scroll x:undefined, y:undefined, smooth:false +FAIL Scroll x:10, y:15, smooth:true assert_equals: expected "13, 18" but got "23, 33" +FAIL Scroll x:20, y:25, smooth:true assert_equals: expected "23, 33" but got "43, 58" +FAIL Scroll x:30, y:35, smooth:true assert_equals: expected "43, 58" but got "73, 93" +FAIL Scroll x:40, y:45, smooth:true assert_equals: expected "73, 93" but got "113, 138" +FAIL Scroll x:-30, y:undefined, smooth:true assert_equals: expected "113, 138" but got "83, 138" +FAIL Scroll x:undefined, y:-35, smooth:true assert_equals: expected "83, 138" but got "83, 103" +FAIL Scroll x:4000, y:4100, smooth:true assert_equals: expected "83, 103" but got "4083, 4203" +FAIL Scroll x:-3900, y:-3850, smooth:true assert_equals: expected "4083, 4203" but got "183, 353" +FAIL Scroll x:4050, y:4000, smooth:true assert_equals: expected "183, 353" but got "4233, 4353" +FAIL Scroll x:-4000, y:-4100, smooth:true assert_equals: expected "4233, 4353" but got "233, 253" +Harness: the test ran to completion. + diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollBy.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollBy.html new file mode 100644 index 0000000..b609c97 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollBy.html @@ -0,0 +1,94 @@ +<!DOCTYPE html> +<html> +<head> + <style> + #container { + width: 200px; + height: 200px; + overflow: hidden; + } + + #content { + width: 7500px; + height: 7500px; + background-color: blue; + } + </style> + <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharnessreport.js"></script> + <script src="resources/scroll-behavior-test.js"></script> + <script type="text/javascript"> + function getEndPosition(testCase, startPosition) { + var endPosition = {}; + if (testCase.x) + endPosition.x = startPosition.x + testCase.x; + else + endPosition.x = startPosition.x; + + if (testCase.y) + endPosition.y = startPosition.y + testCase.y; + else + endPosition.y = startPosition.y; + return endPosition; + } + + function jsScroll(testCase) { + if (testCase.js) { + var scrollToOptions = {behavior: testCase.js}; + if (testCase.x) + scrollToOptions.left = testCase.x; + if (testCase.y) + scrollToOptions.top = testCase.y; + document.getElementById("container").scrollBy(scrollToOptions); + } else { + document.getElementById("container").scrollBy(testCase.x, testCase.y); + } + } + + const testScrolls = [ + {js: "instant", css: "auto", x: 1, y: 2}, + {js: "instant", css: "smooth", x: 2, y: 3}, + {js: "auto", css: "auto", x: 3, y: 4}, + {js: "", css: "auto", x: 4, y: 5}, + {js: "auto", css: "auto", x: 3}, + {js: "auto", css: "auto", y: 4}, + {js: "auto", css: "auto"}, + {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 15}, + {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 25}, + {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 35}, + {js: "", css: "smooth", waitForEnd: true, x: 40, y: 45}, + {js: "auto", css: "smooth", waitForEnd: true, x: -30}, + {js: "auto", css: "smooth", waitForEnd: true, y: -35}, + {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 4100}, + {js: "smooth", css: "smooth", waitForEnd: false, x: -3900, y: -3850}, + {js: "auto", css: "smooth", waitForEnd: false, x: 4050, y: 4000}, + {js: "", css: "smooth", waitForEnd: false, x: -4000, y: -4100}, + ]; + + function doTest() + { + var testCases = []; + for (var i = 0; i < testScrolls.length; i++) { + testCases.push(new ScrollBehaviorTestCase(testScrolls[i])); + } + + var element = document.getElementById("container"); + var scrollBehaviorTest = new ScrollBehaviorTest(element, + element, + testCases, + getEndPosition, + jsScroll); + scrollBehaviorTest.run(); + } + + window.addEventListener('load', doTest, false); + </script> +</head> + +<body> + <p>Test that calling scrollBy on an overflow:hidden element works with both scroll behaviors</p> + <div id="container"> + <div id="content"></div> + </div> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollLeft-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollLeft-expected.txt index 6a5138d..32cc416 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollLeft-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollLeft-expected.txt @@ -2,16 +2,10 @@ Test that setting scrollLeft on an overflow:hidden element works with both scrol This is a testharness.js-based test. PASS Scroll x:1, y:0, smooth:false -PASS Scroll x:2, y:0, smooth:false -PASS Scroll x:3, y:0, smooth:false PASS Scroll x:4, y:0, smooth:false -FAIL Scroll x:10, y:0, smooth:true assert_equals: expected "4, 0" but got "10, 0" -FAIL Scroll x:20, y:0, smooth:true assert_equals: expected "10, 0" but got "20, 0" -FAIL Scroll x:30, y:0, smooth:true assert_equals: expected "20, 0" but got "30, 0" -FAIL Scroll x:40, y:0, smooth:true assert_equals: expected "30, 0" but got "40, 0" +FAIL Scroll x:20, y:0, smooth:true assert_equals: expected "4, 0" but got "20, 0" +FAIL Scroll x:40, y:0, smooth:true assert_equals: expected "20, 0" but got "40, 0" FAIL Scroll x:4000, y:0, smooth:true assert_equals: expected "40, 0" but got "4000, 0" -FAIL Scroll x:15, y:0, smooth:true assert_equals: expected "4000, 0" but got "15, 0" -FAIL Scroll x:4100, y:0, smooth:true assert_equals: expected "15, 0" but got "4100, 0" -FAIL Scroll x:10, y:0, smooth:true assert_equals: expected "4100, 0" but got "10, 0" +FAIL Scroll x:10, y:0, smooth:true assert_equals: expected "4000, 0" but got "10, 0" Harness: the test ran to completion. diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollLeft.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollLeft.html index 731fac6..bc6123e 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollLeft.html +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollLeft.html @@ -27,26 +27,16 @@ function jsScroll(testCase) { var element = document.getElementById("container"); - if (testCase.js) { - element.scrollLeft = {x: testCase.x, behavior: testCase.js}; - } else { - element.scrollLeft = testCase.x; - } + element.scrollLeft = testCase.x; } const testScrolls = [ - {js: "instant", css: "auto", x: 1, y: 0}, - {js: "instant", css: "smooth", x: 2, y: 0}, - {js: "auto", css: "auto", x: 3, y: 0}, - {js: "", css: "auto", x: 4, y: 0}, - {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 0}, - {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 0}, - {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 0}, - {js: "", css: "smooth", waitForEnd: true, x: 40, y: 0}, - {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 0}, - {js: "smooth", css: "smooth", waitForEnd: false, x: 15, y: 0}, - {js: "auto", css: "smooth", waitForEnd: false, x: 4100, y: 0}, - {js: "", css: "smooth", waitForEnd: false, x: 10, y: 0}, + {css: "auto", x: 1, y: 0}, + {css: "auto", x: 4, y: 0}, + {css: "smooth", waitForEnd: true, x: 20, y: 0}, + {css: "smooth", waitForEnd: true, x: 40, y: 0}, + {css: "smooth", waitForEnd: false, x: 4000, y: 0}, + {css: "smooth", waitForEnd: false, x: 10, y: 0}, ]; function doTest() diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollTo-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollTo-expected.txt new file mode 100644 index 0000000..bee4c48 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollTo-expected.txt @@ -0,0 +1,22 @@ +Test that calling scrollTo on an overflow:hidden element works with both scroll behaviors + +This is a testharness.js-based test. +PASS Scroll x:1, y:2, smooth:false +PASS Scroll x:2, y:3, smooth:false +PASS Scroll x:3, y:4, smooth:false +PASS Scroll x:4, y:5, smooth:false +PASS Scroll x:3, y:undefined, smooth:false +PASS Scroll x:undefined, y:4, smooth:false +PASS Scroll x:undefined, y:undefined, smooth:false +FAIL Scroll x:10, y:15, smooth:true assert_equals: expected "3, 4" but got "10, 15" +FAIL Scroll x:20, y:25, smooth:true assert_equals: expected "10, 15" but got "20, 25" +FAIL Scroll x:30, y:35, smooth:true assert_equals: expected "20, 25" but got "30, 35" +FAIL Scroll x:40, y:45, smooth:true assert_equals: expected "30, 35" but got "40, 45" +FAIL Scroll x:45, y:undefined, smooth:true assert_equals: expected "40, 45" but got "45, 45" +FAIL Scroll x:undefined, y:40, smooth:true assert_equals: expected "45, 45" but got "45, 40" +FAIL Scroll x:4000, y:4100, smooth:true assert_equals: expected "45, 40" but got "4000, 4100" +FAIL Scroll x:15, y:20, smooth:true assert_equals: expected "4000, 4100" but got "15, 20" +FAIL Scroll x:4100, y:4000, smooth:true assert_equals: expected "15, 20" but got "4100, 4000" +FAIL Scroll x:10, y:5, smooth:true assert_equals: expected "4100, 4000" but got "10, 5" +Harness: the test ran to completion. + diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollTo.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollTo.html new file mode 100644 index 0000000..783b157 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollTo.html @@ -0,0 +1,95 @@ +<!DOCTYPE html> +<html> +<head> + <style> + #container { + width: 200px; + height: 200px; + overflow: hidden; + } + + #content { + width: 7500px; + height: 7500px; + background-color: blue; + } + </style> + <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharnessreport.js"></script> + <script src="resources/scroll-behavior-test.js"></script> + <script type="text/javascript"> + function getEndPosition(testCase, startPosition) { + var endPosition = {}; + if (testCase.x) + endPosition.x = testCase.x; + else + endPosition.x = startPosition.x; + + if (testCase.y) + endPosition.y = testCase.y; + else + endPosition.y = startPosition.y; + + return endPosition; + } + + function jsScroll(testCase) { + if (testCase.js) { + var scrollToOptions = {behavior: testCase.js}; + if (testCase.x) + scrollToOptions.left = testCase.x; + if (testCase.y) + scrollToOptions.top = testCase.y; + document.getElementById("container").scrollTo(scrollToOptions); + } else { + document.getElementById("container").scrollTo(testCase.x, testCase.y); + } + } + + const testScrolls = [ + {js: "instant", css: "auto", x: 1, y: 2}, + {js: "instant", css: "smooth", x: 2, y: 3}, + {js: "auto", css: "auto", x: 3, y: 4}, + {js: "", css: "auto", x: 4, y: 5}, + {js: "auto", css: "auto", x: 3}, + {js: "auto", css: "auto", y: 4}, + {js: "auto", css: "auto"}, + {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 15}, + {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 25}, + {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 35}, + {js: "", css: "smooth", waitForEnd: true, x: 40, y: 45}, + {js: "auto", css: "smooth", waitForEnd: true, x: 45}, + {js: "auto", css: "smooth", waitForEnd: true, y: 40}, + {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 4100}, + {js: "smooth", css: "smooth", waitForEnd: false, x: 15, y: 20}, + {js: "auto", css: "smooth", waitForEnd: false, x: 4100, y: 4000}, + {js: "", css: "smooth", waitForEnd: false, x: 10, y: 5}, + ]; + + function doTest() + { + var testCases = []; + for (var i = 0; i < testScrolls.length; i++) { + testCases.push(new ScrollBehaviorTestCase(testScrolls[i])); + } + + var element = document.getElementById("container"); + var scrollBehaviorTest = new ScrollBehaviorTest(element, + element, + testCases, + getEndPosition, + jsScroll); + scrollBehaviorTest.run(); + } + + window.addEventListener('load', doTest, false); + </script> +</head> + +<body> + <p>Test that calling scrollTo on an overflow:hidden element works with both scroll behaviors</p> + <div id="container"> + <div id="content"></div> + </div> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollTop-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollTop-expected.txt index 4d5d320..1cd4c3e 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollTop-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollTop-expected.txt @@ -2,16 +2,10 @@ Test that setting scrollTop on an overflow:hidden element works with both scroll This is a testharness.js-based test. PASS Scroll x:0, y:2, smooth:false -PASS Scroll x:0, y:3, smooth:false PASS Scroll x:0, y:4, smooth:false -PASS Scroll x:0, y:5, smooth:false -FAIL Scroll x:0, y:15, smooth:true assert_equals: expected "0, 5" but got "0, 15" -FAIL Scroll x:0, y:25, smooth:true assert_equals: expected "0, 15" but got "0, 25" -FAIL Scroll x:0, y:35, smooth:true assert_equals: expected "0, 25" but got "0, 35" -FAIL Scroll x:0, y:45, smooth:true assert_equals: expected "0, 35" but got "0, 45" +FAIL Scroll x:0, y:25, smooth:true assert_equals: expected "0, 4" but got "0, 25" +FAIL Scroll x:0, y:45, smooth:true assert_equals: expected "0, 25" but got "0, 45" FAIL Scroll x:0, y:4100, smooth:true assert_equals: expected "0, 45" but got "0, 4100" FAIL Scroll x:0, y:20, smooth:true assert_equals: expected "0, 4100" but got "0, 20" -FAIL Scroll x:0, y:4000, smooth:true assert_equals: expected "0, 20" but got "0, 4000" -FAIL Scroll x:0, y:5, smooth:true assert_equals: expected "0, 4000" but got "0, 5" Harness: the test ran to completion. diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollTop.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollTop.html index 5e9b83f..9d1a46f 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollTop.html +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-hidden-scrollTop.html @@ -27,26 +27,16 @@ function jsScroll(testCase) { var element = document.getElementById("container"); - if (testCase.js) { - element.scrollTop = {y: testCase.y, behavior: testCase.js}; - } else { - element.scrollTop = testCase.y; - } + element.scrollTop = testCase.y; } const testScrolls = [ - {js: "instant", css: "auto", x: 0, y: 2}, - {js: "instant", css: "smooth", x: 0, y: 3}, - {js: "auto", css: "auto", x: 0, y: 4}, - {js: "", css: "auto", x: 0, y: 5}, - {js: "smooth", css: "auto", waitForEnd: true, x: 0, y: 15}, - {js: "smooth", css: "smooth", waitForEnd: true, x: 0, y: 25}, - {js: "auto", css: "smooth", waitForEnd: true, x: 0, y: 35}, - {js: "", css: "smooth", waitForEnd: true, x: 0, y: 45}, - {js: "smooth", css: "auto", waitForEnd: false, x: 0, y: 4100}, - {js: "smooth", css: "smooth", waitForEnd: false, x: 0, y: 20}, - {js: "auto", css: "smooth", waitForEnd: false, x: 0, y: 4000}, - {js: "", css: "smooth", waitForEnd: false, x: 0, y: 5}, + {css: "auto", x: 0, y: 2}, + {css: "auto", x: 0, y: 4}, + {css: "smooth", waitForEnd: true, x: 0, y: 25}, + {css: "smooth", waitForEnd: true, x: 0, y: 45}, + {css: "smooth", waitForEnd: false, x: 0, y: 4100}, + {css: "smooth", waitForEnd: false, x: 0, y: 20}, ]; function doTest() diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-interrupted-scroll.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-interrupted-scroll.html index 869a4ec..a5333d8 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-interrupted-scroll.html +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-interrupted-scroll.html @@ -19,7 +19,7 @@ <script src="resources/scroll-interruption-test.js"></script> <script type="text/javascript"> function jsScroll(y) { - document.getElementById('container').scrollTop = {y: y, behavior: 'smooth'}; + document.getElementById('container').scrollTo({top: y, behavior: 'smooth'}); } function doTest() { diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scroll-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scroll-expected.txt new file mode 100644 index 0000000..4e35455 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scroll-expected.txt @@ -0,0 +1,22 @@ +Test that calling scroll on an overflow:scroll element works with both scroll behaviors + +This is a testharness.js-based test. +PASS Scroll x:1, y:2, smooth:false +PASS Scroll x:2, y:3, smooth:false +PASS Scroll x:3, y:4, smooth:false +PASS Scroll x:4, y:5, smooth:false +PASS Scroll x:3, y:undefined, smooth:false +PASS Scroll x:undefined, y:4, smooth:false +PASS Scroll x:undefined, y:undefined, smooth:false +FAIL Scroll x:10, y:15, smooth:true assert_equals: expected "3, 4" but got "10, 15" +FAIL Scroll x:20, y:25, smooth:true assert_equals: expected "10, 15" but got "20, 25" +FAIL Scroll x:30, y:35, smooth:true assert_equals: expected "20, 25" but got "30, 35" +FAIL Scroll x:40, y:45, smooth:true assert_equals: expected "30, 35" but got "40, 45" +FAIL Scroll x:45, y:undefined, smooth:true assert_equals: expected "40, 45" but got "45, 45" +FAIL Scroll x:undefined, y:40, smooth:true assert_equals: expected "45, 45" but got "45, 40" +FAIL Scroll x:4000, y:4100, smooth:true assert_equals: expected "45, 40" but got "4000, 4100" +FAIL Scroll x:15, y:20, smooth:true assert_equals: expected "4000, 4100" but got "15, 20" +FAIL Scroll x:4100, y:4000, smooth:true assert_equals: expected "15, 20" but got "4100, 4000" +FAIL Scroll x:10, y:5, smooth:true assert_equals: expected "4100, 4000" but got "10, 5" +Harness: the test ran to completion. + diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scroll.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scroll.html new file mode 100644 index 0000000..17fb495 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scroll.html @@ -0,0 +1,95 @@ +<!DOCTYPE html> +<html> +<head> + <style> + #container { + width: 200px; + height: 200px; + overflow: scroll; + } + + #content { + width: 7500px; + height: 7500px; + background-color: blue; + } + </style> + <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharnessreport.js"></script> + <script src="resources/scroll-behavior-test.js"></script> + <script type="text/javascript"> + function getEndPosition(testCase, startPosition) { + var endPosition = {}; + if (testCase.x) + endPosition.x = testCase.x; + else + endPosition.x = startPosition.x; + + if (testCase.y) + endPosition.y = testCase.y; + else + endPosition.y = startPosition.y; + + return endPosition; + } + + function jsScroll(testCase) { + if (testCase.js) { + var scrollToOptions = {behavior: testCase.js}; + if (testCase.x) + scrollToOptions.left = testCase.x; + if (testCase.y) + scrollToOptions.top = testCase.y; + document.getElementById("container").scroll(scrollToOptions); + } else { + document.getElementById("container").scroll(testCase.x, testCase.y); + } + } + + const testScrolls = [ + {js: "instant", css: "auto", x: 1, y: 2}, + {js: "instant", css: "smooth", x: 2, y: 3}, + {js: "auto", css: "auto", x: 3, y: 4}, + {js: "", css: "auto", x: 4, y: 5}, + {js: "auto", css: "auto", x: 3}, + {js: "auto", css: "auto", y: 4}, + {js: "auto", css: "auto"}, + {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 15}, + {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 25}, + {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 35}, + {js: "", css: "smooth", waitForEnd: true, x: 40, y: 45}, + {js: "auto", css: "smooth", waitForEnd: true, x: 45}, + {js: "auto", css: "smooth", waitForEnd: true, y: 40}, + {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 4100}, + {js: "smooth", css: "smooth", waitForEnd: false, x: 15, y: 20}, + {js: "auto", css: "smooth", waitForEnd: false, x: 4100, y: 4000}, + {js: "", css: "smooth", waitForEnd: false, x: 10, y: 5}, + ]; + + function doTest() + { + var testCases = []; + for (var i = 0; i < testScrolls.length; i++) { + testCases.push(new ScrollBehaviorTestCase(testScrolls[i])); + } + + var element = document.getElementById("container"); + var scrollBehaviorTest = new ScrollBehaviorTest(element, + element, + testCases, + getEndPosition, + jsScroll); + scrollBehaviorTest.run(); + } + + window.addEventListener('load', doTest, false); + </script> +</head> + +<body> + <p>Test that calling scroll on an overflow:scroll element works with both scroll behaviors</p> + <div id="container"> + <div id="content"></div> + </div> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollBy-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollBy-expected.txt new file mode 100644 index 0000000..9175439 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollBy-expected.txt @@ -0,0 +1,22 @@ +Test that calling scrollBy on an overflow:scroll element works with both scroll behaviors + +This is a testharness.js-based test. +PASS Scroll x:1, y:2, smooth:false +PASS Scroll x:2, y:3, smooth:false +PASS Scroll x:3, y:4, smooth:false +PASS Scroll x:4, y:5, smooth:false +PASS Scroll x:3, y:undefined, smooth:false +PASS Scroll x:undefined, y:4, smooth:false +PASS Scroll x:undefined, y:undefined, smooth:false +FAIL Scroll x:10, y:15, smooth:true assert_equals: expected "13, 18" but got "23, 33" +FAIL Scroll x:20, y:25, smooth:true assert_equals: expected "23, 33" but got "43, 58" +FAIL Scroll x:30, y:35, smooth:true assert_equals: expected "43, 58" but got "73, 93" +FAIL Scroll x:40, y:45, smooth:true assert_equals: expected "73, 93" but got "113, 138" +FAIL Scroll x:-30, y:undefined, smooth:true assert_equals: expected "113, 138" but got "83, 138" +FAIL Scroll x:undefined, y:-35, smooth:true assert_equals: expected "83, 138" but got "83, 103" +FAIL Scroll x:4000, y:4100, smooth:true assert_equals: expected "83, 103" but got "4083, 4203" +FAIL Scroll x:-3900, y:-3850, smooth:true assert_equals: expected "4083, 4203" but got "183, 353" +FAIL Scroll x:4050, y:4000, smooth:true assert_equals: expected "183, 353" but got "4233, 4353" +FAIL Scroll x:-4000, y:-4100, smooth:true assert_equals: expected "4233, 4353" but got "233, 253" +Harness: the test ran to completion. + diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollBy.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollBy.html new file mode 100644 index 0000000..291eb2a --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollBy.html @@ -0,0 +1,94 @@ +<!DOCTYPE html> +<html> +<head> + <style> + #container { + width: 200px; + height: 200px; + overflow: scroll; + } + + #content { + width: 7500px; + height: 7500px; + background-color: blue; + } + </style> + <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharnessreport.js"></script> + <script src="resources/scroll-behavior-test.js"></script> + <script type="text/javascript"> + function getEndPosition(testCase, startPosition) { + var endPosition = {}; + if (testCase.x) + endPosition.x = startPosition.x + testCase.x; + else + endPosition.x = startPosition.x; + + if (testCase.y) + endPosition.y = startPosition.y + testCase.y; + else + endPosition.y = startPosition.y; + return endPosition; + } + + function jsScroll(testCase) { + if (testCase.js) { + var scrollToOptions = {behavior: testCase.js}; + if (testCase.x) + scrollToOptions.left = testCase.x; + if (testCase.y) + scrollToOptions.top = testCase.y; + document.getElementById("container").scrollBy(scrollToOptions); + } else { + document.getElementById("container").scrollBy(testCase.x, testCase.y); + } + } + + const testScrolls = [ + {js: "instant", css: "auto", x: 1, y: 2}, + {js: "instant", css: "smooth", x: 2, y: 3}, + {js: "auto", css: "auto", x: 3, y: 4}, + {js: "", css: "auto", x: 4, y: 5}, + {js: "auto", css: "auto", x: 3}, + {js: "auto", css: "auto", y: 4}, + {js: "auto", css: "auto"}, + {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 15}, + {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 25}, + {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 35}, + {js: "", css: "smooth", waitForEnd: true, x: 40, y: 45}, + {js: "auto", css: "smooth", waitForEnd: true, x: -30}, + {js: "auto", css: "smooth", waitForEnd: true, y: -35}, + {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 4100}, + {js: "smooth", css: "smooth", waitForEnd: false, x: -3900, y: -3850}, + {js: "auto", css: "smooth", waitForEnd: false, x: 4050, y: 4000}, + {js: "", css: "smooth", waitForEnd: false, x: -4000, y: -4100}, + ]; + + function doTest() + { + var testCases = []; + for (var i = 0; i < testScrolls.length; i++) { + testCases.push(new ScrollBehaviorTestCase(testScrolls[i])); + } + + var element = document.getElementById("container"); + var scrollBehaviorTest = new ScrollBehaviorTest(element, + element, + testCases, + getEndPosition, + jsScroll); + scrollBehaviorTest.run(); + } + + window.addEventListener('load', doTest, false); + </script> +</head> + +<body> + <p>Test that calling scrollBy on an overflow:scroll element works with both scroll behaviors</p> + <div id="container"> + <div id="content"></div> + </div> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollLeft-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollLeft-expected.txt index 89a4a27..74b0e9f 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollLeft-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollLeft-expected.txt @@ -2,16 +2,10 @@ Test that setting scrollLeft on an overflow:scroll element works with both scrol This is a testharness.js-based test. PASS Scroll x:1, y:0, smooth:false -PASS Scroll x:2, y:0, smooth:false -PASS Scroll x:3, y:0, smooth:false PASS Scroll x:4, y:0, smooth:false -FAIL Scroll x:10, y:0, smooth:true assert_equals: expected "4, 0" but got "10, 0" -FAIL Scroll x:20, y:0, smooth:true assert_equals: expected "10, 0" but got "20, 0" -FAIL Scroll x:30, y:0, smooth:true assert_equals: expected "20, 0" but got "30, 0" -FAIL Scroll x:40, y:0, smooth:true assert_equals: expected "30, 0" but got "40, 0" +FAIL Scroll x:20, y:0, smooth:true assert_equals: expected "4, 0" but got "20, 0" +FAIL Scroll x:40, y:0, smooth:true assert_equals: expected "20, 0" but got "40, 0" FAIL Scroll x:4000, y:0, smooth:true assert_equals: expected "40, 0" but got "4000, 0" -FAIL Scroll x:15, y:0, smooth:true assert_equals: expected "4000, 0" but got "15, 0" -FAIL Scroll x:4100, y:0, smooth:true assert_equals: expected "15, 0" but got "4100, 0" -FAIL Scroll x:10, y:0, smooth:true assert_equals: expected "4100, 0" but got "10, 0" +FAIL Scroll x:10, y:0, smooth:true assert_equals: expected "4000, 0" but got "10, 0" Harness: the test ran to completion. diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollLeft.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollLeft.html index 174b917..6292a59 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollLeft.html +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollLeft.html @@ -27,26 +27,16 @@ function jsScroll(testCase) { var element = document.getElementById("container"); - if (testCase.js) { - element.scrollLeft = {x: testCase.x, behavior: testCase.js}; - } else { - element.scrollLeft = testCase.x; - } + element.scrollLeft = testCase.x; } const testScrolls = [ - {js: "instant", css: "auto", x: 1, y: 0}, - {js: "instant", css: "smooth", x: 2, y: 0}, - {js: "auto", css: "auto", x: 3, y: 0}, - {js: "", css: "auto", x: 4, y: 0}, - {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 0}, - {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 0}, - {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 0}, - {js: "", css: "smooth", waitForEnd: true, x: 40, y: 0}, - {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 0}, - {js: "smooth", css: "smooth", waitForEnd: false, x: 15, y: 0}, - {js: "auto", css: "smooth", waitForEnd: false, x: 4100, y: 0}, - {js: "", css: "smooth", waitForEnd: false, x: 10, y: 0}, + {css: "auto", x: 1, y: 0}, + {css: "auto", x: 4, y: 0}, + {css: "smooth", waitForEnd: true, x: 20, y: 0}, + {css: "smooth", waitForEnd: true, x: 40, y: 0}, + {css: "smooth", waitForEnd: false, x: 4000, y: 0}, + {css: "smooth", waitForEnd: false, x: 10, y: 0}, ]; function doTest() diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTo-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTo-expected.txt new file mode 100644 index 0000000..0358529 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTo-expected.txt @@ -0,0 +1,22 @@ +Test that calling scrollTo on an overflow:scroll element works with both scroll behaviors + +This is a testharness.js-based test. +PASS Scroll x:1, y:2, smooth:false +PASS Scroll x:2, y:3, smooth:false +PASS Scroll x:3, y:4, smooth:false +PASS Scroll x:4, y:5, smooth:false +PASS Scroll x:3, y:undefined, smooth:false +PASS Scroll x:undefined, y:4, smooth:false +PASS Scroll x:undefined, y:undefined, smooth:false +FAIL Scroll x:10, y:15, smooth:true assert_equals: expected "3, 4" but got "10, 15" +FAIL Scroll x:20, y:25, smooth:true assert_equals: expected "10, 15" but got "20, 25" +FAIL Scroll x:30, y:35, smooth:true assert_equals: expected "20, 25" but got "30, 35" +FAIL Scroll x:40, y:45, smooth:true assert_equals: expected "30, 35" but got "40, 45" +FAIL Scroll x:45, y:undefined, smooth:true assert_equals: expected "40, 45" but got "45, 45" +FAIL Scroll x:undefined, y:40, smooth:true assert_equals: expected "45, 45" but got "45, 40" +FAIL Scroll x:4000, y:4100, smooth:true assert_equals: expected "45, 40" but got "4000, 4100" +FAIL Scroll x:15, y:20, smooth:true assert_equals: expected "4000, 4100" but got "15, 20" +FAIL Scroll x:4100, y:4000, smooth:true assert_equals: expected "15, 20" but got "4100, 4000" +FAIL Scroll x:10, y:5, smooth:true assert_equals: expected "4100, 4000" but got "10, 5" +Harness: the test ran to completion. + diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTo.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTo.html new file mode 100644 index 0000000..7e2dbc7 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTo.html @@ -0,0 +1,95 @@ +<!DOCTYPE html> +<html> +<head> + <style> + #container { + width: 200px; + height: 200px; + overflow: scroll; + } + + #content { + width: 7500px; + height: 7500px; + background-color: blue; + } + </style> + <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharnessreport.js"></script> + <script src="resources/scroll-behavior-test.js"></script> + <script type="text/javascript"> + function getEndPosition(testCase, startPosition) { + var endPosition = {}; + if (testCase.x) + endPosition.x = testCase.x; + else + endPosition.x = startPosition.x; + + if (testCase.y) + endPosition.y = testCase.y; + else + endPosition.y = startPosition.y; + + return endPosition; + } + + function jsScroll(testCase) { + if (testCase.js) { + var scrollToOptions = {behavior: testCase.js}; + if (testCase.x) + scrollToOptions.left = testCase.x; + if (testCase.y) + scrollToOptions.top = testCase.y; + document.getElementById("container").scrollTo(scrollToOptions); + } else { + document.getElementById("container").scrollTo(testCase.x, testCase.y); + } + } + + const testScrolls = [ + {js: "instant", css: "auto", x: 1, y: 2}, + {js: "instant", css: "smooth", x: 2, y: 3}, + {js: "auto", css: "auto", x: 3, y: 4}, + {js: "", css: "auto", x: 4, y: 5}, + {js: "auto", css: "auto", x: 3}, + {js: "auto", css: "auto", y: 4}, + {js: "auto", css: "auto"}, + {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 15}, + {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 25}, + {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 35}, + {js: "", css: "smooth", waitForEnd: true, x: 40, y: 45}, + {js: "auto", css: "smooth", waitForEnd: true, x: 45}, + {js: "auto", css: "smooth", waitForEnd: true, y: 40}, + {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 4100}, + {js: "smooth", css: "smooth", waitForEnd: false, x: 15, y: 20}, + {js: "auto", css: "smooth", waitForEnd: false, x: 4100, y: 4000}, + {js: "", css: "smooth", waitForEnd: false, x: 10, y: 5}, + ]; + + function doTest() + { + var testCases = []; + for (var i = 0; i < testScrolls.length; i++) { + testCases.push(new ScrollBehaviorTestCase(testScrolls[i])); + } + + var element = document.getElementById("container"); + var scrollBehaviorTest = new ScrollBehaviorTest(element, + element, + testCases, + getEndPosition, + jsScroll); + scrollBehaviorTest.run(); + } + + window.addEventListener('load', doTest, false); + </script> +</head> + +<body> + <p>Test that calling scrollTo on an overflow:scroll element works with both scroll behaviors</p> + <div id="container"> + <div id="content"></div> + </div> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTop-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTop-expected.txt index e6f0f7d..5908bfe 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTop-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTop-expected.txt @@ -2,16 +2,10 @@ Test that setting scrollTop on an overflow:scroll element works with both scroll This is a testharness.js-based test. PASS Scroll x:0, y:2, smooth:false -PASS Scroll x:0, y:3, smooth:false PASS Scroll x:0, y:4, smooth:false -PASS Scroll x:0, y:5, smooth:false -FAIL Scroll x:0, y:15, smooth:true assert_equals: expected "0, 5" but got "0, 15" -FAIL Scroll x:0, y:25, smooth:true assert_equals: expected "0, 15" but got "0, 25" -FAIL Scroll x:0, y:35, smooth:true assert_equals: expected "0, 25" but got "0, 35" -FAIL Scroll x:0, y:45, smooth:true assert_equals: expected "0, 35" but got "0, 45" +FAIL Scroll x:0, y:25, smooth:true assert_equals: expected "0, 4" but got "0, 25" +FAIL Scroll x:0, y:45, smooth:true assert_equals: expected "0, 25" but got "0, 45" FAIL Scroll x:0, y:4100, smooth:true assert_equals: expected "0, 45" but got "0, 4100" FAIL Scroll x:0, y:20, smooth:true assert_equals: expected "0, 4100" but got "0, 20" -FAIL Scroll x:0, y:4000, smooth:true assert_equals: expected "0, 20" but got "0, 4000" -FAIL Scroll x:0, y:5, smooth:true assert_equals: expected "0, 4000" but got "0, 5" Harness: the test ran to completion. diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTop.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTop.html index e6cf5c7..f31f423 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTop.html +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTop.html @@ -27,26 +27,16 @@ function jsScroll(testCase) { var element = document.getElementById("container"); - if (testCase.js) { - element.scrollTop = {y: testCase.y, behavior: testCase.js}; - } else { - element.scrollTop = testCase.y; - } + element.scrollTop = testCase.y; } const testScrolls = [ - {js: "instant", css: "auto", x: 0, y: 2}, - {js: "instant", css: "smooth", x: 0, y: 3}, - {js: "auto", css: "auto", x: 0, y: 4}, - {js: "", css: "auto", x: 0, y: 5}, - {js: "smooth", css: "auto", waitForEnd: true, x: 0, y: 15}, - {js: "smooth", css: "smooth", waitForEnd: true, x: 0, y: 25}, - {js: "auto", css: "smooth", waitForEnd: true, x: 0, y: 35}, - {js: "", css: "smooth", waitForEnd: true, x: 0, y: 45}, - {js: "smooth", css: "auto", waitForEnd: false, x: 0, y: 4100}, - {js: "smooth", css: "smooth", waitForEnd: false, x: 0, y: 20}, - {js: "auto", css: "smooth", waitForEnd: false, x: 0, y: 4000}, - {js: "", css: "smooth", waitForEnd: false, x: 0, y: 5}, + {css: "auto", x: 0, y: 2}, + {css: "auto", x: 0, y: 4}, + {css: "smooth", waitForEnd: true, x: 0, y: 25}, + {css: "smooth", waitForEnd: true, x: 0, y: 45}, + {css: "smooth", waitForEnd: false, x: 0, y: 4100}, + {css: "smooth", waitForEnd: false, x: 0, y: 20}, ]; function doTest() diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/resources/scroll-behavior-test.js b/third_party/WebKit/LayoutTests/fast/scroll-behavior/resources/scroll-behavior-test.js index f72f7ab..6ed5b3b 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/resources/scroll-behavior-test.js +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/resources/scroll-behavior-test.js @@ -36,8 +36,7 @@ ScrollBehaviorTest.prototype.scrollListener = function(testCase) { // Wait for an intermediate frame, then instant-scroll to the end state. if ((this.scrollElement.scrollLeft != testCase.startX || this.scrollElement.scrollTop != testCase.startY) && (this.scrollElement.scrollLeft != testCase.endX || this.scrollElement.scrollTop != testCase.endY)) { - this.scrollElement.scrollLeft = {x: testCase.endX, behavior: "instant"}; - this.scrollElement.scrollTop = {y: testCase.endY, behavior: "instant"}; + this.scrollElement.scrollTo({left: testCase.endX, top: testCase.endY, behavior: "instant"}); this.testCaseComplete(); } }; diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scroll-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scroll-expected.txt new file mode 100644 index 0000000..a0f76a8 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scroll-expected.txt @@ -0,0 +1,23 @@ +Test that calling scroll on a subframe's document element works with both scroll behaviors + + +This is a testharness.js-based test. +PASS Scroll x:1, y:2, smooth:false +PASS Scroll x:2, y:3, smooth:false +PASS Scroll x:3, y:4, smooth:false +PASS Scroll x:4, y:5, smooth:false +PASS Scroll x:3, y:undefined, smooth:false +PASS Scroll x:undefined, y:4, smooth:false +PASS Scroll x:undefined, y:undefined, smooth:false +PASS Scroll x:10, y:15, smooth:true +PASS Scroll x:20, y:25, smooth:true +PASS Scroll x:30, y:35, smooth:true +PASS Scroll x:40, y:45, smooth:true +PASS Scroll x:45, y:undefined, smooth:true +PASS Scroll x:undefined, y:40, smooth:true +PASS Scroll x:4000, y:4100, smooth:true +PASS Scroll x:15, y:20, smooth:true +PASS Scroll x:4100, y:4000, smooth:true +PASS Scroll x:10, y:5, smooth:true +Harness: the test ran to completion. + diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scroll.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scroll.html new file mode 100644 index 0000000..984f3b8 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scroll.html @@ -0,0 +1,87 @@ +<!DOCTYPE html> +<html> +<head> + <style> + #subframe { + width: 200px; + height: 200px; + } + </style> + <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharnessreport.js"></script> + <script src="resources/scroll-behavior-test.js"></script> + <script type="text/javascript"> + function getEndPosition(testCase, startPosition) { + var endPosition = {}; + if (testCase.x) + endPosition.x = testCase.x; + else + endPosition.x = startPosition.x; + + if (testCase.y) + endPosition.y = testCase.y; + else + endPosition.y = startPosition.y; + + return endPosition; + } + + function jsScroll(testCase) { + var subframe = document.getElementById("subframe"); + if (testCase.js) { + var scrollToOptions = {behavior: testCase.js}; + if (testCase.x) + scrollToOptions.left = testCase.x; + if (testCase.y) + scrollToOptions.top = testCase.y; + subframe.contentDocument.documentElement.scroll(scrollToOptions); + } else { + subframe.contentDocument.documentElement.scroll(testCase.x, testCase.y); + } + } + + const testScrolls = [ + {js: "instant", css: "auto", x: 1, y: 2}, + {js: "instant", css: "smooth", x: 2, y: 3}, + {js: "auto", css: "auto", x: 3, y: 4}, + {js: "", css: "auto", x: 4, y: 5}, + {js: "auto", css: "auto", x: 3}, + {js: "auto", css: "auto", y: 4}, + {js: "auto", css: "auto"}, + {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 15}, + {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 25}, + {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 35}, + {js: "", css: "smooth", waitForEnd: true, x: 40, y: 45}, + {js: "auto", css: "smooth", waitForEnd: true, x: 45}, + {js: "auto", css: "smooth", waitForEnd: true, y: 40}, + {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 4100}, + {js: "smooth", css: "smooth", waitForEnd: false, x: 15, y: 20}, + {js: "auto", css: "smooth", waitForEnd: false, x: 4100, y: 4000}, + {js: "", css: "smooth", waitForEnd: false, x: 10, y: 5}, + ]; + + function doTest() + { + var testCases = []; + for (var i = 0; i < testScrolls.length; i++) { + testCases.push(new ScrollBehaviorTestCase(testScrolls[i])); + } + + var subframe = document.getElementById("subframe"); + var scrollBehaviorTest = new ScrollBehaviorTest(subframe.contentDocument.documentElement, + subframe.contentDocument, + testCases, + getEndPosition, + jsScroll); + scrollBehaviorTest.run(); + } + + window.addEventListener('load', doTest, false); + </script> +</head> + +<body> + <p>Test that calling scroll on a subframe's document element works with both scroll behaviors</p> + <iframe id="subframe" src="resources/large-subframe.html"></iframe> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scrollBy-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scrollBy-expected.txt new file mode 100644 index 0000000..b72cd5c --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scrollBy-expected.txt @@ -0,0 +1,23 @@ +Test that calling scrollBy on a subframe's document element works with both scroll behaviors + + +This is a testharness.js-based test. +PASS Scroll x:1, y:2, smooth:false +PASS Scroll x:2, y:3, smooth:false +PASS Scroll x:3, y:4, smooth:false +PASS Scroll x:4, y:5, smooth:false +PASS Scroll x:3, y:undefined, smooth:false +PASS Scroll x:undefined, y:4, smooth:false +PASS Scroll x:undefined, y:undefined, smooth:false +PASS Scroll x:10, y:15, smooth:true +PASS Scroll x:20, y:25, smooth:true +PASS Scroll x:30, y:35, smooth:true +PASS Scroll x:40, y:45, smooth:true +PASS Scroll x:-30, y:undefined, smooth:true +PASS Scroll x:undefined, y:-35, smooth:true +PASS Scroll x:4000, y:4100, smooth:true +PASS Scroll x:-3900, y:-3850, smooth:true +PASS Scroll x:4050, y:4000, smooth:true +PASS Scroll x:-4000, y:-4100, smooth:true +Harness: the test ran to completion. + diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scrollBy.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scrollBy.html new file mode 100644 index 0000000..05cb954 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scrollBy.html @@ -0,0 +1,86 @@ +<!DOCTYPE html> +<html> +<head> + <style> + #subframe { + width: 200px; + height: 200px; + } + </style> + <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharnessreport.js"></script> + <script src="resources/scroll-behavior-test.js"></script> + <script type="text/javascript"> + function getEndPosition(testCase, startPosition) { + var endPosition = {}; + if (testCase.x) + endPosition.x = startPosition.x + testCase.x; + else + endPosition.x = startPosition.x; + + if (testCase.y) + endPosition.y = startPosition.y + testCase.y; + else + endPosition.y = startPosition.y; + return endPosition; + } + + function jsScroll(testCase) { + var subframe = document.getElementById("subframe"); + if (testCase.js) { + var scrollToOptions = {behavior: testCase.js}; + if (testCase.x) + scrollToOptions.left = testCase.x; + if (testCase.y) + scrollToOptions.top = testCase.y; + subframe.contentDocument.documentElement.scrollBy(scrollToOptions); + } else { + subframe.contentDocument.documentElement.scrollBy(testCase.x, testCase.y); + } + } + + const testScrolls = [ + {js: "instant", css: "auto", x: 1, y: 2}, + {js: "instant", css: "smooth", x: 2, y: 3}, + {js: "auto", css: "auto", x: 3, y: 4}, + {js: "", css: "auto", x: 4, y: 5}, + {js: "auto", css: "auto", x: 3}, + {js: "auto", css: "auto", y: 4}, + {js: "auto", css: "auto"}, + {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 15}, + {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 25}, + {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 35}, + {js: "", css: "smooth", waitForEnd: true, x: 40, y: 45}, + {js: "auto", css: "smooth", waitForEnd: true, x: -30}, + {js: "auto", css: "smooth", waitForEnd: true, y: -35}, + {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 4100}, + {js: "smooth", css: "smooth", waitForEnd: false, x: -3900, y: -3850}, + {js: "auto", css: "smooth", waitForEnd: false, x: 4050, y: 4000}, + {js: "", css: "smooth", waitForEnd: false, x: -4000, y: -4100}, + ]; + + function doTest() + { + var testCases = []; + for (var i = 0; i < testScrolls.length; i++) { + testCases.push(new ScrollBehaviorTestCase(testScrolls[i])); + } + + var subframe = document.getElementById("subframe"); + var scrollBehaviorTest = new ScrollBehaviorTest(subframe.contentDocument.documentElement, + subframe.contentDocument, + testCases, + getEndPosition, + jsScroll); + scrollBehaviorTest.run(); + } + + window.addEventListener('load', doTest, false); + </script> +</head> + +<body> + <p>Test that calling scrollBy on a subframe's document element works with both scroll behaviors</p> + <iframe id="subframe" src="resources/large-subframe.html"></iframe> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scrollTo-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scrollTo-expected.txt new file mode 100644 index 0000000..86bde31 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scrollTo-expected.txt @@ -0,0 +1,23 @@ +Test that calling scrollTo on a subframe's document element works with both scroll behaviors + + +This is a testharness.js-based test. +PASS Scroll x:1, y:2, smooth:false +PASS Scroll x:2, y:3, smooth:false +PASS Scroll x:3, y:4, smooth:false +PASS Scroll x:4, y:5, smooth:false +PASS Scroll x:3, y:undefined, smooth:false +PASS Scroll x:undefined, y:4, smooth:false +PASS Scroll x:undefined, y:undefined, smooth:false +PASS Scroll x:10, y:15, smooth:true +PASS Scroll x:20, y:25, smooth:true +PASS Scroll x:30, y:35, smooth:true +PASS Scroll x:40, y:45, smooth:true +PASS Scroll x:45, y:undefined, smooth:true +PASS Scroll x:undefined, y:40, smooth:true +PASS Scroll x:4000, y:4100, smooth:true +PASS Scroll x:15, y:20, smooth:true +PASS Scroll x:4100, y:4000, smooth:true +PASS Scroll x:10, y:5, smooth:true +Harness: the test ran to completion. + diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scrollTo.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scrollTo.html new file mode 100644 index 0000000..d0904e2 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-element-scrollTo.html @@ -0,0 +1,87 @@ +<!DOCTYPE html> +<html> +<head> + <style> + #subframe { + width: 200px; + height: 200px; + } + </style> + <script src="../../resources/testharness.js"></script> + <script src="../../resources/testharnessreport.js"></script> + <script src="resources/scroll-behavior-test.js"></script> + <script type="text/javascript"> + function getEndPosition(testCase, startPosition) { + var endPosition = {}; + if (testCase.x) + endPosition.x = testCase.x; + else + endPosition.x = startPosition.x; + + if (testCase.y) + endPosition.y = testCase.y; + else + endPosition.y = startPosition.y; + + return endPosition; + } + + function jsScroll(testCase) { + var subframe = document.getElementById("subframe"); + if (testCase.js) { + var scrollToOptions = {behavior: testCase.js}; + if (testCase.x) + scrollToOptions.left = testCase.x; + if (testCase.y) + scrollToOptions.top = testCase.y; + subframe.contentDocument.documentElement.scrollTo(scrollToOptions); + } else { + subframe.contentDocument.documentElement.scrollTo(testCase.x, testCase.y); + } + } + + const testScrolls = [ + {js: "instant", css: "auto", x: 1, y: 2}, + {js: "instant", css: "smooth", x: 2, y: 3}, + {js: "auto", css: "auto", x: 3, y: 4}, + {js: "", css: "auto", x: 4, y: 5}, + {js: "auto", css: "auto", x: 3}, + {js: "auto", css: "auto", y: 4}, + {js: "auto", css: "auto"}, + {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 15}, + {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 25}, + {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 35}, + {js: "", css: "smooth", waitForEnd: true, x: 40, y: 45}, + {js: "auto", css: "smooth", waitForEnd: true, x: 45}, + {js: "auto", css: "smooth", waitForEnd: true, y: 40}, + {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 4100}, + {js: "smooth", css: "smooth", waitForEnd: false, x: 15, y: 20}, + {js: "auto", css: "smooth", waitForEnd: false, x: 4100, y: 4000}, + {js: "", css: "smooth", waitForEnd: false, x: 10, y: 5}, + ]; + + function doTest() + { + var testCases = []; + for (var i = 0; i < testScrolls.length; i++) { + testCases.push(new ScrollBehaviorTestCase(testScrolls[i])); + } + + var subframe = document.getElementById("subframe"); + var scrollBehaviorTest = new ScrollBehaviorTest(subframe.contentDocument.documentElement, + subframe.contentDocument, + testCases, + getEndPosition, + jsScroll); + scrollBehaviorTest.run(); + } + + window.addEventListener('load', doTest, false); + </script> +</head> + +<body> + <p>Test that calling scrollTo on a subframe's document element works with both scroll behaviors</p> + <iframe id="subframe" src="resources/large-subframe.html"></iframe> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollLeft-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollLeft-expected.txt index 19beda7..d1e30f5 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollLeft-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollLeft-expected.txt @@ -3,16 +3,10 @@ Test that setting scrollLeft on a subframe works with both scroll behaviors This is a testharness.js-based test. PASS Scroll x:1, y:0, smooth:false -PASS Scroll x:2, y:0, smooth:false -PASS Scroll x:3, y:0, smooth:false PASS Scroll x:4, y:0, smooth:false -FAIL Scroll x:10, y:0, smooth:true assert_equals: expected "4, 0" but got "10, 0" -FAIL Scroll x:20, y:0, smooth:true assert_equals: expected "10, 0" but got "20, 0" -FAIL Scroll x:30, y:0, smooth:true assert_equals: expected "20, 0" but got "30, 0" -FAIL Scroll x:40, y:0, smooth:true assert_equals: expected "30, 0" but got "40, 0" -FAIL Scroll x:4000, y:0, smooth:true assert_equals: expected "40, 0" but got "4000, 0" -FAIL Scroll x:15, y:0, smooth:true assert_equals: expected "4000, 0" but got "15, 0" -FAIL Scroll x:4100, y:0, smooth:true assert_equals: expected "15, 0" but got "4100, 0" -FAIL Scroll x:10, y:0, smooth:true assert_equals: expected "4100, 0" but got "10, 0" +PASS Scroll x:20, y:0, smooth:true +PASS Scroll x:40, y:0, smooth:true +PASS Scroll x:4000, y:0, smooth:true +PASS Scroll x:10, y:0, smooth:true Harness: the test ran to completion. diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollLeft.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollLeft.html index 1774a0d..6a88c47 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollLeft.html +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollLeft.html @@ -20,26 +20,16 @@ function jsScroll(testCase) { var subframe = document.getElementById("subframe"); - if (testCase.js) { - subframe.contentDocument.documentElement.scrollLeft = {x: testCase.x, behavior: testCase.js}; - } else { - subframe.contentDocument.documentElement.scrollLeft = testCase.x; - } + subframe.contentDocument.documentElement.scrollLeft = testCase.x; } const testScrolls = [ - {js: "instant", css: "auto", x: 1, y: 0}, - {js: "instant", css: "smooth", x: 2, y: 0}, - {js: "auto", css: "auto", x: 3, y: 0}, - {js: "", css: "auto", x: 4, y: 0}, - {js: "smooth", css: "auto", waitForEnd: true, x: 10, y: 0}, - {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 0}, - {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 0}, - {js: "", css: "smooth", waitForEnd: true, x: 40, y: 0}, - {js: "smooth", css: "auto", waitForEnd: false, x: 4000, y: 0}, - {js: "smooth", css: "smooth", waitForEnd: false, x: 15, y: 0}, - {js: "auto", css: "smooth", waitForEnd: false, x: 4100, y: 0}, - {js: "", css: "smooth", waitForEnd: false, x: 10, y: 0}, + {css: "auto", x: 1, y: 0}, + {css: "auto", x: 4, y: 0}, + {css: "smooth", waitForEnd: true, x: 20, y: 0}, + {css: "smooth", waitForEnd: true, x: 40, y: 0}, + {css: "smooth", waitForEnd: false, x: 4000, y: 0}, + {css: "smooth", waitForEnd: false, x: 10, y: 0}, ]; function doTest() diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollTop-expected.txt b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollTop-expected.txt index 6bf0523..ff7a58b 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollTop-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollTop-expected.txt @@ -3,16 +3,10 @@ Test that setting scrollTop on a subframe works with both scroll behaviors This is a testharness.js-based test. PASS Scroll x:0, y:2, smooth:false -PASS Scroll x:0, y:3, smooth:false PASS Scroll x:0, y:4, smooth:false -PASS Scroll x:0, y:5, smooth:false -FAIL Scroll x:0, y:15, smooth:true assert_equals: expected "0, 5" but got "0, 15" -FAIL Scroll x:0, y:25, smooth:true assert_equals: expected "0, 15" but got "0, 25" -FAIL Scroll x:0, y:35, smooth:true assert_equals: expected "0, 25" but got "0, 35" -FAIL Scroll x:0, y:45, smooth:true assert_equals: expected "0, 35" but got "0, 45" -FAIL Scroll x:0, y:4100, smooth:true assert_equals: expected "0, 45" but got "0, 4100" -FAIL Scroll x:0, y:20, smooth:true assert_equals: expected "0, 4100" but got "0, 20" -FAIL Scroll x:0, y:4000, smooth:true assert_equals: expected "0, 20" but got "0, 4000" -FAIL Scroll x:0, y:5, smooth:true assert_equals: expected "0, 4000" but got "0, 5" +PASS Scroll x:0, y:25, smooth:true +PASS Scroll x:0, y:45, smooth:true +PASS Scroll x:0, y:4100, smooth:true +PASS Scroll x:0, y:20, smooth:true Harness: the test ran to completion. diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollTop.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollTop.html index a146e848..8850582 100644 --- a/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollTop.html +++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/subframe-scrollTop.html @@ -20,26 +20,16 @@ function jsScroll(testCase) { var subframe = document.getElementById("subframe"); - if (testCase.js) { - subframe.contentDocument.documentElement.scrollTop = {y: testCase.y, behavior: testCase.js}; - } else { - subframe.contentDocument.documentElement.scrollTop = testCase.y; - } + subframe.contentDocument.documentElement.scrollTop = testCase.y; } const testScrolls = [ - {js: "instant", css: "auto", x: 0, y: 2}, - {js: "instant", css: "smooth", x: 0, y: 3}, - {js: "auto", css: "auto", x: 0, y: 4}, - {js: "", css: "auto", x: 0, y: 5}, - {js: "smooth", css: "auto", waitForEnd: true, x: 0, y: 15}, - {js: "smooth", css: "smooth", waitForEnd: true, x: 0, y: 25}, - {js: "auto", css: "smooth", waitForEnd: true, x: 0, y: 35}, - {js: "", css: "smooth", waitForEnd: true, x: 0, y: 45}, - {js: "smooth", css: "auto", waitForEnd: false, x: 0, y: 4100}, - {js: "smooth", css: "smooth", waitForEnd: false, x: 0, y: 20}, - {js: "auto", css: "smooth", waitForEnd: false, x: 0, y: 4000}, - {js: "", css: "smooth", waitForEnd: false, x: 0, y: 5}, + {css: "auto", x: 0, y: 2}, + {css: "auto", x: 0, y: 4}, + {css: "smooth", waitForEnd: true, x: 0, y: 25}, + {css: "smooth", waitForEnd: true, x: 0, y: 45}, + {css: "smooth", waitForEnd: false, x: 0, y: 4100}, + {css: "smooth", waitForEnd: false, x: 0, y: 20}, ]; function doTest() |