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

Unified Diff: third_party/WebKit/LayoutTests/intersection-observer/shadow-content.html

Issue 2298933003: [IntersectionObserver] Enable observations across shadow DOM roots. (Closed)
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/intersection-observer/shadow-content-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/intersection-observer/shadow-content.html
diff --git a/third_party/WebKit/LayoutTests/intersection-observer/shadow-content.html b/third_party/WebKit/LayoutTests/intersection-observer/shadow-content.html
new file mode 100644
index 0000000000000000000000000000000000000000..7a990e30f803604f5774af20ae4425a5999ba42c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/intersection-observer/shadow-content.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<script src="../resources/js-test.js"></script>
+<script src="../resources/intersection-observer-helper-functions.js"></script>
+<div id="host"></div>
+
+<script>
+description("Tests that observations can be made across shadow DOM boundaries.");
+var entries = [];
+var target;
+var observer = new IntersectionObserver(changes => { entries = entries.concat(changes) });
+
+onload = function() {
+ let shadowHost = document.getElementById("host");
+ let shadowRoot = shadowHost.createShadowRoot();
+ target = document.createElement('div');
+ target.style.cssText = "background-color: green; width:100px; height:100px";
+ shadowRoot.appendChild(target);
+ observer.observe(target);
+
+ entries = entries.concat(observer.takeRecords());
+ shouldBeEqualToNumber("entries.length", 0);
+ waitForNotification(step1);
+};
+
+function step1() {
+ shouldBeEqualToNumber("entries.length", 1);
+ if (entries.length > 0) {
+ shouldBeEqualToNumber("entries[0].boundingClientRect.left", 8);
+ shouldBeEqualToNumber("entries[0].boundingClientRect.right", 108);
+ shouldBeEqualToNumber("entries[0].boundingClientRect.top", 8);
+ shouldBeEqualToNumber("entries[0].boundingClientRect.bottom", 108);
+ shouldBeEqualToNumber("entries[0].intersectionRect.left", 8);
+ shouldBeEqualToNumber("entries[0].intersectionRect.right", 108);
+ shouldBeEqualToNumber("entries[0].intersectionRect.top", 8);
+ shouldBeEqualToNumber("entries[0].intersectionRect.bottom", 108);
+ shouldBeEqualToNumber("entries[0].rootBounds.left", 0);
+ shouldBeEqualToNumber("entries[0].rootBounds.right", 800);
+ shouldBeEqualToNumber("entries[0].rootBounds.top", 0);
+ shouldBeEqualToNumber("entries[0].rootBounds.bottom", 600);
+ shouldEvaluateToSameObject("entries[0].target", target);
+ }
+ finishJSTest();
+}
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/intersection-observer/shadow-content-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698