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

Unified Diff: third_party/WebKit/LayoutTests/intersection-observer/same-document-no-root.html

Issue 1449623002: IntersectionObserver: second cut. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Implemented root margin Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/intersection-observer/same-document-no-root.html
diff --git a/third_party/WebKit/LayoutTests/intersection-observer/same-document-no-root.html b/third_party/WebKit/LayoutTests/intersection-observer/same-document-no-root.html
new file mode 100644
index 0000000000000000000000000000000000000000..845e8f4b3dfe6bde8087a869ca41a3cbe7809247
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/intersection-observer/same-document-no-root.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<div style="width:100%;height:700px;"></div>
+<div id="target" style="background-color: green; width:100px; height:100px"></div>
+<div style="width:100%; height:700px;"></div>
+
+<script src="../resources/js-test.js"></script>
+<script src="helper-functions.js"></script>
+<script>
+ description("Simple intersection observer test with no explicit root and one document.");
+ var target = document.getElementById("target");
+ var entries = [];
+
+ observer_callback = function(changes) {
+ for (var i in changes)
+ entries.push(changes[i]);
+ };
+ var observer = new IntersectionObserver(observer_callback, {});
+ observer.observe(target);
+
+ // TODO: It shouldn't be necessary to RAF after the call to observer()
+ // and before changing the scroll position, but it is.
+
+ var expected0 = [];
+ function step0() {
+ setTimeout(function() {
+ checkResults(expected0, "entries");
+ document.scrollingElement.scrollTop = 300;
+ requestAnimationFrame(step1);
+ });
+ }
+
+ var expected1 = [
+ {
+ 'boundingClientRect': [ 8, 108, 408, 508 ],
+ 'intersectionRect': [ 8, 108, 408, 508 ],
+ 'rootBounds' : [ 0, 785, 0, 600 ],
+ 'target': target
+ },
+ ];
+ function step1() {
+ setTimeout(function() {
+ checkResults(expected1, "entries");
+ document.scrollingElement.scrollTop = 100;
+ requestAnimationFrame(step2);
+ });
+ }
+
+ var expected2 = expected1.concat([
+ {
+ 'boundingClientRect': [ 8, 108, 608, 708 ],
+ 'intersectionRect': [ 0, 0, 0, 0 ],
+ 'rootBounds' : [ 0, 785, 0, 600 ],
+ 'target': target
+ }
+ ]);
+ function step2() {
+ setTimeout(function() {
+ checkResults(expected2, "entries", 1);
+ finishTest();
+ document.scrollingElement.scrollTop = 0;
+ });
+ }
+
+ requestAnimationFrame(step0);
+</script>

Powered by Google App Engine
This is Rietveld 408576698