WebKit Bugzilla
Attachment 349422 Details for
Bug 189515
: [IntersectionObserver] Update WPTs to the latest upstream version
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189515-20180911152422.patch (text/plain), 8.90 KB, created by
Ali Juma
on 2018-09-11 12:24:22 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Ali Juma
Created:
2018-09-11 12:24:22 PDT
Size:
8.90 KB
patch
obsolete
>Subversion Revision: 235894 >diff --git a/LayoutTests/imported/w3c/ChangeLog b/LayoutTests/imported/w3c/ChangeLog >index e60abee4189f1442afc52c598099305a20175ed1..155cecf648bf20521d7af18af0aae431d031794a 100644 >--- a/LayoutTests/imported/w3c/ChangeLog >+++ b/LayoutTests/imported/w3c/ChangeLog >@@ -1 +1,14 @@ >+2018-09-11 Ali Juma <ajuma@chromium.org> >+ >+ [IntersectionObserver] Update WPTs to the latest upstream version >+ https://bugs.webkit.org/show_bug.cgi?id=189515 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * web-platform-tests/intersection-observer/initial-observation-with-threshold-expected.txt: Added. >+ * web-platform-tests/intersection-observer/initial-observation-with-threshold.html: Added. >+ * web-platform-tests/intersection-observer/resources/intersection-observer-test-utils.js: >+ (waitForNotification): >+ * web-platform-tests/intersection-observer/w3c-import.log: >+ > == Rolled over to ChangeLog-2018-09-11 == >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/initial-observation-with-threshold-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/initial-observation-with-threshold-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..6c89649486e8deece23d1c3fca33de878491b242 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/initial-observation-with-threshold-expected.txt >@@ -0,0 +1,5 @@ >+ >+PASS First observation with a threshold. >+FAIL First rAF assert_equals: entries[0].isIntersecting expected false but got true >+PASS root.scrollTop = 20 >+ >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/initial-observation-with-threshold.html b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/initial-observation-with-threshold.html >new file mode 100644 >index 0000000000000000000000000000000000000000..d677f0eefa84b7394ab92ccb0ad0cd43b3208476 >--- /dev/null >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/initial-observation-with-threshold.html >@@ -0,0 +1,60 @@ >+<!DOCTYPE html> >+<script src="/resources/testharness.js"></script> >+<script src="/resources/testharnessreport.js"></script> >+<script src="./resources/intersection-observer-test-utils.js"></script> >+ >+<style> >+pre, #log { >+ position: absolute; >+ top: 0; >+ left: 200px; >+} >+.spacer { >+ height: calc(100vh + 100px); >+} >+#root { >+ display: inline-block; >+ overflow-y: scroll; >+ height: 240px; >+ border: 3px solid black; >+} >+#target { >+ width: 100px; >+ height: 100px; >+ margin: 200px 0 0 0; >+ background-color: green; >+} >+</style> >+ >+<div id="root"> >+ <div id="target"></div> >+</div> >+ >+<script> >+var entries = []; >+var root, target; >+ >+runTestCycle(function() { >+ target = document.getElementById("target"); >+ assert_true(!!target, "target exists"); >+ root = document.getElementById("root"); >+ assert_true(!!root, "root exists"); >+ var observer = new IntersectionObserver(function(changes) { >+ entries = entries.concat(changes) >+ }, { root: root, threshold: [0.5] }); >+ observer.observe(target); >+ entries = entries.concat(observer.takeRecords()); >+ assert_equals(entries.length, 0, "No initial notifications."); >+ runTestCycle(step0, "First rAF"); >+}, "First observation with a threshold."); >+ >+function step0() { >+ root.scrollTop = 20; >+ runTestCycle(step1, "root.scrollTop = 20"); >+ checkLastEntry(entries, 0, [ 11, 111, 211, 311, 11, 111, 211, 251, 11, 111, 11, 251, false]); >+} >+ >+function step1() { >+ checkLastEntry(entries, 1, [ 11, 111, 191, 291, 11, 111, 191, 251, 11, 111, 11, 251, true]); >+} >+</script> >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/resources/intersection-observer-test-utils.js b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/resources/intersection-observer-test-utils.js >index 5ad811932f06c34f1bb3bfd70094a0cd5c046c56..8683c8b570c8bffbe413315c2b36ec1e47a6d650 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/resources/intersection-observer-test-utils.js >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/resources/intersection-observer-test-utils.js >@@ -6,23 +6,73 @@ > // - Modify DOM in a way that should trigger an IntersectionObserver callback. > // - BeginFrame > // - requestAnimationFrame handler runs >-// - First step_timeout() >+// - Second requestAnimationFrame() > // - Style, layout, paint > // - IntersectionObserver generates new notifications > // - Posts a task to deliver notifications >-// - First step_timeout handler runs >-// - Second step_timeout() > // - Task to deliver IntersectionObserver notifications runs > // - IntersectionObserver callbacks run >-// - Second step_timeout handler runs >+// - Second requestAnimationFrameHandler runs >+// - step_timeout() >+// - step_timeout handler runs > // - myTestFunction1() > // - [optional] waitForNotification(myTestFunction2) > // - requestAnimationFrame() > // - Verify newly-arrived IntersectionObserver notifications > // - [optional] Modify DOM to trigger new notifications >+// >+// Ideally, it should be sufficient to use requestAnimationFrame followed >+// by two step_timeouts, with the first step_timeout firing in between the >+// requestAnimationFrame handler and the task to deliver notifications. >+// However, the precise timing of requestAnimationFrame, the generation of >+// a new display frame (when IntersectionObserver notifications are >+// generated), and the delivery of these events varies between engines, making >+// this tricky to test in a non-flaky way. >+// >+// In particular, in WebKit, requestAnimationFrame and the generation of >+// a display frame are two separate tasks, so a step_timeout called within >+// requestAnimationFrame can fire before a display frame is generated. >+// >+// In Gecko, on the other hand, requestAnimationFrame and the generation of >+// a display frame are a single task, and IntersectionObserver notifications >+// are generated during this task. However, the task posted to deliver these >+// notifications can fire after the following requestAnimationFrame. >+// >+// This means that in general, by the time the second requestAnimationFrame >+// handler runs, we know that IntersectionObservations have been generated, >+// and that a task to deliver these notifications has been posted (though >+// possibly not yet delivered). Then, by the time the step_timeout() handler >+// runs, these notifications have been delivered. >+// >+// Since waitForNotification uses a double-rAF, it is now possible that >+// IntersectionObservers may have generated more notifications than what is >+// under test, but have not yet scheduled the new batch of notifications for >+// delivery. As a result, observer.takeRecords should NOT be used in tests: >+// >+// - myTestFunction0() >+// - waitForNotification(myTestFunction1) >+// - requestAnimationFrame() >+// - Modify DOM in a way that should trigger an IntersectionObserver callback. >+// - BeginFrame >+// - requestAnimationFrame handler runs >+// - Second requestAnimationFrame() >+// - Style, layout, paint >+// - IntersectionObserver generates a batch of notifications >+// - Posts a task to deliver notifications >+// - Task to deliver IntersectionObserver notifications runs >+// - IntersectionObserver callbacks run >+// - BeginFrame >+// - Second requestAnimationFrameHandler runs >+// - step_timeout() >+// - IntersectionObserver generates another batch of notifications >+// - Post task to deliver notifications >+// - step_timeout handler runs >+// - myTestFunction1() >+// - At this point, observer.takeRecords will get the second batch of >+// notifications. > function waitForNotification(t, f) { > requestAnimationFrame(function() { >- t.step_timeout(function() { t.step_timeout(f); }); >+ requestAnimationFrame(function() { t.step_timeout(f); }); > }); > } > >diff --git a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/w3c-import.log >index ac05011f80e2ea2cff4da6ba63cc4a8a3429ba5a..4a6cbaf2ceb7fa51e316536443475d77c24d2125 100644 >--- a/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/w3c-import.log >+++ b/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/w3c-import.log >@@ -24,6 +24,7 @@ List of files: > /LayoutTests/imported/w3c/web-platform-tests/intersection-observer/edge-inclusive-intersection.html > /LayoutTests/imported/w3c/web-platform-tests/intersection-observer/idlharness.window.js > /LayoutTests/imported/w3c/web-platform-tests/intersection-observer/iframe-no-root.html >+/LayoutTests/imported/w3c/web-platform-tests/intersection-observer/initial-observation-with-threshold.html > /LayoutTests/imported/w3c/web-platform-tests/intersection-observer/inline-client-rect.html > /LayoutTests/imported/w3c/web-platform-tests/intersection-observer/isIntersecting-change-events.html > /LayoutTests/imported/w3c/web-platform-tests/intersection-observer/multiple-targets.html
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189515
: 349422