From b0d4851c2df5d255597323be885f22dfbc094c1b Mon Sep 17 00:00:00 2001 From: Mason Freed Date: Tue, 9 May 2023 09:46:33 -0700 Subject: [PATCH] Add a test for fullscreen for the A/B/A case See the discussion at [1] for more context. This test requests fullscreen on A, then B, then A, where A and B are sibling divs. All three requests should succeed, and at the end, A should be topmost (and the fullscreen element) with both A and B in the top layer. [1] https://github.com/whatwg/fullscreen/pull/223 Change-Id: I3f35dda5b9eb1bc24201616bb5bb4949d20fd170 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4501251 Commit-Queue: Mason Freed Reviewed-by: Joey Arhar Auto-Submit: Mason Freed Cr-Commit-Position: refs/heads/main@{#1141456} --- fullscreen/api/fullscreen-reordering.html | 62 +++++++++++++++++++ .../popovers/resources/popover-utils.js | 16 +++++ 2 files changed, 78 insertions(+) create mode 100644 fullscreen/api/fullscreen-reordering.html diff --git a/fullscreen/api/fullscreen-reordering.html b/fullscreen/api/fullscreen-reordering.html new file mode 100644 index 00000000000000..1a286c32c77034 --- /dev/null +++ b/fullscreen/api/fullscreen-reordering.html @@ -0,0 +1,62 @@ + +Re-requesting fullscreen doesn't fail but doesn't change order + + + + + + +
+
Element A
+
Element B
+
+ + + + diff --git a/html/semantics/popovers/resources/popover-utils.js b/html/semantics/popovers/resources/popover-utils.js index 39de6aa99b1fc8..aa69b7d41ae032 100644 --- a/html/semantics/popovers/resources/popover-utils.js +++ b/html/semantics/popovers/resources/popover-utils.js @@ -47,6 +47,22 @@ async function sendEnter() { function isElementVisible(el) { return !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length); } +function isTopLayer(el) { + // A bit of a hack. Just test a few properties of the ::backdrop pseudo + // element that change when in the top layer. + const properties = ['right','background']; + const testEl = document.createElement('div'); + document.body.appendChild(testEl); + const computedStyle = getComputedStyle(testEl, '::backdrop'); + const nonTopLayerValues = properties.map(p => computedStyle[p]); + testEl.remove(); + for(let i=0;i animation.finish()); await waitForRender();