From 28a0b342a5d9cb8fd6b61138dd98c97f20ed8d06 Mon Sep 17 00:00:00 2001 From: Mason Freed Date: Wed, 22 Jan 2025 12:22:05 -0800 Subject: [PATCH] Remove the HTMLPopoverActionHover flag [3/N] This functionality is being replaced by the interesttarget attribute. Bug: 326681249 Change-Id: Idb635e474d27588c937e3468d39b37806ff7352a Fixed: 381444317 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6177202 Reviewed-by: David Baron Auto-Submit: Mason Freed Commit-Queue: Mason Freed Cr-Commit-Position: refs/heads/main@{#1409868} --- .../popover-css-properties.tentative.html | 54 ------ .../popover-hover-hang.tentative.html | 34 ---- .../popover-hover-hide-hide.tentative.html | 21 -- .../popover-hover-hide-hover.tentative.html | 21 -- .../popover-hover-hide-show.tentative.html | 21 -- .../popover-hover-hide-toggle.tentative.html | 21 -- ...popover-target-action-hover.tentative.html | 180 ------------------ .../resources/popover-hover-hide-common.js | 139 -------------- 8 files changed, 491 deletions(-) delete mode 100644 html/semantics/popovers/popover-css-properties.tentative.html delete mode 100644 html/semantics/popovers/popover-hover-hang.tentative.html delete mode 100644 html/semantics/popovers/popover-hover-hide-hide.tentative.html delete mode 100644 html/semantics/popovers/popover-hover-hide-hover.tentative.html delete mode 100644 html/semantics/popovers/popover-hover-hide-show.tentative.html delete mode 100644 html/semantics/popovers/popover-hover-hide-toggle.tentative.html delete mode 100644 html/semantics/popovers/popover-target-action-hover.tentative.html delete mode 100644 html/semantics/popovers/resources/popover-hover-hide-common.js diff --git a/html/semantics/popovers/popover-css-properties.tentative.html b/html/semantics/popovers/popover-css-properties.tentative.html deleted file mode 100644 index 93d388b02b533f..00000000000000 --- a/html/semantics/popovers/popover-css-properties.tentative.html +++ /dev/null @@ -1,54 +0,0 @@ - - -Popover API CSS parsing with computed values - - - - - - - - -
-
- - diff --git a/html/semantics/popovers/popover-hover-hang.tentative.html b/html/semantics/popovers/popover-hover-hang.tentative.html deleted file mode 100644 index 7868fa71a55b2e..00000000000000 --- a/html/semantics/popovers/popover-hover-hang.tentative.html +++ /dev/null @@ -1,34 +0,0 @@ - - -Crash/hang test for popover hover behavior - - - - - - - - - - - - - diff --git a/html/semantics/popovers/popover-hover-hide-hide.tentative.html b/html/semantics/popovers/popover-hover-hide-hide.tentative.html deleted file mode 100644 index 57ca5723de562c..00000000000000 --- a/html/semantics/popovers/popover-hover-hide-hide.tentative.html +++ /dev/null @@ -1,21 +0,0 @@ - - -The popover-hide-delay CSS property - - - - - - - - - - - - - diff --git a/html/semantics/popovers/popover-hover-hide-hover.tentative.html b/html/semantics/popovers/popover-hover-hide-hover.tentative.html deleted file mode 100644 index d0036c0fe7b14b..00000000000000 --- a/html/semantics/popovers/popover-hover-hide-hover.tentative.html +++ /dev/null @@ -1,21 +0,0 @@ - - -The popover-hide-delay CSS property - - - - - - - - - - - - - diff --git a/html/semantics/popovers/popover-hover-hide-show.tentative.html b/html/semantics/popovers/popover-hover-hide-show.tentative.html deleted file mode 100644 index 7b3fa2b30238df..00000000000000 --- a/html/semantics/popovers/popover-hover-hide-show.tentative.html +++ /dev/null @@ -1,21 +0,0 @@ - - -The popover-hide-delay CSS property - - - - - - - - - - - - - diff --git a/html/semantics/popovers/popover-hover-hide-toggle.tentative.html b/html/semantics/popovers/popover-hover-hide-toggle.tentative.html deleted file mode 100644 index d6d4079e7e02be..00000000000000 --- a/html/semantics/popovers/popover-hover-hide-toggle.tentative.html +++ /dev/null @@ -1,21 +0,0 @@ - - -The popover-hide-delay CSS property - - - - - - - - - - - - - diff --git a/html/semantics/popovers/popover-target-action-hover.tentative.html b/html/semantics/popovers/popover-target-action-hover.tentative.html deleted file mode 100644 index b03ec78ebf12e4..00000000000000 --- a/html/semantics/popovers/popover-target-action-hover.tentative.html +++ /dev/null @@ -1,180 +0,0 @@ - - -The popovertargetaction=hover behavior - - - - - - - - - - - - - - diff --git a/html/semantics/popovers/resources/popover-hover-hide-common.js b/html/semantics/popovers/resources/popover-hover-hide-common.js deleted file mode 100644 index 9f407ef157d8a4..00000000000000 --- a/html/semantics/popovers/resources/popover-hover-hide-common.js +++ /dev/null @@ -1,139 +0,0 @@ -// NOTE about testing methodology: -// This test checks whether popovers are hidden *after* the appropriate de-hover -// delay. The delay used for testing is kept low, to avoid this test taking too -// long, but that means that sometimes on a slow bot/client, the delay can -// elapse before we are able to check the popover status. And that can make this -// test flaky. To avoid that, the msSinceMouseOver() function is used to check -// that not-too-much time has passed, and if it has, the test is simply skipped. - -const hoverDelays = 100; // This needs to match the style block below. -const hoverWaitTime = 200; // How long to wait to cover the delay for sure. - -async function initialPopoverShow(invoker) { - const popover = invoker.popoverTargetElement; - assert_false(popover.matches(':popover-open')); - await mouseOver(invoker); // Always start with the mouse over the invoker - popover.showPopover(); - assert_true(popover.matches(':popover-open')); -} - -function runHoverHideTest(popoverType, invokerType, invokerAction) { - const descr = `popover=${popoverType}, invoker=${invokerType}, popovertargetaction=${invokerAction}`; - promise_test(async (t) => { - const {popover,invoker} = makeTestParts(t, popoverType, invokerType, invokerAction); - await initialPopoverShow(invoker); - await mouseOver(unrelated); - let showing = popover.matches(':popover-open'); - if (msSinceMouseOver() >= hoverDelays) - return; // The WPT runner was too slow. - assert_true(showing,'popover shouldn\'t immediately hide'); - await mouseHover(unrelated,hoverWaitTime); - assert_false(popover.matches(':popover-open'),'popover should hide after delay'); - },`The popover-hide-delay causes a popover to be hidden after a delay, ${descr}`); - - promise_test(async (t) => { - const {popover,invoker} = makeTestParts(t, popoverType, invokerType, invokerAction); - await initialPopoverShow(invoker); - await mouseHover(popover,hoverWaitTime); - assert_true(popover.matches(':popover-open'),'hovering the popover should keep it showing'); - await mouseOver(unrelated); - let showing = popover.matches(':popover-open'); - if (msSinceMouseOver() >= hoverDelays) - return; // The WPT runner was too slow. - assert_true(showing,'subsequently hovering unrelated element shouldn\'t immediately hide the popover'); - await mouseHover(unrelated,hoverWaitTime); - assert_false(popover.matches(':popover-open'),'hovering unrelated element should hide popover after delay'); - },`hovering the popover keeps it from being hidden, ${descr}`); - - promise_test(async (t) => { - const {popover,invoker,mouseOverInvoker} = makeTestParts(t, popoverType, invokerType, invokerAction); - await initialPopoverShow(invoker); - assert_true(popover.matches(':popover-open')); - await mouseHover(popover,hoverWaitTime); - await mouseHover(mouseOverInvoker,hoverWaitTime); - assert_true(popover.matches(':popover-open'),'Moving hover between invoker and popover should keep popover from being hidden'); - await mouseHover(unrelated,hoverWaitTime); - assert_false(popover.matches(':popover-open'),'Moving hover to unrelated should finally hide the popover'); - },`hovering an invoking element keeps the popover from being hidden, ${descr}`); -} - -function runHoverHideTestsForInvokerAction(invokerAction) { - promise_test(async (t) => { - const {popover,invoker} = makeTestParts(t, 'auto', 'button', 'show'); - assert_false(popover.matches(':popover-open')); - assert_true(invoker.matches('[popovertarget]'),'invoker needs to match [popovertarget]'); - assert_equals(invoker.popoverTargetElement,popover,'invoker should point to popover'); - await mouseHover(invoker,hoverWaitTime); - assert_true(msSinceMouseOver() >= hoverWaitTime,'waitForHoverTime should wait the specified time'); - assert_true(hoverWaitTime > hoverDelays,'hoverDelays is the value from CSS, hoverWaitTime should be longer than that'); - assert_equals(getComputedStyleTimeMs(invoker,'popoverShowDelay'),hoverDelays,'popover-show-delay is incorrect'); - assert_equals(getComputedStyleTimeMs(popover,'popoverHideDelay'),hoverDelays,'popover-hide-delay is incorrect'); - },'Test the harness'); - - // Run for all invoker and popover types. - ["button","input"].forEach(invokerType => { - ["auto","hint","manual"].forEach(popoverType => { - runHoverHideTest(popoverType, invokerType, invokerAction); - }); - }); -} - -// Setup stuff -const unrelated = document.createElement('div'); -unrelated.id = 'unrelated'; -unrelated.textContent = 'Unrelated element'; -const style = document.createElement('style'); -document.body.append(unrelated,style); -style.textContent = ` - div, button, input { - /* Fixed position everything to ensure nothing overlaps */ - position: fixed; - max-height: 100px; - } - #unrelated {top: 100px;} - [popovertarget] { - top:200px; - popover-show-delay: 100ms; - } - [popover] { - width: 200px; - height: 100px; - top:300px; - popover-hide-delay: 100ms; - } -`; - -function makeTestParts(t,popoverType,invokerType,invokerAction) { - const popover = document.createElement('div'); - popover.id = `popover-${popoverType}-${invokerType}-${invokerAction}`; - document.body.appendChild(popover); - popover.popover = popoverType; - assert_equals(popover.popover, popoverType, `Type ${popoverType} not supported`); - const invoker = document.createElement(invokerType); - document.body.appendChild(invoker); - invoker.popoverTargetElement = popover; - invoker.popoverTargetAction = invokerAction; - assert_equals(invoker.popoverTargetAction, invokerAction, `Invoker action ${invokerAction} not supported`); - let mouseOverInvoker; - switch (invokerType) { - case 'button': - invoker.innerHTML = 'Click me'; - mouseOverInvoker = invoker.firstElementChild.firstElementChild; - assert_true(!!mouseOverInvoker); - break; - case 'input': - invoker.type = 'button'; - mouseOverInvoker = invoker; - break; - default: - assert_unreached('Invalid invokerType ' + invokerType); - break; - } - t.add_cleanup(() => {popover.remove(); invoker.remove();}); - return {popover, invoker, mouseOverInvoker}; -} - -function getComputedStyleTimeMs(element,property) { - // Times are in seconds, so just strip off the 's'. - return Number(getComputedStyle(element)[property].slice(0,-1))*1000; -}