tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 77092b1d35aa0aa003f995b6a13343d6c269dea3
parent 3c16f8fc13a78ad17f79c2afca29520428279988
Author: Narcis Beleuzu <nbeleuzu@mozilla.com>
Date:   Wed,  1 Oct 2025 16:01:24 +0300

Revert "Bug 1991410 - Don't apply intersection root rect clip to targets inside popups. r=tnikkel,layout-reviewers" for causing failures on /test_largemenu.html

This reverts commit a2b278de91f9848c696aca42ba8adbed6c832aeb.

Diffstat:
Mdom/base/DOMIntersectionObserver.cpp | 7+++----
Mtoolkit/content/tests/chrome/window_largemenu.xhtml | 32+-------------------------------
2 files changed, 4 insertions(+), 35 deletions(-)

diff --git a/dom/base/DOMIntersectionObserver.cpp b/dom/base/DOMIntersectionObserver.cpp @@ -556,10 +556,9 @@ static Maybe<nsRect> ComputeTheIntersection( intersectionRect = intersectionRectRelativeToRoot.EdgeInclusiveIntersection( *aRemoteDocumentVisibleRect); - } else if (aTarget->HasAnyStateBits(NS_FRAME_IN_POPUP)) { - // Popups don't get clipped to the viewport, so avoid applying the root - // intersection rect, see bug 1991410. - intersectionRect = Some(intersectionRectRelativeToRoot); + if (intersectionRect.isNothing()) { + return Nothing(); + } } else { intersectionRect = intersectionRectRelativeToRoot.EdgeInclusiveIntersection(aRootBounds); diff --git a/toolkit/content/tests/chrome/window_largemenu.xhtml b/toolkit/content/tests/chrome/window_largemenu.xhtml @@ -93,41 +93,13 @@ async function nextTest() popup.openPopupAtScreen(100, y, false); } -async function assertItemsOcclusionState(popup) { - info("Checking intersection state"); - - let scrollbox = popup.scrollBox.scrollbox; - let scrollBoxRect = scrollbox.getBoundingClientRect(); - let borderTop = parseFloat(getComputedStyle(scrollbox).borderTop); - let borderBottom = parseFloat(getComputedStyle(scrollbox).borderBottom); - - let items = popup.querySelectorAll("menuitem"); - isnot(items.length, 0, "Should have items"); - let {promise, resolve} = Promise.withResolvers(); - let io = new IntersectionObserver(function(entries) { - resolve(entries) - }); - for (let item of items) { - io.observe(item); - } - let entries = await promise; - io.disconnect(); - is(entries.length, items.length, "Should have an entry per element"); - for (let entry of entries) { - let itemRect = entry.boundingClientRect; - // Importantly, we don't consider the page's viewport. - let shouldIntersect = itemRect.bottom >= scrollBoxRect.top + borderTop && itemRect.top <= scrollBoxRect.bottom - borderBottom; - is(entry.isIntersecting, shouldIntersect, `${entry.target.outerHTML} intersection state matches`); - } -} - async function popupShown() { // This is needed for overflow events to run. await nextFrame(); startTest(); } -async function startTest() +function startTest() { if (gTests[gTestIndex] == "menu movement") return testPopupMovement(); @@ -142,8 +114,6 @@ async function startTest() var scrollbox = popup.scrollBox.scrollbox; var expectedScrollPos = 0; - await assertItemsOcclusionState(popup); - info(`${gTests[gTestIndex]}: ${JSON.stringify(rect)} | ${screen.width}x${screen.height} | ${gScreenY}`); if (gTestIndex == 0) { // the popup should be in the center of the screen