Bug 1495082 [wpt PR 13264] - [IntersectionObserver] Report coordinates as CSS pixels., a=testonly
authorStefan Zager <szager@chromium.org>
Fri, 05 Oct 2018 14:21:12 +0000
changeset 440065 8efa34f3f13352d1a6be479da05fe49810319a16
parent 440064 045dc67ac4567604c0b05d1cf285a1ebce2ff83f
child 440066 4248f5d3fc599f024dde8c705fe9d809dc40e256
push id34806
push usernerli@mozilla.com
push dateTue, 09 Oct 2018 04:03:56 +0000
treeherdermozilla-central@6a6c984745ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1495082, 13264, 887974, 1250121, 595190
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1495082 [wpt PR 13264] - [IntersectionObserver] Report coordinates as CSS pixels., a=testonly Automatic update from web-platform-tests[IntersectionObserver] Report coordinates as CSS pixels. Prior to this patch, IntersectionObserverEntry was reporting coordinates in device pixels. BUG=887974 Change-Id: Ic91748cd2eb9b828a787bb4372d5d5b10bcf8cfb Reviewed-on: https://chromium-review.googlesource.com/1250121 Commit-Queue: Stefan Zager <szager@chromium.org> Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Cr-Commit-Position: refs/heads/master@{#595190} -- wpt-commits: 0d51e91a0b57a591adf3341d2ab6823d6588ede7 wpt-pr: 13264
testing/web-platform/tests/intersection-observer/bounding-box.html
--- a/testing/web-platform/tests/intersection-observer/bounding-box.html
+++ b/testing/web-platform/tests/intersection-observer/bounding-box.html
@@ -8,17 +8,17 @@ pre, #log {
   position: absolute;
   top: 0;
   left: 200px;
 }
 #root {
   overflow: visible;
   height: 200px;
   width: 160px;
-  border: 7px solid black;
+  border: 8px solid black;
 }
 #target {
   margin: 10px;
   width: 100px;
   height: 100px;
   padding: 10px;
   background-color: green;
 }
@@ -45,17 +45,40 @@ runTestCycle(function() {
   assert_equals(entries.length, 0, "No initial notifications.");
   runTestCycle(step0, "First rAF.");
 }, "Test that the target's border bounding box is used to calculate intersection.");
 
 function step0() {
   var targetBounds = clientBounds(target);
   target.style.transform = "translateY(195px)";
   runTestCycle(step1, "target.style.transform = 'translateY(195px)'");
-  checkLastEntry(entries, 0, targetBounds.concat(0, 0, 0, 0, 8, 182, 8, 222, false));
+  checkLastEntry(entries, 0, targetBounds.concat(0, 0, 0, 0, 8, 184, 8, 224, false));
 }
 
 function step1() {
   var targetBounds = clientBounds(target);
+  target.style.transform = "translateY(300px)";
+  runTestCycle(step2, "target.style.transform = 'translateY(300px)'");
+  checkLastEntry(entries, 1, targetBounds.concat(26, 146, 221, 224, 8, 184, 8, 224, true));
+}
+
+function step2() {
+  var targetBounds = clientBounds(target);
   target.style.transform = "";
-  checkLastEntry(entries, 1, targetBounds.concat(25, 145, 220, 222, 8, 182, 8, 222, true));
+  target.style.zoom = "2";
+  runTestCycle(step3, "target.style.zoom = 2");
+  checkLastEntry(entries, 2, targetBounds.concat(0, 0, 0, 0, 8, 184, 8, 224, false));
 }
+
+function step3() {
+  var targetBounds = clientBounds(target);
+  var intersectionWidth = (
+      176  // root width including border
+      -8   // root left border
+      -20  // target left margin * target zoom
+  ) / 2;   // convert to target's zoom factor.
+  var intersectionHeight = (216 - 8 - 20) / 2;
+  var intersectionRect = [targetBounds[0], targetBounds[0] + intersectionWidth,
+                          targetBounds[2], targetBounds[2] + intersectionHeight];
+  checkLastEntry(entries, 3, targetBounds.concat(intersectionRect).concat(8, 184, 8, 224, true));
+}
+
 </script>