diff options
68 files changed, 1890 insertions, 681 deletions
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 8ebd883..cb9844a 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations @@ -591,8 +591,6 @@ crbug.com/310323 [ Debug ] http/tests/security/contentSecurityPolicy/report-mult crbug.com/435391 http/tests/serviceworker/service-worker-csp.html [ Pass Timeout Missing ] -crbug.com/234871 [ Win ] fast/scroll-behavior/listbox-scrollTop.html [ Failure Pass ] - crbug.com/311301 fast/history/history_reload.html [ Failure Pass ] crbug.com/316151 [ Win ] virtual/deferred/fast/images/2-comp.html [ Pass Timeout ] diff --git a/third_party/WebKit/LayoutTests/fast/dom/Element/scrollTop-scrollLeft-setters-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Element/scrollTop-scrollLeft-setters-expected.txt deleted file mode 100644 index c9887c2..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/Element/scrollTop-scrollLeft-setters-expected.txt +++ /dev/null @@ -1,55 +0,0 @@ -This test makes sure setting scrollLeft or scrollTop to an invalid value throws an exception. - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - - -scrollLeft Tests - -Testing - setting scrollLeft to a valid value -PASS element.scrollLeft = 32 did not throw exception. -PASS element.scrollLeft = 32.1 did not throw exception. -PASS element.scrollLeft = "string" did not throw exception. -PASS element.scrollLeft = null did not throw exception. -PASS element.scrollLeft = undefined did not throw exception. -PASS element.scrollLeft = Infinity did not throw exception. -PASS element.scrollLeft = NaN did not throw exception. -PASS element.scrollLeft = { x: 42 } did not throw exception. -PASS element.scrollLeft = { x: 42, behavior: "auto" } did not throw exception. -PASS element.scrollLeft = { x: 42, behavior: "instant" } did not throw exception. -PASS element.scrollLeft = { x: 42, behavior: "smooth" } did not throw exception. -Testing - setting scrollLeft to an invalid value -PASS element.scrollLeft = { } threw exception TypeError: Failed to set the 'scrollLeft' property on 'Element': ScrollOptionsHorizontal must include an 'x' member.. -PASS element.scrollLeft = { x: 42, behavior: "" } threw exception TypeError: Failed to set the 'scrollLeft' property on 'Element': The ScrollBehavior provided is invalid.. -PASS element.scrollLeft = { x: 42, behavior: "abcd" } threw exception TypeError: Failed to set the 'scrollLeft' property on 'Element': The ScrollBehavior provided is invalid.. -PASS element.scrollLeft = { behavior: "abcd" } threw exception TypeError: Failed to set the 'scrollLeft' property on 'Element': The ScrollBehavior provided is invalid.. -PASS element.scrollLeft = { behavior: "smooth" } threw exception TypeError: Failed to set the 'scrollLeft' property on 'Element': ScrollOptionsHorizontal must include an 'x' member.. -PASS element.scrollLeft = { behavior: "instant" } threw exception TypeError: Failed to set the 'scrollLeft' property on 'Element': ScrollOptionsHorizontal must include an 'x' member.. -PASS element.scrollLeft = { behavior: "smooth" } threw exception TypeError: Failed to set the 'scrollLeft' property on 'Element': ScrollOptionsHorizontal must include an 'x' member.. - -scrollTop Tests - -Testing - setting scrollTop to a valid value -PASS element.scrollTop = 32 did not throw exception. -PASS element.scrollTop = 32.1 did not throw exception. -PASS element.scrollTop = "string" did not throw exception. -PASS element.scrollTop = null did not throw exception. -PASS element.scrollTop = undefined did not throw exception. -PASS element.scrollTop = Infinity did not throw exception. -PASS element.scrollTop = NaN did not throw exception. -PASS element.scrollTop = { y: 42 } did not throw exception. -PASS element.scrollTop = { y: 42, behavior: "auto" } did not throw exception. -PASS element.scrollTop = { y: 42, behavior: "instant" } did not throw exception. -PASS element.scrollTop = { y: 42, behavior: "smooth" } did not throw exception. -Testing - setting scrollTop to an invalid value -PASS element.scrollTop = { } threw exception TypeError: Failed to set the 'scrollTop' property on 'Element': ScrollOptionsVertical must include a 'y' member.. -PASS element.scrollTop = { y: 42, behavior: "" } threw exception TypeError: Failed to set the 'scrollTop' property on 'Element': The ScrollBehavior provided is invalid.. -PASS element.scrollTop = { y: 42, behavior: "abcd" } threw exception TypeError: Failed to set the 'scrollTop' property on 'Element': The ScrollBehavior provided is invalid.. -PASS element.scrollTop = { behavior: "abcd" } threw exception TypeError: Failed to set the 'scrollTop' property on 'Element': The ScrollBehavior provided is invalid.. -PASS element.scrollTop = { behavior: "smooth" } threw exception TypeError: Failed to set the 'scrollTop' property on 'Element': ScrollOptionsVertical must include a 'y' member.. -PASS element.scrollTop = { behavior: "instant" } threw exception TypeError: Failed to set the 'scrollTop' property on 'Element': ScrollOptionsVertical must include a 'y' member.. -PASS element.scrollTop = { behavior: "smooth" } threw exception TypeError: Failed to set the 'scrollTop' property on 'Element': ScrollOptionsVertical must include a 'y' member.. -PASS successfullyParsed is true - -TEST COMPLETE -This box should force the container div to have a scrollable area to test. diff --git a/third_party/WebKit/LayoutTests/fast/dom/Element/scrollTop-scrollLeft-setters.html b/third_party/WebKit/LayoutTests/fast/dom/Element/scrollTop-scrollLeft-setters.html deleted file mode 100644 index 2cbf8dd..0000000 --- a/third_party/WebKit/LayoutTests/fast/dom/Element/scrollTop-scrollLeft-setters.html +++ /dev/null @@ -1,76 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <script src="../../../resources/js-test.js"></script> -</head> -<body> - <div id="container" style="overflow: scroll; height: 200px; width: 200px"> - <div style="height: 1000px; width: 1000px; border: 1px solid black;"> - This box should force the container div to have a scrollable area to test. - </div> - </div> - <script type="text/javascript"> - if (window.testRunner) - testRunner.dumpAsText(); - - var element = document.getElementById("container"); - - description("This test makes sure setting scrollLeft or scrollTop to\ - an invalid value throws an exception."); - - // scrollLeft ///////////////////////// - debug(''); - debug('scrollLeft Tests'); - debug(''); - - debug("Testing - setting scrollLeft to a valid value"); - shouldNotThrow('element.scrollLeft = 32'); - shouldNotThrow('element.scrollLeft = 32.1'); - shouldNotThrow('element.scrollLeft = "string"'); - shouldNotThrow('element.scrollLeft = null'); - shouldNotThrow('element.scrollLeft = undefined'); - shouldNotThrow('element.scrollLeft = Infinity'); - shouldNotThrow('element.scrollLeft = NaN'); - shouldNotThrow('element.scrollLeft = { x: 42 }'); - shouldNotThrow('element.scrollLeft = { x: 42, behavior: "auto" }'); - shouldNotThrow('element.scrollLeft = { x: 42, behavior: "instant" }'); - shouldNotThrow('element.scrollLeft = { x: 42, behavior: "smooth" }'); - - debug("Testing - setting scrollLeft to an invalid value"); - shouldThrow('element.scrollLeft = { }'); - shouldThrow('element.scrollLeft = { x: 42, behavior: "" }'); - shouldThrow('element.scrollLeft = { x: 42, behavior: "abcd" }'); - shouldThrow('element.scrollLeft = { behavior: "abcd" }'); - shouldThrow('element.scrollLeft = { behavior: "smooth" }'); - shouldThrow('element.scrollLeft = { behavior: "instant" }'); - shouldThrow('element.scrollLeft = { behavior: "smooth" }'); - - // scrollTop ///////////////////////// - debug(''); - debug('scrollTop Tests'); - debug(''); - - debug("Testing - setting scrollTop to a valid value"); - shouldNotThrow('element.scrollTop = 32'); - shouldNotThrow('element.scrollTop = 32.1'); - shouldNotThrow('element.scrollTop = "string"'); - shouldNotThrow('element.scrollTop = null'); - shouldNotThrow('element.scrollTop = undefined'); - shouldNotThrow('element.scrollTop = Infinity'); - shouldNotThrow('element.scrollTop = NaN'); - shouldNotThrow('element.scrollTop = { y: 42 }'); - shouldNotThrow('element.scrollTop = { y: 42, behavior: "auto" }'); - shouldNotThrow('element.scrollTop = { y: 42, behavior: "instant" }'); - shouldNotThrow('element.scrollTop = { y: 42, behavior: "smooth" }'); - - debug("Testing - setting scrollTop to an invalid value"); - shouldThrow('element.scrollTop = { }'); - shouldThrow('element.scrollTop = { y: 42, behavior: "" }'); - shouldThrow('element.scrollTop = { y: 42, behavior: "abcd" }'); - shouldThrow('element.scrollTop = { behavior: "abcd" }'); - shouldThrow('element.scrollTop = { behavior: "smooth" }'); - shouldThrow('element.scrollTop = { behavior: "instant" }'); - shouldThrow('element.scrollTop = { behavior: "smooth" }'); - </script> -</body> -</html> diff --git a/third_party/WebKit/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt index 903a0b8..e8c0d08 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/dom/non-numeric-values-numeric-parameters-expected.txt @@ -21,8 +21,8 @@ PASS nonNumericPolicy('createCSSStyleSheet().addRule(selector, styleText, x)') i PASS nonNumericPolicy('createCSSStyleSheet().removeRule(x)') is 'any type allowed' PASS nonNumericPolicy('document.elementFromPoint(x, 0)') is 'any type allowed' PASS nonNumericPolicy('document.elementFromPoint(0, x)') is 'any type allowed' -PASS nonNumericPolicy('document.body.scrollLeft = x') is 'mixed' -PASS nonNumericPolicy('document.body.scrollTop = x') is 'mixed' +PASS nonNumericPolicy('document.body.scrollLeft = x') is 'any type allowed' +PASS nonNumericPolicy('document.body.scrollTop = x') is 'any type allowed' PASS nonNumericPolicy('document.images.item(x)') is 'any type allowed' PASS nonNumericPolicy('document.createElement("input").setSelectionRange(x, 0)') is 'any type allowed' PASS nonNumericPolicy('document.createElement("input").setSelectionRange(0, x)') is 'any type allowed' diff --git a/third_party/WebKit/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js b/third_party/WebKit/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js index 0c87e7b..6bdcea1 100644 --- a/third_party/WebKit/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js +++ b/third_party/WebKit/LayoutTests/fast/dom/script-tests/non-numeric-values-numeric-parameters.js @@ -209,8 +209,8 @@ shouldBe("nonNumericPolicy('document.elementFromPoint(0, x)')", "'any type allow // Element -shouldBe("nonNumericPolicy('document.body.scrollLeft = x')", "'mixed'"); -shouldBe("nonNumericPolicy('document.body.scrollTop = x')", "'mixed'"); +shouldBe("nonNumericPolicy('document.body.scrollLeft = x')", "'any type allowed'"); +shouldBe("nonNumericPolicy('document.body.scrollTop = x')", "'any type allowed'"); // History 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() diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/scroll-behavior/listbox-scrollTop-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/scroll-behavior/listbox-scrollTop-expected.txt deleted file mode 100644 index e565ade..0000000 --- a/third_party/WebKit/LayoutTests/platform/linux/fast/scroll-behavior/listbox-scrollTop-expected.txt +++ /dev/null @@ -1,18 +0,0 @@ -Test that setting scrollTop on a listbox works with both scroll behaviors - - -This is a testharness.js-based test. -PASS Scroll x:0, y:34, smooth:false -PASS Scroll x:0, y:51, smooth:false -PASS Scroll x:0, y:68, smooth:false -PASS Scroll x:0, y:85, smooth:false -FAIL Scroll x:0, y:255, smooth:true assert_equals: expected "0, 85" but got "0, 255" -FAIL Scroll x:0, y:340, smooth:true assert_equals: expected "0, 255" but got "0, 340" -FAIL Scroll x:0, y:510, smooth:true assert_equals: expected "0, 340" but got "0, 510" -FAIL Scroll x:0, y:595, smooth:true assert_equals: expected "0, 510" but got "0, 595" -FAIL Scroll x:0, y:6970, smooth:true assert_equals: expected "0, 595" but got "0, 6970" -FAIL Scroll x:0, y:340, smooth:true assert_equals: expected "0, 6970" but got "0, 340" -FAIL Scroll x:0, y:6800, smooth:true assert_equals: expected "0, 340" but got "0, 6800" -FAIL Scroll x:0, y:85, smooth:true assert_equals: expected "0, 6800" but got "0, 85" -Harness: the test ran to completion. - diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/scroll-behavior/listbox-interrupted-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/scroll-behavior/listbox-interrupted-scroll-expected.txt deleted file mode 100644 index ca96e39..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/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 2850 but got 5700 -FAIL smooth scroll assert_equals: expected 2850 but got 5700 -FAIL touch scroll assert_equals: expected 2850 but got 5700 -FAIL wheel scroll assert_equals: expected 2850 but got 5700 -Harness: the test ran to completion. - diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/scroll-behavior/listbox-scrollTop-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/scroll-behavior/listbox-scrollTop-expected.txt deleted file mode 100644 index 998d159..0000000 --- a/third_party/WebKit/LayoutTests/platform/mac/fast/scroll-behavior/listbox-scrollTop-expected.txt +++ /dev/null @@ -1,18 +0,0 @@ -Test that setting scrollTop on a listbox works with both scroll behaviors - - -This is a testharness.js-based test. -PASS Scroll x:0, y:28, smooth:false -PASS Scroll x:0, y:42, smooth:false -PASS Scroll x:0, y:56, smooth:false -PASS Scroll x:0, y:70, smooth:false -FAIL Scroll x:0, y:210, smooth:true assert_equals: expected "0, 70" but got "0, 210" -FAIL Scroll x:0, y:280, smooth:true assert_equals: expected "0, 210" but got "0, 280" -FAIL Scroll x:0, y:420, smooth:true assert_equals: expected "0, 280" but got "0, 420" -FAIL Scroll x:0, y:490, smooth:true assert_equals: expected "0, 420" but got "0, 490" -FAIL Scroll x:0, y:5740, smooth:true assert_equals: expected "0, 490" but got "0, 5740" -FAIL Scroll x:0, y:280, smooth:true assert_equals: expected "0, 5740" but got "0, 280" -FAIL Scroll x:0, y:5600, smooth:true assert_equals: expected "0, 280" but got "0, 5600" -FAIL Scroll x:0, y:70, smooth:true assert_equals: expected "0, 5600" but got "0, 70" -Harness: the test ran to completion. - diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/scroll-behavior/listbox-scrollTop-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/scroll-behavior/listbox-scrollTop-expected.txt deleted file mode 100644 index e565ade..0000000 --- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/scroll-behavior/listbox-scrollTop-expected.txt +++ /dev/null @@ -1,18 +0,0 @@ -Test that setting scrollTop on a listbox works with both scroll behaviors - - -This is a testharness.js-based test. -PASS Scroll x:0, y:34, smooth:false -PASS Scroll x:0, y:51, smooth:false -PASS Scroll x:0, y:68, smooth:false -PASS Scroll x:0, y:85, smooth:false -FAIL Scroll x:0, y:255, smooth:true assert_equals: expected "0, 85" but got "0, 255" -FAIL Scroll x:0, y:340, smooth:true assert_equals: expected "0, 255" but got "0, 340" -FAIL Scroll x:0, y:510, smooth:true assert_equals: expected "0, 340" but got "0, 510" -FAIL Scroll x:0, y:595, smooth:true assert_equals: expected "0, 510" but got "0, 595" -FAIL Scroll x:0, y:6970, smooth:true assert_equals: expected "0, 595" but got "0, 6970" -FAIL Scroll x:0, y:340, smooth:true assert_equals: expected "0, 6970" but got "0, 340" -FAIL Scroll x:0, y:6800, smooth:true assert_equals: expected "0, 340" but got "0, 6800" -FAIL Scroll x:0, y:85, smooth:true assert_equals: expected "0, 6800" but got "0, 85" -Harness: the test ran to completion. - diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/scroll-behavior/listbox-scrollTop-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/scroll-behavior/listbox-scrollTop-expected.txt deleted file mode 100644 index 3d9de62..0000000 --- a/third_party/WebKit/LayoutTests/platform/win/fast/scroll-behavior/listbox-scrollTop-expected.txt +++ /dev/null @@ -1,18 +0,0 @@ -Test that setting scrollTop on a listbox works with both scroll behaviors - - -This is a testharness.js-based test. -PASS Scroll x:0, y:32, smooth:false -PASS Scroll x:0, y:48, smooth:false -PASS Scroll x:0, y:64, smooth:false -PASS Scroll x:0, y:80, smooth:false -FAIL Scroll x:0, y:240, smooth:true assert_equals: expected "0, 80" but got "0, 240" -FAIL Scroll x:0, y:320, smooth:true assert_equals: expected "0, 240" but got "0, 320" -FAIL Scroll x:0, y:480, smooth:true assert_equals: expected "0, 320" but got "0, 480" -FAIL Scroll x:0, y:560, smooth:true assert_equals: expected "0, 480" but got "0, 560" -FAIL Scroll x:0, y:6560, smooth:true assert_equals: expected "0, 560" but got "0, 6560" -FAIL Scroll x:0, y:320, smooth:true assert_equals: expected "0, 6560" but got "0, 320" -FAIL Scroll x:0, y:6400, smooth:true assert_equals: expected "0, 320" but got "0, 6400" -FAIL Scroll x:0, y:80, smooth:true assert_equals: expected "0, 6400" but got "0, 80" -Harness: the test ran to completion. - diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt index 29bcda4..651b8a9 100644 --- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt +++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt @@ -567,8 +567,11 @@ interface Element method removeAttributeNode method requestFullscreen method requestPointerLock + method scroll + method scrollBy method scrollIntoView method scrollIntoViewIfNeeded + method scrollTo method setAttribute method setAttributeNS method setAttributeNode diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8ElementCustom.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8ElementCustom.cpp index 0374445..1539043 100644 --- a/third_party/WebKit/Source/bindings/core/v8/custom/V8ElementCustom.cpp +++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8ElementCustom.cpp @@ -45,38 +45,6 @@ namespace blink { -void V8Element::scrollLeftAttributeSetterCustom(v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) -{ - ExceptionState exceptionState(ExceptionState::SetterContext, "scrollLeft", "Element", info.Holder(), info.GetIsolate()); - Element* impl = V8Element::toImpl(info.Holder()); - - if (RuntimeEnabledFeatures::cssomSmoothScrollEnabled() && value->IsObject()) { - TONATIVE_VOID(Dictionary, scrollOptionsHorizontal, Dictionary(value, info.GetIsolate(), exceptionState)); - impl->setScrollLeft(scrollOptionsHorizontal, exceptionState); - exceptionState.throwIfNeeded(); - return; - } - - TONATIVE_VOID_EXCEPTIONSTATE(float, position, toFloat(value, exceptionState), exceptionState); - impl->setScrollLeft(position); -} - -void V8Element::scrollTopAttributeSetterCustom(v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) -{ - ExceptionState exceptionState(ExceptionState::SetterContext, "scrollTop", "Element", info.Holder(), info.GetIsolate()); - Element* impl = V8Element::toImpl(info.Holder()); - - if (RuntimeEnabledFeatures::cssomSmoothScrollEnabled() && value->IsObject()) { - TONATIVE_VOID(Dictionary, scrollOptionsVertical, Dictionary(value, info.GetIsolate(), exceptionState)); - impl->setScrollTop(scrollOptionsVertical, exceptionState); - exceptionState.throwIfNeeded(); - return; - } - - TONATIVE_VOID_EXCEPTIONSTATE(float, position, toFloat(value, exceptionState), exceptionState); - impl->setScrollTop(position); -} - //////////////////////////////////////////////////////////////////////////////// // Overload resolution for animate() // FIXME: needs support for union types http://crbug.com/240176 diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp index 3118dcb..c6f06dd 100644 --- a/third_party/WebKit/Source/core/dom/Element.cpp +++ b/third_party/WebKit/Source/core/dom/Element.cpp @@ -85,6 +85,7 @@ #include "core/frame/LocalDOMWindow.h" #include "core/frame/LocalFrame.h" #include "core/frame/PinchViewport.h" +#include "core/frame/ScrollToOptions.h" #include "core/frame/Settings.h" #include "core/frame/UseCounter.h" #include "core/frame/csp/ContentSecurityPolicy.h" @@ -689,31 +690,10 @@ void Element::setScrollLeft(double newLeft) if (!view) return; - view->setScrollPosition(DoublePoint(newLeft * frame->pageZoomFactor(), view->scrollY())); + view->setScrollPosition(DoublePoint(newLeft * frame->pageZoomFactor(), view->scrollY()), ScrollBehaviorAuto); } } -void Element::setScrollLeft(const Dictionary& scrollOptionsHorizontal, ExceptionState& exceptionState) -{ - String scrollBehaviorString; - ScrollBehavior scrollBehavior = ScrollBehaviorAuto; - if (DictionaryHelper::get(scrollOptionsHorizontal, "behavior", scrollBehaviorString)) { - if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scrollBehavior)) { - exceptionState.throwTypeError("The ScrollBehavior provided is invalid."); - return; - } - } - - double position; - if (!DictionaryHelper::get(scrollOptionsHorizontal, "x", position)) { - exceptionState.throwTypeError("ScrollOptionsHorizontal must include an 'x' member."); - return; - } - - // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instantly. - setScrollLeft(position); -} - void Element::setScrollTop(double newTop) { document().updateLayoutIgnorePendingStylesheets(); @@ -739,31 +719,10 @@ void Element::setScrollTop(double newTop) if (!view) return; - view->setScrollPosition(DoublePoint(view->scrollX(), newTop * frame->pageZoomFactor())); + view->setScrollPosition(DoublePoint(view->scrollX(), newTop * frame->pageZoomFactor()), ScrollBehaviorAuto); } } -void Element::setScrollTop(const Dictionary& scrollOptionsVertical, ExceptionState& exceptionState) -{ - String scrollBehaviorString; - ScrollBehavior scrollBehavior = ScrollBehaviorAuto; - if (DictionaryHelper::get(scrollOptionsVertical, "behavior", scrollBehaviorString)) { - if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scrollBehavior)) { - exceptionState.throwTypeError("The ScrollBehavior provided is invalid."); - return; - } - } - - double position; - if (!DictionaryHelper::get(scrollOptionsVertical, "y", position)) { - exceptionState.throwTypeError("ScrollOptionsVertical must include a 'y' member."); - return; - } - - // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instantly. - setScrollTop(position); -} - int Element::scrollWidth() { document().updateLayoutIgnorePendingStylesheets(); @@ -780,6 +739,146 @@ int Element::scrollHeight() return 0; } +void Element::scrollBy(double x, double y) +{ + ScrollToOptions scrollToOptions; + scrollToOptions.setLeft(x); + scrollToOptions.setTop(y); + scrollBy(scrollToOptions); +} + +void Element::scrollBy(const ScrollToOptions& scrollToOptions) +{ + // FIXME: This should be removed once scroll updates are processed only after + // the compositing update. See http://crbug.com/420741. + document().updateLayoutIgnorePendingStylesheets(); + + if (document().documentElement() != this) { + scrollRenderBoxBy(scrollToOptions); + return; + } + + if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { + if (document().inQuirksMode()) + return; + scrollFrameBy(scrollToOptions); + } +} + +void Element::scrollTo(double x, double y) +{ + ScrollToOptions scrollToOptions; + scrollToOptions.setLeft(x); + scrollToOptions.setTop(y); + scrollTo(scrollToOptions); +} + +void Element::scrollTo(const ScrollToOptions& scrollToOptions) +{ + // FIXME: This should be removed once scroll updates are processed only after + // the compositing update. See http://crbug.com/420741. + document().updateLayoutIgnorePendingStylesheets(); + + if (document().documentElement() != this) { + scrollRenderBoxTo(scrollToOptions); + return; + } + + if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { + if (document().inQuirksMode()) + return; + scrollFrameTo(scrollToOptions); + } +} + +void Element::scrollRenderBoxBy(const ScrollToOptions& scrollToOptions) +{ + double left = scrollToOptions.hasLeft() ? scrollToOptions.left() : 0.0; + double top = scrollToOptions.hasTop() ? scrollToOptions.top() : 0.0; + if (std::isnan(left) || std::isnan(top)) + return; + + ScrollBehavior scrollBehavior = ScrollBehaviorAuto; + ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollBehavior); + RenderBox* rend = renderBox(); + if (rend) { + double currentScaledLeft = rend->scrollLeft(); + double currentScaledTop = rend->scrollTop(); + double newScaledLeft = left * rend->style()->effectiveZoom() + currentScaledLeft; + double newScaledTop = top * rend->style()->effectiveZoom() + currentScaledTop; + // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instantly. + rend->scrollToOffset(DoubleSize(newScaledLeft, newScaledTop)); + } +} + +void Element::scrollRenderBoxTo(const ScrollToOptions& scrollToOptions) +{ + if ((scrollToOptions.hasLeft() && std::isnan(scrollToOptions.left())) + || (scrollToOptions.hasTop() && std::isnan(scrollToOptions.top()))) + return; + + ScrollBehavior scrollBehavior = ScrollBehaviorAuto; + ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollBehavior); + + RenderBox* rend = renderBox(); + if (rend) { + double scaledLeft = rend->scrollLeft(); + double scaledTop = rend->scrollTop(); + if (scrollToOptions.hasLeft()) + scaledLeft = scrollToOptions.left() * rend->style()->effectiveZoom(); + if (scrollToOptions.hasTop()) + scaledTop = scrollToOptions.top() * rend->style()->effectiveZoom(); + // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instantly. + rend->scrollToOffset(DoubleSize(scaledLeft, scaledTop)); + } +} + +void Element::scrollFrameBy(const ScrollToOptions& scrollToOptions) +{ + double left = scrollToOptions.hasLeft() ? scrollToOptions.left() : 0.0; + double top = scrollToOptions.hasTop() ? scrollToOptions.top() : 0.0; + if (std::isnan(left) || std::isnan(top)) + return; + + ScrollBehavior scrollBehavior = ScrollBehaviorAuto; + ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollBehavior); + LocalFrame* frame = document().frame(); + if (!frame) + return; + FrameView* view = frame->view(); + if (!view) + return; + + double newScaledLeft = left * frame->pageZoomFactor() + view->scrollX(); + double newScaledTop = top * frame->pageZoomFactor() + view->scrollY(); + view->setScrollPosition(DoublePoint(newScaledLeft, newScaledTop), scrollBehavior); +} + +void Element::scrollFrameTo(const ScrollToOptions& scrollToOptions) +{ + double left = scrollToOptions.hasLeft() ? scrollToOptions.left() : 0.0; + double top = scrollToOptions.hasTop() ? scrollToOptions.top() : 0.0; + if (std::isnan(left) || std::isnan(top)) + return; + + ScrollBehavior scrollBehavior = ScrollBehaviorAuto; + ScrollableArea::scrollBehaviorFromString(scrollToOptions.behavior(), scrollBehavior); + LocalFrame* frame = document().frame(); + if (!frame) + return; + FrameView* view = frame->view(); + if (!view) + return; + + double scaledLeft = view->scrollX(); + double scaledTop = view->scrollY(); + if (scrollToOptions.hasLeft()) + scaledLeft = scrollToOptions.left() * frame->pageZoomFactor(); + if (scrollToOptions.hasTop()) + scaledTop = scrollToOptions.top() * frame->pageZoomFactor(); + view->setScrollPosition(DoublePoint(scaledLeft, scaledTop), scrollBehavior); +} + IntRect Element::boundsInRootViewSpace() { document().updateLayoutIgnorePendingStylesheets(); diff --git a/third_party/WebKit/Source/core/dom/Element.h b/third_party/WebKit/Source/core/dom/Element.h index d2b3a54..565f3dc 100644 --- a/third_party/WebKit/Source/core/dom/Element.h +++ b/third_party/WebKit/Source/core/dom/Element.h @@ -60,6 +60,7 @@ class Locale; class MutableStylePropertySet; class PropertySetCSSStyleDeclaration; class PseudoElement; +class ScrollToOptions; class ShadowRoot; class StylePropertySet; @@ -182,12 +183,17 @@ public: virtual double scrollLeft(); virtual double scrollTop(); virtual void setScrollLeft(double); - virtual void setScrollLeft(const Dictionary& scrollOptionsHorizontal, ExceptionState&); virtual void setScrollTop(double); - virtual void setScrollTop(const Dictionary& scrollOptionsVertical, ExceptionState&); virtual int scrollWidth(); virtual int scrollHeight(); + virtual void scrollBy(double x, double y); + virtual void scrollBy(const ScrollToOptions&); + virtual void scrollTo(double x, double y); + virtual void scrollTo(const ScrollToOptions&); + void scroll(double x, double y) { scrollTo(x, y); } + void scroll(const ScrollToOptions& scrollToOptions) { scrollTo(scrollToOptions); } + IntRect boundsInRootViewSpace(); PassRefPtrWillBeRawPtr<ClientRectList> getClientRects(); @@ -534,6 +540,11 @@ protected: virtual void parserDidSetAttributes() { }; + void scrollRenderBoxBy(const ScrollToOptions&); + void scrollRenderBoxTo(const ScrollToOptions&); + void scrollFrameBy(const ScrollToOptions&); + void scrollFrameTo(const ScrollToOptions&); + private: bool hasElementFlag(ElementFlags mask) const { return hasRareData() && hasElementFlagInternal(mask); } void setElementFlag(ElementFlags, bool value = true); diff --git a/third_party/WebKit/Source/core/dom/Element.idl b/third_party/WebKit/Source/core/dom/Element.idl index 121f7e1..1e5555a 100644 --- a/third_party/WebKit/Source/core/dom/Element.idl +++ b/third_party/WebKit/Source/core/dom/Element.idl @@ -69,15 +69,18 @@ interface Element : Node { readonly attribute long clientWidth; readonly attribute long clientHeight; - // FIXME: should be: - // attribute (Dictionary or double) scrollLeft; - // attribute (Dictionary or double) scrollTop; - // http://crbug.com/240176 - [Custom=Setter] attribute double scrollLeft; - [Custom=Setter] attribute double scrollTop; + attribute double scrollLeft; + attribute double scrollTop; readonly attribute long scrollWidth; readonly attribute long scrollHeight; + [RuntimeEnabled=CSSOMSmoothScroll] void scroll(double x, double y); + [RuntimeEnabled=CSSOMSmoothScroll] void scroll(optional ScrollToOptions scrollToOptions); + [RuntimeEnabled=CSSOMSmoothScroll] void scrollTo(double x, double y); + [RuntimeEnabled=CSSOMSmoothScroll] void scrollTo(optional ScrollToOptions scrollToOptions); + [RuntimeEnabled=CSSOMSmoothScroll] void scrollBy(double x, double y); + [RuntimeEnabled=CSSOMSmoothScroll] void scrollBy(optional ScrollToOptions scrollToOptions); + void focus(); void blur(); void scrollIntoView(optional boolean alignWithTop); diff --git a/third_party/WebKit/Source/core/html/HTMLBodyElement.cpp b/third_party/WebKit/Source/core/html/HTMLBodyElement.cpp index c855c82..dc20558 100644 --- a/third_party/WebKit/Source/core/html/HTMLBodyElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLBodyElement.cpp @@ -33,6 +33,7 @@ #include "core/dom/Attribute.h" #include "core/frame/FrameView.h" #include "core/frame/LocalFrame.h" +#include "core/frame/ScrollToOptions.h" #include "core/frame/UseCounter.h" #include "core/html/HTMLFrameElementBase.h" #include "core/html/parser/HTMLParserIdioms.h" @@ -265,7 +266,7 @@ void HTMLBodyElement::setScrollLeft(double scrollLeft) FrameView* view = frame->view(); if (!view) return; - view->setScrollPosition(DoublePoint(scrollLeft * frame->pageZoomFactor(), view->scrollY())); + view->setScrollPosition(DoublePoint(scrollLeft * frame->pageZoomFactor(), view->scrollY()), ScrollBehaviorAuto); } double HTMLBodyElement::scrollTop() @@ -315,7 +316,7 @@ void HTMLBodyElement::setScrollTop(double scrollTop) FrameView* view = frame->view(); if (!view) return; - view->setScrollPosition(DoublePoint(view->scrollX(), scrollTop * frame->pageZoomFactor())); + view->setScrollPosition(DoublePoint(view->scrollX(), scrollTop * frame->pageZoomFactor()), ScrollBehaviorAuto); } int HTMLBodyElement::scrollHeight() @@ -336,4 +337,50 @@ int HTMLBodyElement::scrollWidth() return view ? adjustForZoom(view->contentsWidth(), &document) : 0; } +void HTMLBodyElement::scrollBy(const ScrollToOptions& scrollToOptions) +{ + Document& document = this->document(); + + // FIXME: This should be removed once scroll updates are processed only after + // the compositing update. See http://crbug.com/420741. + document.updateLayoutIgnorePendingStylesheets(); + + if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { + RenderBox* render = renderBox(); + if (!render) + return; + if (render->hasOverflowClip()) { + scrollRenderBoxBy(scrollToOptions); + return; + } + if (!document.inQuirksMode()) + return; + } + + scrollFrameBy(scrollToOptions); +} + +void HTMLBodyElement::scrollTo(const ScrollToOptions& scrollToOptions) +{ + Document& document = this->document(); + + // FIXME: This should be removed once scroll updates are processed only after + // the compositing update. See http://crbug.com/420741. + document.updateLayoutIgnorePendingStylesheets(); + + if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { + RenderBox* render = renderBox(); + if (!render) + return; + if (render->hasOverflowClip()) { + scrollRenderBoxTo(scrollToOptions); + return; + } + if (!document.inQuirksMode()) + return; + } + + scrollFrameTo(scrollToOptions); +} + } // namespace blink diff --git a/third_party/WebKit/Source/core/html/HTMLBodyElement.h b/third_party/WebKit/Source/core/html/HTMLBodyElement.h index a03e9e8..6537422 100644 --- a/third_party/WebKit/Source/core/html/HTMLBodyElement.h +++ b/third_party/WebKit/Source/core/html/HTMLBodyElement.h @@ -69,6 +69,9 @@ private: virtual int scrollHeight() override; virtual int scrollWidth() override; + + virtual void scrollBy(const ScrollToOptions&) override; + virtual void scrollTo(const ScrollToOptions&) override; }; } // namespace blink diff --git a/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp b/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp index 82da077..149c883 100644 --- a/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp +++ b/third_party/WebKit/Source/core/html/HTMLSelectElement.cpp @@ -736,7 +736,7 @@ void HTMLSelectElement::scrollToSelection() return; if (usesMenuList()) return; - scrollTo(activeSelectionEndListIndex()); + scrollToIndex(activeSelectionEndListIndex()); if (AXObjectCache* cache = document().existingAXObjectCache()) cache->selectedChildrenChanged(this); } @@ -887,11 +887,11 @@ void HTMLSelectElement::setSuggestedIndex(int suggestedIndex) if (RenderObject* renderer = this->renderer()) { renderer->updateFromElement(); - scrollTo(suggestedIndex); + scrollToIndex(suggestedIndex); } } -void HTMLSelectElement::scrollTo(int listIndex) +void HTMLSelectElement::scrollToIndex(int listIndex) { if (listIndex < 0) return; @@ -1572,7 +1572,7 @@ void HTMLSelectElement::listBoxDefaultEventHandler(Event* event) setActiveSelectionAnchorIndex(m_activeSelectionEndIndex); } - scrollTo(endIndex); + scrollToIndex(endIndex); if (selectNewItem) { updateListBoxSelection(deselectOthers); listBoxOnChange(); diff --git a/third_party/WebKit/Source/core/html/HTMLSelectElement.h b/third_party/WebKit/Source/core/html/HTMLSelectElement.h index 9e350d1..fe426e7 100644 --- a/third_party/WebKit/Source/core/html/HTMLSelectElement.h +++ b/third_party/WebKit/Source/core/html/HTMLSelectElement.h @@ -101,7 +101,7 @@ public: HTMLOptionElement* item(unsigned index); void scrollToSelection(); - void scrollTo(int listIndex); + void scrollToIndex(int listIndex); void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true); |