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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/intersection-observer/resources/cross-origin-subframe.html

Issue 1780163002: Revert of IntersectionObserver: use an idle callback to send notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/intersection-observer/resources/cross-origin-subframe.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/intersection-observer/resources/cross-origin-subframe.html b/third_party/WebKit/LayoutTests/http/tests/intersection-observer/resources/cross-origin-subframe.html
index eda791fae670431f70a6ca3c0678ef80719c4337..d2a40dd8987e6bfdd33ccae4f74d864484593864 100644
--- a/third_party/WebKit/LayoutTests/http/tests/intersection-observer/resources/cross-origin-subframe.html
+++ b/third_party/WebKit/LayoutTests/http/tests/intersection-observer/resources/cross-origin-subframe.html
@@ -14,54 +14,60 @@
// Instead of RAF-ing, we just post an empty message to the parent window, which will
// RAF when it is received, and then send us a message to cause the next step to run.
+function observer_callback(changes) {
+ for (var i in changes)
+ entries.push(changes[i]);
+}
+
// Use a rootMargin here, and verify it does NOT get applied for the cross-origin case.
-var observer = new IntersectionObserver(
- changes => { entries = entries.concat(changes) },
- { rootMargin: "7px" }
-);
+var observer = new IntersectionObserver(observer_callback, {rootMargin: "7px"});
observer.observe(target);
function step0() {
- entries = entries.concat(observer.takeRecords());
- nextStep = step1;
- port.postMessage({actual: entries.map(entryToJson), expected: []}, "*");
- entries = [];
- port.postMessage({scrollTo: 200}, "*");
+ setTimeout(function() {
+ nextStep = step1;
+ port.postMessage({actual: entries.map(entryToJson), expected: []}, "*");
+ entries = [];
+ port.postMessage({scrollTo: 200}, "*");
+ });
}
function step1() {
- entries = entries.concat(observer.takeRecords());
- port.postMessage({actual: entries.map(entryToJson), expected: []}, "*");
- entries = [];
- scroller.scrollTop = 250;
- nextStep = step2;
- port.postMessage({}, "*");
+ setTimeout(function() {
+ port.postMessage({actual: entries.map(entryToJson), expected: []}, "*");
+ entries = [];
+ scroller.scrollTop = 250;
+ nextStep = step2;
+ port.postMessage({}, "*");
+ });
}
function step2() {
- entries = entries.concat(observer.takeRecords());
- var expected = [{
- boundingClientRect: coordinatesToClientRectJson(-42, 108, 58, 8),
- intersectionRect: coordinatesToClientRectJson(0, 108, 58, 8),
- rootBounds: "null",
- target: target.id
- }];
- port.postMessage({actual: entries.map(entryToJson), expected: expected}, "*");
- entries = [];
- nextStep = step3;
- port.postMessage({scrollTo: 100}, "*");
+ setTimeout(function() {
+ var expected = [{
+ boundingClientRect: coordinatesToClientRectJson(-42, 108, 58, 8),
+ intersectionRect: coordinatesToClientRectJson(0, 108, 58, 8),
+ rootBounds: "null",
+ target: target.id
+ }];
+ port.postMessage({actual: entries.map(entryToJson), expected: expected}, "*");
+ entries = [];
+ nextStep = step3;
+ port.postMessage({scrollTo: 100}, "*");
+ });
}
function step3() {
- entries = entries.concat(observer.takeRecords());
- var expected = [{
- boundingClientRect: coordinatesToClientRectJson(-42, 108, 58, 8),
- intersectionRect: coordinatesToClientRectJson(0, 0, 0, 0),
- rootBounds: "null",
- target: target.id
- }];
- port.postMessage({actual: entries.map(entryToJson), expected: expected}, "*");
- port.postMessage({DONE: 1}, "*");
+ setTimeout(function() {
+ var expected = [{
+ boundingClientRect: coordinatesToClientRectJson(-42, 108, 58, 8),
+ intersectionRect: coordinatesToClientRectJson(0, 0, 0, 0),
+ rootBounds: "null",
+ target: target.id
+ }];
+ port.postMessage({actual: entries.map(entryToJson), expected: expected}, "*");
+ port.postMessage({DONE: 1}, "*");
+ });
}
function handleMessage(event)

Powered by Google App Engine
This is Rietveld 408576698