Index: third_party/WebKit/LayoutTests/external/wpt/cssom-view/scrollIntoView-empty-args.html |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/cssom-view/scrollIntoView-empty-args.html b/third_party/WebKit/LayoutTests/external/wpt/cssom-view/scrollIntoView-empty-args.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8ffd68a414996dcf72d8c305af53648453d084fc |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/external/wpt/cssom-view/scrollIntoView-empty-args.html |
@@ -0,0 +1,50 @@ |
+<!DOCTYPE HTML> |
+<script src="/resources/testharness.js"></script> |
+<script src="/resources/testharnessreport.js"></script> |
+<title>Check End Position of scrollIntoView when arg is not fully specified</title> |
+<div id="container" style="height: 2500px; width: 2500px;"> |
+ <div id="content" style="height: 500px; width: 500px;margin-left: 1000px; margin-right: 1000px; margin-top: 1000px;margin-bottom: 1000px;background-color: red"> |
+ </div> |
+</div> |
+<script> |
+add_completion_callback(() => document.getElementById("container").remove()); |
+var content_height = 500; |
+var content_width = 500; |
+var window_height = document.documentElement.clientHeight; |
+var window_width = document.documentElement.clientWidth; |
+var content = document.getElementById("content"); |
+ |
+function instantScrollToTestArgs(arg, expected_x, expected_y) { |
+ window.scrollTo(0, 0); |
+ assert_not_equals(window.scrollX, expected_x); |
+ assert_not_equals(window.scrollY, expected_y); |
+ if (arg == "omitted") |
+ content.scrollIntoView(); |
+ else |
+ content.scrollIntoView(arg); |
+ assert_approx_equals(window.scrollX, expected_x, 1); |
+ assert_approx_equals(window.scrollY, expected_y, 1); |
+} |
+ |
+test(t => { |
+ instantScrollToTestArgs("omitted", |
+ content.offsetLeft + content_width - window_width, |
+ content.offsetTop); |
+ instantScrollToTestArgs(true, |
+ content.offsetLeft + content_width - window_width, |
+ content.offsetTop); |
+ instantScrollToTestArgs(false, |
+ content.offsetLeft + content_width - window_width, |
+ content.offsetTop + content_height - window_height); |
+ instantScrollToTestArgs({}, |
+ content.offsetLeft + (content_width - window_width) / 2, |
+ content.offsetTop + (content_height - window_height) / 2); |
+ instantScrollToTestArgs(null, |
+ content.offsetLeft + (content_width - window_width) / 2, |
+ content.offsetTop + (content_height - window_height) / 2); |
+ instantScrollToTestArgs(undefined, |
+ content.offsetLeft + content_width - window_width, |
+ content.offsetTop); |
+}, "scrollIntoView should behave correctly when the arg is not fully specified as ScrollIntoViewOptions"); |
+ |
+</script> |