diff --git a/accessible/base/nsAccessibilityService.cpp b/accessible/base/nsAccessibilityService.cpp index 01df68bdd3be..6e105931d99c 100644 --- a/accessible/base/nsAccessibilityService.cpp +++ b/accessible/base/nsAccessibilityService.cpp @@ -75,7 +75,6 @@ #include "mozilla/Services.h" #include "mozilla/StaticPrefs_accessibility.h" #include "mozilla/SVGGeometryFrame.h" -#include "nsDeckFrame.h" #include "XULAlertAccessible.h" #include "XULComboboxAccessible.h" @@ -443,62 +442,19 @@ LocalAccessible* nsAccessibilityService::GetRootDocumentAccessible( return nullptr; } -void nsAccessibilityService::DeckPanelSwitched(PresShell* aPresShell, - nsIContent* aDeckNode, - nsIFrame* aPrevBoxFrame, - nsIFrame* aCurrentBoxFrame) { +void nsAccessibilityService::NotifyOfTabPanelVisibilityChange( + PresShell* aPresShell, Element* aPanel, bool aNowVisible) { + MOZ_ASSERT(aPanel->GetParent()->IsXULElement(nsGkAtoms::tabpanels)); + DocAccessible* document = GetDocAccessible(aPresShell); if (!document) { return; } - // A deck with a LocalAccessible is a tabpanels element. - const bool isTabPanels = document->HasAccessible(aDeckNode); - MOZ_ASSERT(!isTabPanels || aDeckNode->IsXULElement(nsGkAtoms::tabpanels), - "A deck with a LocalAccessible should be a tabpanels element"); - if (aPrevBoxFrame) { - nsIContent* panelNode = aPrevBoxFrame->GetContent(); -#ifdef A11Y_LOG - if (logging::IsEnabled(logging::eTree)) { - logging::MsgBegin("TREE", "deck panel unselected"); - logging::Node("container", panelNode); - logging::Node("content", aDeckNode); - logging::MsgEnd(); - } -#endif - if (isTabPanels) { - // Tabpanels are accessible even when not selected. - if (LocalAccessible* acc = document->GetAccessible(panelNode)) { - RefPtr event = - new AccStateChangeEvent(acc, states::OFFSCREEN, true); - document->FireDelayedEvent(event); - } - } else { - document->ContentRemoved(panelNode); - } - } - - if (aCurrentBoxFrame) { - nsIContent* panelNode = aCurrentBoxFrame->GetContent(); -#ifdef A11Y_LOG - if (logging::IsEnabled(logging::eTree)) { - logging::MsgBegin("TREE", "deck panel selected"); - logging::Node("container", panelNode); - logging::Node("content", aDeckNode); - logging::MsgEnd(); - } -#endif - if (isTabPanels) { - // Tabpanels are accessible even when not selected, so we don't have to - // insert a LocalAccessible. - if (LocalAccessible* acc = document->GetAccessible(panelNode)) { - RefPtr event = - new AccStateChangeEvent(acc, states::OFFSCREEN, false); - document->FireDelayedEvent(event); - } - } else { - document->ContentInserted(panelNode, panelNode->GetNextSibling()); - } + if (LocalAccessible* acc = document->GetAccessible(aPanel)) { + RefPtr event = + new AccStateChangeEvent(acc, states::OFFSCREEN, aNowVisible); + document->FireDelayedEvent(event); } } @@ -1128,16 +1084,6 @@ LocalAccessible* nsAccessibilityService::CreateAccessible( // XUL accessibles. if (!newAcc && content->IsXULElement()) { - // No accessible for not selected deck panel and its children. - if (!aContext->IsXULTabpanels()) { - nsDeckFrame* deckFrame = do_QueryFrame(frame->GetParent()); - if (deckFrame && deckFrame->GetSelectedBox() != frame) { - if (aIsSubtreeHidden) *aIsSubtreeHidden = true; - - return nullptr; - } - } - if (content->IsXULElement(nsGkAtoms::panel)) { // We filter here instead of in the XUL map because // if we filter there and return null, we still end up diff --git a/accessible/base/nsAccessibilityService.h b/accessible/base/nsAccessibilityService.h index 979146b07030..de6739408b39 100644 --- a/accessible/base/nsAccessibilityService.h +++ b/accessible/base/nsAccessibilityService.h @@ -153,13 +153,6 @@ class nsAccessibilityService final : public mozilla::a11y::DocManager, void GetStringRelationType(uint32_t aRelationType, nsAString& aString); // nsAccesibilityService - /** - * Notification used to update the accessible tree when deck panel is - * switched. - */ - void DeckPanelSwitched(mozilla::PresShell* aPresShell, nsIContent* aDeckNode, - nsIFrame* aPrevBoxFrame, nsIFrame* aCurrentBoxFrame); - /** * Notification used to update the accessible tree when new content is * inserted. @@ -240,6 +233,10 @@ class nsAccessibilityService final : public mozilla::a11y::DocManager, void NotifyOfComputedStyleChange(mozilla::PresShell* aPresShell, nsIContent* aContent); + void NotifyOfTabPanelVisibilityChange(mozilla::PresShell* aPresShell, + mozilla::dom::Element* aPanel, + bool aVisible); + void NotifyOfResolutionChange(mozilla::PresShell* aPresShell, float aResolution); diff --git a/accessible/generic/DocAccessible.cpp b/accessible/generic/DocAccessible.cpp index f93b926a59fc..5bd7b84173cb 100644 --- a/accessible/generic/DocAccessible.cpp +++ b/accessible/generic/DocAccessible.cpp @@ -14,7 +14,6 @@ #include "nsAccCache.h" #include "nsAccessiblePivot.h" #include "nsAccUtils.h" -#include "nsDeckFrame.h" #include "nsEventShell.h" #include "nsLayoutUtils.h" #include "nsTextEquivUtils.h" @@ -1052,21 +1051,6 @@ LocalAccessible* DocAccessible::GetAccessibleOrContainer( return nullptr; } - // Check if node is in an unselected deck panel - if (aNoContainerIfPruned && currNode->IsXULElement()) { - if (nsIFrame* frame = currNode->AsContent()->GetPrimaryFrame()) { - nsDeckFrame* deckFrame = do_QueryFrame(frame->GetParent()); - if (deckFrame && deckFrame->GetSelectedBox() != frame) { - // If deck is not a , return null - nsIContent* parentFrameContent = deckFrame->GetContent(); - if (!parentFrameContent || - !parentFrameContent->IsXULElement(nsGkAtoms::tabpanels)) { - return nullptr; - } - } - } - } - // Check if node is in zero-sized map if (aNoContainerIfPruned && currNode->IsHTMLElement(nsGkAtoms::map)) { if (nsIFrame* frame = currNode->AsContent()->GetPrimaryFrame()) { diff --git a/accessible/generic/LocalAccessible.cpp b/accessible/generic/LocalAccessible.cpp index 4e0150c76ce7..bf3d7ebda052 100644 --- a/accessible/generic/LocalAccessible.cpp +++ b/accessible/generic/LocalAccessible.cpp @@ -50,7 +50,6 @@ #include "nsIContent.h" #include "nsIFormControl.h" -#include "nsDeckFrame.h" #include "nsLayoutUtils.h" #include "nsPresContext.h" #include "nsIFrame.h" @@ -70,6 +69,7 @@ #include "nsArrayUtils.h" #include "nsWhitespaceTokenizer.h" #include "nsAttrName.h" +#include "nsContainerFrame.h" #include "mozilla/Assertions.h" #include "mozilla/BasicEvents.h" @@ -324,22 +324,16 @@ uint64_t LocalAccessible::VisibilityState() const { return states::INVISIBLE; } - if (nsLayoutUtils::IsPopup(curFrame)) return 0; - - // Offscreen state for background tab content and invisible for not selected - // deck panel. - nsIFrame* parentFrame = curFrame->GetParent(); - nsDeckFrame* deckFrame = do_QueryFrame(parentFrame); - if (deckFrame && deckFrame->GetSelectedBox() != curFrame) { - if (deckFrame->GetContent()->IsXULElement(nsGkAtoms::tabpanels)) { - return states::OFFSCREEN; - } - - MOZ_ASSERT_UNREACHABLE( - "Children of not selected deck panel are not accessible."); - return states::INVISIBLE; + if (nsLayoutUtils::IsPopup(curFrame)) { + return 0; } + if (curFrame->StyleUIReset()->mMozSubtreeHiddenOnlyVisually) { + // Offscreen state for background tab content. + return states::OFFSCREEN; + } + + nsIFrame* parentFrame = curFrame->GetParent(); // If contained by scrollable frame then check that at least 12 pixels // around the object is visible, otherwise the object is offscreen. nsIScrollableFrame* scrollableFrame = do_QueryFrame(parentFrame); diff --git a/accessible/mac/mozActionElements.mm b/accessible/mac/mozActionElements.mm index 927cd4b8a0d2..46ca8dab8159 100644 --- a/accessible/mac/mozActionElements.mm +++ b/accessible/mac/mozActionElements.mm @@ -13,7 +13,6 @@ #include "XULTabAccessible.h" #include "HTMLFormControlAccessible.h" -#include "nsDeckFrame.h" #include "nsObjCExceptions.h" using namespace mozilla::a11y; @@ -126,26 +125,17 @@ enum CheckboxValue { @implementation mozPaneAccessible - (NSArray*)moxChildren { - if (!mGeckoAccessible->AsLocal()) return nil; - - nsDeckFrame* deckFrame = - do_QueryFrame(mGeckoAccessible->AsLocal()->GetFrame()); - nsIFrame* selectedFrame = deckFrame ? deckFrame->GetSelectedBox() : nullptr; - - LocalAccessible* selectedAcc = nullptr; - if (selectedFrame) { - nsINode* node = selectedFrame->GetContent(); - selectedAcc = mGeckoAccessible->AsLocal()->Document()->GetAccessible(node); + // By default, all tab panels are exposed in the a11y tree + // even if the tab they represent isn't the active tab. To + // prevent VoiceOver from navigating background tab content, + // only expose the tab panel that is currently on screen. + for (mozAccessible* child in [super moxChildren]) { + if (!([child state] & states::OFFSCREEN)) { + return [NSArray arrayWithObject:GetObjectOrRepresentedView(child)]; + } } - - if (selectedAcc) { - mozAccessible* curNative = GetNativeFromGeckoAccessible(selectedAcc); - if (curNative) - return - [NSArray arrayWithObjects:GetObjectOrRepresentedView(curNative), nil]; - } - - return nil; + MOZ_ASSERT_UNREACHABLE("We have no on screen tab content?"); + return @[]; } @end diff --git a/accessible/tests/mochitest/attributes/test_obj_css.xhtml b/accessible/tests/mochitest/attributes/test_obj_css.xhtml index df9afceba035..fe93dbaebe8d 100644 --- a/accessible/tests/mochitest/attributes/test_obj_css.xhtml +++ b/accessible/tests/mochitest/attributes/test_obj_css.xhtml @@ -22,7 +22,6 @@ // CSS display testCSSAttrs("display_mozbox"); testCSSAttrs("display_mozinlinebox"); - testCSSAttrs("display_mozdeck"); testCSSAttrs("display_mozpopup"); SimpleTest.finish(); @@ -50,7 +49,6 @@ - diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index c58f2f1b7f82..a88d46e1f231 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -2171,23 +2171,23 @@ var gBrowserInit = { return; } - if (gBrowser.selectedBrowser.isRemoteBrowser) { - // If the initial browser is remote, in order to optimize for first paint, - // we'll defer switching focus to that browser until it has painted. - this._firstContentWindowPaintDeferred.promise.then(() => { - // If focus didn't move while we were waiting for first paint, we're okay - // to move to the browser. - if ( - document.commandDispatcher.focusedElement == initiallyFocusedElement - ) { - gBrowser.selectedBrowser.focus(); - } - }); - } else { - // If the initial browser is not remote, we can focus the browser - // immediately with no paint performance impact. - gBrowser.selectedBrowser.focus(); - } + // If the initial browser is remote, in order to optimize for first paint, + // we'll defer switching focus to that browser until it has painted. + // Otherwise use a regular promise to guarantee that mutationobserver + // microtasks that could affect focusability have run. + let promise = gBrowser.selectedBrowser.isRemoteBrowser + ? this._firstContentWindowPaintDeferred.promise + : Promise.resolve(); + + promise.then(() => { + // If focus didn't move while we were waiting, we're okay to move to + // the browser. + if ( + document.commandDispatcher.focusedElement == initiallyFocusedElement + ) { + gBrowser.selectedBrowser.focus(); + } + }); }); // Delay removing the attribute using requestAnimationFrame to avoid diff --git a/browser/base/content/test/general/browser_bug495058.js b/browser/base/content/test/general/browser_bug495058.js index 6bb1d4a7b2b2..661d18798ae4 100644 --- a/browser/base/content/test/general/browser_bug495058.js +++ b/browser/base/content/test/general/browser_bug495058.js @@ -47,7 +47,7 @@ add_task(async function() { Assert.equal( win.document.activeElement, expectedActiveElement, - uri + ": the active element is expected" + `${uri}: the active element is expected: ${win.document.activeElement?.nodeName}` ); Assert.equal(win.gURLBar.value, "", uri + ": urlbar is empty"); Assert.ok(win.gURLBar.placeholder, uri + ": placeholder text is present"); diff --git a/browser/components/customizableui/test/browser_synced_tabs_menu.js b/browser/components/customizableui/test/browser_synced_tabs_menu.js index a76762e13ce7..6075a792ddfd 100644 --- a/browser/components/customizableui/test/browser_synced_tabs_menu.js +++ b/browser/components/customizableui/test/browser_synced_tabs_menu.js @@ -254,11 +254,7 @@ add_task(async function() { // The widget is still fetching tabs, as we've neutered everything that // provides them - is( - deck.selectedIndex, - "" + DECKINDEX_FETCHING, - "first deck entry is visible" - ); + is(deck.selectedIndex, DECKINDEX_FETCHING, "first deck entry is visible"); // Tell the widget there are tabs available, but with zero clients. mockedInternal.getTabClients = () => { @@ -269,7 +265,7 @@ add_task(async function() { // The UI should be showing the "no clients" pane. is( deck.selectedIndex, - "" + DECKINDEX_NOCLIENTS, + DECKINDEX_NOCLIENTS, "no-clients deck entry is visible" ); @@ -320,11 +316,7 @@ add_task(async function() { await updateTabsPanel(); // The UI should be showing tabs! - is( - deck.selectedIndex, - "" + DECKINDEX_TABS, - "no-clients deck entry is visible" - ); + is(deck.selectedIndex, DECKINDEX_TABS, "no-clients deck entry is visible"); let tabList = document.getElementById("PanelUI-remotetabs-tabslist"); let node = tabList.firstElementChild; // First entry should be the client with the most-recent tab. @@ -467,7 +459,7 @@ add_task(async function() { let subpanel = document.getElementById("PanelUI-remotetabs-main"); ok(!subpanel.hidden, "main pane is visible"); let deck = document.getElementById("PanelUI-remotetabs-deck"); - is(deck.selectedIndex, "" + DECKINDEX_TABS, "we should be showing tabs"); + is(deck.selectedIndex, DECKINDEX_TABS, "we should be showing tabs"); function checkTabsPage(tabsShownCount, showMoreLabel) { let tabList = document.getElementById("PanelUI-remotetabs-tabslist"); diff --git a/browser/components/preferences/tests/browser_search_within_preferences_2.js b/browser/components/preferences/tests/browser_search_within_preferences_2.js index 25afe53c26ca..9fd9fbf5c76f 100644 --- a/browser/components/preferences/tests/browser_search_within_preferences_2.js +++ b/browser/components/preferences/tests/browser_search_within_preferences_2.js @@ -25,7 +25,7 @@ add_task(async function() { ); is( weavePrefsDeck.selectedIndex, - "0", + 0, "Should select the #noFxaAccount child node" ); diff --git a/browser/components/translation/test/browser_translation_infobar.js b/browser/components/translation/test/browser_translation_infobar.js index 740f53e21b52..feef5c78c61a 100644 --- a/browser/components/translation/test/browser_translation_infobar.js +++ b/browser/components/translation/test/browser_translation_infobar.js @@ -103,7 +103,7 @@ add_task(async function test_infobar() { let notif = showTranslationUI("fr"); is( notif.state, - "" + Translation.STATE_OFFER, + Translation.STATE_OFFER, "the infobar is offering translation" ); is( @@ -117,7 +117,7 @@ add_task(async function test_infobar() { notif._getAnonElt("translate").click(); is( notif.state, - "" + Translation.STATE_TRANSLATING, + Translation.STATE_TRANSLATING, "the infobar is in the translating state" ); ok( @@ -134,14 +134,14 @@ add_task(async function test_infobar() { info("Make the translation fail and check we are in the error state."); notif.translation.failTranslation(); - is(notif.state, "" + Translation.STATE_ERROR, "infobar in the error state"); + is(notif.state, Translation.STATE_ERROR, "infobar in the error state"); checkURLBarIcon(); info("Click the try again button"); notif._getAnonElt("tryAgain").click(); is( notif.state, - "" + Translation.STATE_TRANSLATING, + Translation.STATE_TRANSLATING, "infobar in the translating state" ); ok( @@ -162,7 +162,7 @@ add_task(async function test_infobar() { notif.translation.finishTranslation(); is( notif.state, - "" + Translation.STATE_TRANSLATED, + Translation.STATE_TRANSLATED, "infobar in the translated state" ); checkURLBarIcon(true); @@ -207,7 +207,7 @@ add_task(async function test_infobar() { from.doCommand(); is( notif.state, - "" + Translation.STATE_TRANSLATING, + Translation.STATE_TRANSLATING, "infobar in the translating state" ); ok( @@ -232,7 +232,7 @@ add_task(async function test_infobar() { to.doCommand(); is( notif.state, - "" + Translation.STATE_TRANSLATING, + Translation.STATE_TRANSLATING, "infobar in the translating state" ); ok( @@ -254,7 +254,7 @@ add_task(async function test_infobar() { notif = showTranslationUI("fr"); is( notif.state, - "" + Translation.STATE_OFFER, + Translation.STATE_OFFER, "the infobar is offering translation" ); is( @@ -267,7 +267,7 @@ add_task(async function test_infobar() { notif._getAnonElt("translate").click(); is( notif.state, - "" + Translation.STATE_TRANSLATING, + Translation.STATE_TRANSLATING, "the infobar is in the translating state" ); ok( @@ -332,7 +332,7 @@ add_task(async function test_infobar_using_page() { let notif = notificationBox.getNotificationWithValue("translation"); is( notif.state, - "" + Translation.STATE_OFFER, + Translation.STATE_OFFER, "the infobar is offering translation" ); is( diff --git a/browser/modules/AsyncTabSwitcher.jsm b/browser/modules/AsyncTabSwitcher.jsm index 640283f4d4f1..8c70d70ad7c9 100644 --- a/browser/modules/AsyncTabSwitcher.jsm +++ b/browser/modules/AsyncTabSwitcher.jsm @@ -468,7 +468,7 @@ class AsyncTabSwitcher { let index = Array.prototype.indexOf.call(tabpanels.children, showPanel); if (index != -1) { this.log(`Switch to tab ${index} - ${this.tinfo(showTab)}`); - tabpanels.setAttribute("selectedIndex", index); + tabpanels.updateSelectedIndex(index); if (showTab === this.requestedTab) { if (requestedTabState == this.STATE_LOADED) { // The new tab will be made visible in the next paint, record the expected diff --git a/browser/themes/osx/browser.css b/browser/themes/osx/browser.css index 2357b1170eb3..1b8d3b37b479 100644 --- a/browser/themes/osx/browser.css +++ b/browser/themes/osx/browser.css @@ -397,9 +397,11 @@ moz-input-box > menupopup .context-menu-add-engine > .menu-iconic-left { } #tabbrowser-tabs { + /* overriding tabbox.css */ -moz-box-align: stretch; margin-bottom: 0; position: static; + z-index: auto; } /* Bookmark drag and drop styles */ diff --git a/devtools/server/actors/animation-type-longhand.js b/devtools/server/actors/animation-type-longhand.js index e2d1cbb96f85..798b169be101 100644 --- a/devtools/server/actors/animation-type-longhand.js +++ b/devtools/server/actors/animation-type-longhand.js @@ -113,6 +113,7 @@ exports.ANIMATION_TYPE_FOR_LONGHANDS = [ "object-fit", "-moz-orient", "-moz-osx-font-smoothing", + "-moz-subtree-hidden-only-visually", "outline-style", "overflow-anchor", "overflow-block", diff --git a/layout/base/DisplayPortUtils.cpp b/layout/base/DisplayPortUtils.cpp index cb68d2a541ec..035fcc52d7bd 100644 --- a/layout/base/DisplayPortUtils.cpp +++ b/layout/base/DisplayPortUtils.cpp @@ -10,18 +10,14 @@ #include "Layers.h" #include "mozilla/dom/BrowserChild.h" #include "mozilla/dom/Document.h" -#include "mozilla/gfx/gfxVars.h" #include "mozilla/gfx/Point.h" -#include "mozilla/layers/APZCCallbackHelper.h" #include "mozilla/layers/APZPublicUtils.h" #include "mozilla/layers/CompositorBridgeChild.h" #include "mozilla/layers/LayersMessageUtils.h" #include "mozilla/layers/PAPZ.h" -#include "mozilla/layers/RepaintRequest.h" #include "mozilla/PresShell.h" #include "mozilla/StaticPrefs_layers.h" #include "mozilla/StaticPrefs_layout.h" -#include "nsDeckFrame.h" #include "nsIScrollableFrame.h" #include "nsLayoutUtils.h" #include "nsPlaceholderFrame.h" @@ -33,13 +29,9 @@ namespace mozilla { -using gfx::gfxVars; using gfx::IntSize; -using layers::APZCCallbackHelper; using layers::FrameMetrics; -using layers::LayerManager; -using layers::RepaintRequest; using layers::ScrollableLayerGuid; typedef ScrollableLayerGuid::ViewID ViewID; @@ -805,12 +797,11 @@ bool DisplayPortUtils::CalculateAndSetDisplayPortMargins( aRepaintMode); } -bool DisplayPortUtils::MaybeCreateDisplayPort(nsDisplayListBuilder* aBuilder, - nsIFrame* aScrollFrame, - RepaintMode aRepaintMode) { +bool DisplayPortUtils::MaybeCreateDisplayPort( + nsDisplayListBuilder* aBuilder, nsIFrame* aScrollFrame, + nsIScrollableFrame* aScrollFrameAsScrollable, RepaintMode aRepaintMode) { nsIContent* content = aScrollFrame->GetContent(); - nsIScrollableFrame* scrollableFrame = do_QueryFrame(aScrollFrame); - if (!content || !scrollableFrame) { + if (!content) { return false; } @@ -823,7 +814,7 @@ bool DisplayPortUtils::MaybeCreateDisplayPort(nsDisplayListBuilder* aBuilder, if (aBuilder->IsPaintingToWindow() && nsLayoutUtils::AsyncPanZoomEnabled(aScrollFrame) && !aBuilder->HaveScrollableDisplayPort() && - scrollableFrame->WantAsyncScroll()) { + aScrollFrameAsScrollable->WantAsyncScroll()) { // If we don't already have a displayport, calculate and set one. if (!haveDisplayPort) { // We only use the viewId for logging purposes, but create it @@ -835,7 +826,7 @@ bool DisplayPortUtils::MaybeCreateDisplayPort(nsDisplayListBuilder* aBuilder, sDisplayportLog, LogLevel::Debug, ("Setting DP on first-encountered scrollId=%" PRIu64 "\n", viewId)); - CalculateAndSetDisplayPortMargins(scrollableFrame, aRepaintMode); + CalculateAndSetDisplayPortMargins(aScrollFrameAsScrollable, aRepaintMode); #ifdef DEBUG haveDisplayPort = HasNonMinimalDisplayPort(content); MOZ_ASSERT(haveDisplayPort, @@ -884,10 +875,8 @@ bool DisplayPortUtils::MaybeCreateDisplayPortInFirstScrollFrameEncountered( aFrame->GetContent()->GetID() == nsGkAtoms::tabbrowser_arrowscrollbox) { return false; } - - nsIScrollableFrame* sf = do_QueryFrame(aFrame); - if (sf) { - if (MaybeCreateDisplayPort(aBuilder, aFrame, RepaintMode::Repaint)) { + if (nsIScrollableFrame* sf = do_QueryFrame(aFrame)) { + if (MaybeCreateDisplayPort(aBuilder, aFrame, sf, RepaintMode::Repaint)) { return true; } } @@ -901,28 +890,21 @@ bool DisplayPortUtils::MaybeCreateDisplayPortInFirstScrollFrameEncountered( if (aFrame->IsSubDocumentFrame()) { PresShell* presShell = static_cast(aFrame) ->GetSubdocumentPresShellForPainting(0); - nsIFrame* root = presShell ? presShell->GetRootFrame() : nullptr; - if (root) { + if (nsIFrame* root = presShell ? presShell->GetRootFrame() : nullptr) { if (MaybeCreateDisplayPortInFirstScrollFrameEncountered(root, aBuilder)) { return true; } } } - if (aFrame->IsDeckFrame()) { - // only descend the visible card of a decks - nsIFrame* child = static_cast(aFrame)->GetSelectedBox(); - if (child) { - return MaybeCreateDisplayPortInFirstScrollFrameEncountered(child, - aBuilder); - } + if (aFrame->StyleUIReset()->mMozSubtreeHiddenOnlyVisually) { + // Only descend the visible card of deck / tabpanels + return false; } - for (nsIFrame* child : aFrame->PrincipalChildList()) { if (MaybeCreateDisplayPortInFirstScrollFrameEncountered(child, aBuilder)) { return true; } } - return false; } diff --git a/layout/base/DisplayPortUtils.h b/layout/base/DisplayPortUtils.h index c37caed0fc6b..8d71e8629a38 100644 --- a/layout/base/DisplayPortUtils.h +++ b/layout/base/DisplayPortUtils.h @@ -278,9 +278,9 @@ class DisplayPortUtils { * Returns true if there is a displayport on an async scrollable scrollframe * after this call, either because one was just added or it already existed. */ - static bool MaybeCreateDisplayPort(nsDisplayListBuilder* aBuilder, - nsIFrame* aScrollFrame, - RepaintMode aRepaintMode); + static bool MaybeCreateDisplayPort( + nsDisplayListBuilder* aBuilder, nsIFrame* aScrollFrame, + nsIScrollableFrame* aScrollFrameAsScrollable, RepaintMode aRepaintMode); /** * Sets a zero margin display port on all proper ancestors of aFrame that diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 917151a613c5..ca46e9c94a62 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -3961,38 +3961,24 @@ void PresShell::ClearMouseCaptureOnView(nsView* aView) { } void PresShell::ClearMouseCapture() { - nsIContent* capturingContent = GetCapturingContent(); - if (!capturingContent) { - AllowMouseCapture(false); - return; - } - ReleaseCapturingContent(); AllowMouseCapture(false); } void PresShell::ClearMouseCapture(nsIFrame* aFrame) { - MOZ_ASSERT( - aFrame && aFrame->GetParent() && - aFrame->GetParent()->Type() == LayoutFrameType::Deck, - "This function should only be called with a child frame of "); + MOZ_ASSERT(aFrame); nsIContent* capturingContent = GetCapturingContent(); if (!capturingContent) { - AllowMouseCapture(false); return; } nsIFrame* capturingFrame = capturingContent->GetPrimaryFrame(); - if (!capturingFrame) { - ReleaseCapturingContent(); - AllowMouseCapture(false); - return; - } - - if (nsLayoutUtils::IsAncestorFrameCrossDocInProcess(aFrame, capturingFrame)) { - ReleaseCapturingContent(); - AllowMouseCapture(false); + const bool shouldClear = + !capturingFrame || + nsLayoutUtils::IsAncestorFrameCrossDocInProcess(aFrame, capturingFrame); + if (shouldClear) { + ClearMouseCapture(); } } diff --git a/layout/base/PresShell.h b/layout/base/PresShell.h index 0d6d7ca3f0de..6be0a4b69ef5 100644 --- a/layout/base/PresShell.h +++ b/layout/base/PresShell.h @@ -205,13 +205,22 @@ class PresShell final : public nsStubDocumentObserver, static void ClearMouseCaptureOnView(nsView* aView); - // If a frame in the subtree rooted at aFrame is capturing the mouse then - // clears that capture. - static void ClearMouseCapture(nsIFrame* aFrame); - // Clear the capture content if it exists in this process. static void ClearMouseCapture(); + // If a frame in the subtree rooted at aFrame is capturing the mouse then + // clears that capture. + // + // NOTE(emilio): This is needed only so that mouse events captured by a remote + // frame don't remain being captured by the frame while hidden, see + // dom/events/test/browser_mouse_enterleave_switch_tab.js, which is the only + // test that meaningfully exercises this code path. + // + // We could consider maybe removing this, since the capturing content gets + // reset on mouse/pointerdown? Or maybe exposing an API so that the front-end + // does this. + static void ClearMouseCapture(nsIFrame* aFrame); + #ifdef ACCESSIBILITY /** * Return the document accessible for this PresShell if there is one. diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index 82c860ae7eaf..7d8194191287 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -2624,7 +2624,7 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ServoPostTraversalFlags) // flags for kids. static ServoPostTraversalFlags SendA11yNotifications( nsPresContext* aPresContext, Element* aElement, - ComputedStyle* aOldComputedStyle, ComputedStyle* aNewComputedStyle, + const ComputedStyle& aOldStyle, const ComputedStyle& aNewStyle, ServoPostTraversalFlags aFlags) { using Flags = ServoPostTraversalFlags; MOZ_ASSERT(!(aFlags & Flags::SkipA11yNotifications) || @@ -2638,13 +2638,24 @@ static ServoPostTraversalFlags SendA11yNotifications( // enabled. Just skip everything. return Flags::Empty; } + + if (aNewStyle.StyleUIReset()->mMozSubtreeHiddenOnlyVisually != + aOldStyle.StyleUIReset()->mMozSubtreeHiddenOnlyVisually) { + if (aElement->GetParent() && + aElement->GetParent()->IsXULElement(nsGkAtoms::tabpanels)) { + accService->NotifyOfTabPanelVisibilityChange( + aPresContext->PresShell(), aElement, + aNewStyle.StyleUIReset()->mMozSubtreeHiddenOnlyVisually); + } + } + if (aFlags & Flags::SkipA11yNotifications) { - // Propogate the skipping flag to descendants. + // Propagate the skipping flag to descendants. return Flags::SkipA11yNotifications; } bool needsNotify = false; - bool isVisible = aNewComputedStyle->StyleVisibility()->IsVisible(); + bool isVisible = aNewStyle.StyleVisibility()->IsVisible(); if (aFlags & Flags::SendA11yNotificationsIfShown) { if (!isVisible) { // Propagate the sending-if-shown flag to descendants. @@ -2657,7 +2668,7 @@ static ServoPostTraversalFlags SendA11yNotifications( } else { // If we shouldn't skip in any case, we need to check whether our // own visibility has changed. - bool wasVisible = aOldComputedStyle->StyleVisibility()->IsVisible(); + bool wasVisible = aOldStyle.StyleVisibility()->IsVisible(); needsNotify = wasVisible != isVisible; } @@ -2887,9 +2898,9 @@ bool RestyleManager::ProcessPostTraversal(Element* aElement, AddLayerChangesForAnimation(styleFrame, primaryFrame, aElement, changeHint, aRestyleState.ChangeList()); - childrenFlags |= - SendA11yNotifications(mPresContext, aElement, oldOrDisplayContentsStyle, - upToDateStyle, aFlags); + childrenFlags |= SendA11yNotifications(mPresContext, aElement, + *oldOrDisplayContentsStyle, + *upToDateStyle, aFlags); } const bool traverseElementChildren = diff --git a/layout/base/crashtests/344300-2.html b/layout/base/crashtests/344300-2.html deleted file mode 100644 index bc447cf73946..000000000000 --- a/layout/base/crashtests/344300-2.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - diff --git a/layout/base/crashtests/373628.html b/layout/base/crashtests/373628.html index 8f195f83960a..d71cc2518bdc 100644 --- a/layout/base/crashtests/373628.html +++ b/layout/base/crashtests/373628.html @@ -58,16 +58,13 @@ window.location.reload(); mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m -mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m - -mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m -mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m +mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m @@ -366,7 +363,6 @@ window.location.reload(); -

@@ -405,7 +401,6 @@ window.location.reload();

-
@@ -656,7 +651,7 @@ window.location.reload();

    -mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m +mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m

mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m mm m diff --git a/layout/base/crashtests/570038-1.html b/layout/base/crashtests/570038-1.html deleted file mode 100644 index 93fd2b99363d..000000000000 --- a/layout/base/crashtests/570038-1.html +++ /dev/null @@ -1,4 +0,0 @@ - - -
M
- diff --git a/layout/base/crashtests/crashtests.list b/layout/base/crashtests/crashtests.list index 46e3b9f7eaaa..f4595fa978ef 100644 --- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -105,7 +105,6 @@ load 343540-1.html load 344057-1.xhtml load 344064-1.html load 344300-1.html -load 344300-2.html load chrome://reftest/content/crashtests/layout/base/crashtests/344340-1.xhtml load 347898-1.html load 348126-1.html @@ -316,7 +315,6 @@ load 543648-1.html load 560447-1.html load 564063-1.html load 569018-1.html -load chrome://reftest/content/crashtests/layout/base/crashtests/570038-1.html load chrome://reftest/content/crashtests/layout/base/crashtests/572003.xhtml load 572582-1.xhtml load 576649-1.html diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 7640057cf095..a11813d77f48 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -215,8 +215,6 @@ nsContainerFrame* NS_NewRootBoxFrame(PresShell* aPresShell, nsContainerFrame* NS_NewDocElementBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle); -nsIFrame* NS_NewDeckFrame(PresShell* aPresShell, ComputedStyle* aStyle); - nsIFrame* NS_NewLeafBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle); nsIFrame* NS_NewRangeFrame(PresShell* aPresShell, ComputedStyle* aStyle); @@ -4549,11 +4547,6 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay& aDisplay, FCDATA_DESIRED_PARENT_TYPE_TO_BITS(eTypeRuby)); return &data; } - case StyleDisplayInside::MozDeck: { - static constexpr FrameConstructionData data = - SIMPLE_XUL_FCDATA(NS_NewDeckFrame); - return &data; - } case StyleDisplayInside::MozPopup: { static constexpr FrameConstructionData data( NS_NewMenuPopupFrame, FCDATA_DISALLOW_OUT_OF_FLOW | FCDATA_IS_POPUP | diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 26e1e97ea48d..185f7ae72b7b 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -117,7 +117,6 @@ #include "nsCSSPseudoElements.h" #include "nsCSSRendering.h" #include "nsTHashMap.h" -#include "nsDeckFrame.h" #include "nsDisplayList.h" #include "nsFlexContainerFrame.h" #include "nsFontInflationData.h" diff --git a/layout/build/nsLayoutStatics.cpp b/layout/build/nsLayoutStatics.cpp index 3dfadc2cef7a..d3c7d5dc5972 100644 --- a/layout/build/nsLayoutStatics.cpp +++ b/layout/build/nsLayoutStatics.cpp @@ -35,7 +35,6 @@ #include "nsRepeatService.h" #include "nsFloatManager.h" #include "nsSprocketLayout.h" -#include "nsStackLayout.h" #include "nsTextControlFrame.h" #include "txMozillaXSLTProcessor.h" #include "nsTreeSanitizer.h" @@ -329,7 +328,6 @@ void nsLayoutStatics::Shutdown() { nsColorNames::ReleaseTable(); nsCSSProps::ReleaseTable(); nsRepeatService::Shutdown(); - nsStackLayout::Shutdown(); nsXULContentUtils::Finish(); nsXULPrototypeCache::ReleaseGlobals(); diff --git a/layout/forms/crashtests/378413-1.xhtml b/layout/forms/crashtests/378413-1.xhtml deleted file mode 100644 index c9ca6990a979..000000000000 --- a/layout/forms/crashtests/378413-1.xhtml +++ /dev/null @@ -1,16 +0,0 @@ - - - -
-
- Your name - -
-
- Your E-mail address - -
-
- - - diff --git a/layout/forms/crashtests/crashtests.list b/layout/forms/crashtests/crashtests.list index de89f67d3538..5a8d7529b249 100644 --- a/layout/forms/crashtests/crashtests.list +++ b/layout/forms/crashtests/crashtests.list @@ -20,7 +20,6 @@ load 370703-1.html load 370940-1.html load 370967.html load 378369.html -load 378413-1.xhtml load 380116-1.xhtml load 382610-1.html load 383887-1.html diff --git a/layout/generic/FrameClasses.py b/layout/generic/FrameClasses.py index b78732413c69..8b25e2b8094c 100644 --- a/layout/generic/FrameClasses.py +++ b/layout/generic/FrameClasses.py @@ -22,7 +22,6 @@ FRAME_CLASSES = [ Frame("nsComboboxDisplayFrame", "ComboboxDisplay", NOT_LEAF), Frame("nsContinuingTextFrame", "Text", LEAF), Frame("nsDateTimeControlFrame", "DateTimeControl", NOT_LEAF), - Frame("nsDeckFrame", "Deck", NOT_LEAF), Frame("nsDocElementBoxFrame", "DocElementBox", NOT_LEAF), Frame("nsFieldSetFrame", "FieldSet", NOT_LEAF), Frame("nsFileControlFrame", "Block", LEAF), diff --git a/layout/generic/crashtests/370866-1.xhtml b/layout/generic/crashtests/370866-1.xhtml deleted file mode 100644 index dbc673cc4c3a..000000000000 --- a/layout/generic/crashtests/370866-1.xhtml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - -
- X -
- - - - diff --git a/layout/generic/crashtests/381786-1.html b/layout/generic/crashtests/381786-1.html deleted file mode 100644 index fd2bc7dc998c..000000000000 --- a/layout/generic/crashtests/381786-1.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - -
-
- x -
-
- - y - -
-
- - - diff --git a/layout/generic/crashtests/862947-1.html b/layout/generic/crashtests/862947-1.html deleted file mode 100644 index 83e1903f43ca..000000000000 --- a/layout/generic/crashtests/862947-1.html +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - -
- - - diff --git a/layout/generic/crashtests/crashtests.list b/layout/generic/crashtests/crashtests.list index a32b95061c39..3720a0301b9f 100644 --- a/layout/generic/crashtests/crashtests.list +++ b/layout/generic/crashtests/crashtests.list @@ -87,7 +87,6 @@ load 370174-2.html load 370174-3.html load 370699-1.html load 370794-1.html -load 370866-1.xhtml load 370884-1.xhtml load 371348-1.xhtml load 371561-1.html @@ -104,7 +103,6 @@ load 379217-2.xhtml load 379917-1.xhtml load 380012-1.html load 381152-1.html -load 381786-1.html load 382129-1.xhtml load 382131-1.html load 382199-1.html @@ -536,7 +534,6 @@ asserts(8-46) load 850931.html # nested multicols, inner multicol has column-wid load 851396-1.html load 854263-1.html load 862185.html -load 862947-1.html load 863935.html load 866547-1.html needs-focus pref(accessibility.browsewithcaret,true) load 868906.html diff --git a/layout/generic/nsIFrame.cpp b/layout/generic/nsIFrame.cpp index 7e36f6e1ed9d..996573618378 100644 --- a/layout/generic/nsIFrame.cpp +++ b/layout/generic/nsIFrame.cpp @@ -100,7 +100,6 @@ #include "nsBlockFrame.h" #include "nsDisplayList.h" #include "nsChangeHint.h" -#include "nsDeckFrame.h" #include "nsSubDocumentFrame.h" #include "RetainedDisplayListBuilder.h" @@ -375,17 +374,19 @@ bool nsIFrame::IsVisibleConsideringAncestors(uint32_t aFlags) const { const nsIFrame* frame = this; while (frame) { nsView* view = frame->GetView(); - if (view && view->GetVisibility() == nsViewVisibility_kHide) return false; - - if (this != frame && frame->HidesContent()) return false; - - nsIFrame* parent = frame->GetParent(); - nsDeckFrame* deck = do_QueryFrame(parent); - if (deck) { - if (deck->GetSelectedBox() != frame) return false; + if (view && view->GetVisibility() == nsViewVisibility_kHide) { + return false; } - if (parent) { + if (frame->StyleUIReset()->mMozSubtreeHiddenOnlyVisually) { + return false; + } + + if (this != frame && frame->HidesContent()) { + return false; + } + + if (nsIFrame* parent = frame->GetParent()) { frame = parent; } else { parent = nsLayoutUtils::GetCrossDocParentFrameInProcess(frame); @@ -1286,6 +1287,10 @@ void nsIFrame::DidSetComputedStyle(ComputedStyle* aOldComputedStyle) { scrollableFrame->PostPendingResnap(); } } + if (StyleUIReset()->mMozSubtreeHiddenOnlyVisually && + !aOldComputedStyle->StyleUIReset()->mMozSubtreeHiddenOnlyVisually) { + PresShell::ClearMouseCapture(this); + } } else { // !aOldComputedStyle handleStickyChange = disp->mPosition == StylePositionProperty::Sticky; } @@ -3983,22 +3988,21 @@ static bool ShouldSkipFrame(nsDisplayListBuilder* aBuilder, if (aBuilder->IsBackgroundOnly()) { return true; } - if (aBuilder->IsForGenerateGlyphMask() && (!aFrame->IsTextFrame() && aFrame->IsLeaf())) { return true; } - // The placeholder frame should have the same content as the OOF frame. if (aBuilder->GetSelectedFramesOnly() && (aFrame->IsLeaf() && !aFrame->IsSelected())) { return true; } - static const nsFrameState skipFlags = (NS_FRAME_TOO_DEEP_IN_FRAME_TREE | NS_FRAME_IS_NONDISPLAY); - - return aFrame->HasAnyStateBits(skipFlags); + if (aFrame->HasAnyStateBits(skipFlags)) { + return true; + } + return aFrame->StyleUIReset()->mMozSubtreeHiddenOnlyVisually; } void nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder, diff --git a/layout/reftests/bugs/411367-3-ref.html b/layout/reftests/bugs/411367-3-ref.html deleted file mode 100644 index 4939afed6d9a..000000000000 --- a/layout/reftests/bugs/411367-3-ref.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - -
x
- - diff --git a/layout/reftests/bugs/411367-3.html b/layout/reftests/bugs/411367-3.html deleted file mode 100644 index 1a9332beeae7..000000000000 --- a/layout/reftests/bugs/411367-3.html +++ /dev/null @@ -1,8 +0,0 @@ - - - - - -
- - diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index ebec362840f1..e017ecc333c4 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -926,7 +926,6 @@ fuzzy-if(winWidget,0-123,0-1900) fuzzy-if(swgl,0-1,0-39) == 409659-1d.html 40965 == 410621-1.html 410621-1-ref.html == 411059-1.html 411059-1-ref.html fuzzy-if(winWidget,46-129,652-770) == 411334-1.xml 411334-1-ref.xml -== 411367-3.html 411367-3-ref.html == 411585-1.html 411585-1-ref.html == 411585-2.html 411585-2-ref.html fails == 411585-3.html 411585-3-ref.html # bug 426909 diff --git a/layout/reftests/text-decoration/reftest.list b/layout/reftests/text-decoration/reftest.list index 356d9f0fa8d6..f352f5db2ddc 100644 --- a/layout/reftests/text-decoration/reftest.list +++ b/layout/reftests/text-decoration/reftest.list @@ -113,7 +113,7 @@ fuzzy(0-4,0-2) == underline-select-1.html underline-select-1-ref.html == vertical-mode-decorations-1.html vertical-mode-decorations-1-ref.html fuzzy-if(Android,0-238,0-36) == vertical-mode-decorations-2.html vertical-mode-decorations-2-ref.html != 1415214.html 1415214-notref.html -HTTP(..) == skip-ink-multiline-position.html skip-ink-multiline-position-ref.html +fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) HTTP(..) == skip-ink-multiline-position.html skip-ink-multiline-position-ref.html # not reliable on Win7 (bug 1770273) == skip-ink-vertical-align.html skip-ink-vertical-align-ref.html != skip-ink-vertical-align-2.html skip-ink-vertical-align-2-notref.html fuzzy(0-94,0-4) == skip-ink-cjk-1.html skip-ink-cjk-1-ref.html diff --git a/layout/style/ServoBindings.toml b/layout/style/ServoBindings.toml index cd57fbd29c2c..259bbf2d7823 100644 --- a/layout/style/ServoBindings.toml +++ b/layout/style/ServoBindings.toml @@ -607,6 +607,7 @@ cbindgen-types = [ { gecko = "StyleFontStyle", servo = "crate::values::computed::font::FontStyle" }, { gecko = "StyleFontWeight", servo = "crate::values::computed::font::FontWeight" }, { gecko = "StyleFontStretch", servo = "crate::values::computed::font::FontStretch" }, + { gecko = "StyleBoolInteger", servo = "crate::values::computed::BoolInteger" }, ] mapped-generic-types = [ diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index e7c0301d9b2a..fc18dad6d6cd 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -91,8 +91,6 @@ enum class StyleDisplay : uint16_t { StyleDisplayFrom(StyleDisplayOutside::Block, StyleDisplayInside::MozBox), MozInlineBox = StyleDisplayFrom(StyleDisplayOutside::Inline, StyleDisplayInside::MozBox), - MozDeck = - StyleDisplayFrom(StyleDisplayOutside::XUL, StyleDisplayInside::MozDeck), MozPopup = StyleDisplayFrom(StyleDisplayOutside::XUL, StyleDisplayInside::MozPopup), }; diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index a8a67ebc831a..968c54f2d863 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -3213,7 +3213,8 @@ nsChangeHint nsStyleUI::CalcDifference(const nsStyleUI& aNewData) const { nsStyleUIReset::nsStyleUIReset(const Document& aDocument) : mUserSelect(StyleUserSelect::Auto), mScrollbarWidth(StyleScrollbarWidth::Auto), - mMozForceBrokenImageIcon(0), + mMozForceBrokenImageIcon(false), + mMozSubtreeHiddenOnlyVisually(false), mIMEMode(StyleImeMode::Auto), mWindowDragging(StyleWindowDragging::Default), mWindowShadow(StyleWindowShadow::Default), @@ -3250,6 +3251,7 @@ nsStyleUIReset::nsStyleUIReset(const nsStyleUIReset& aSource) : mUserSelect(aSource.mUserSelect), mScrollbarWidth(aSource.mScrollbarWidth), mMozForceBrokenImageIcon(aSource.mMozForceBrokenImageIcon), + mMozSubtreeHiddenOnlyVisually(aSource.mMozSubtreeHiddenOnlyVisually), mIMEMode(aSource.mIMEMode), mWindowDragging(aSource.mWindowDragging), mWindowShadow(aSource.mWindowShadow), @@ -3287,6 +3289,9 @@ nsChangeHint nsStyleUIReset::CalcDifference( if (mMozForceBrokenImageIcon != aNewData.mMozForceBrokenImageIcon) { hint |= nsChangeHint_ReconstructFrame; } + if (mMozSubtreeHiddenOnlyVisually != aNewData.mMozSubtreeHiddenOnlyVisually) { + hint |= nsChangeHint_RepaintFrame; + } if (mScrollbarWidth != aNewData.mScrollbarWidth) { // For scrollbar-width change, we need some special handling similar // to overflow properties. Specifically, we may need to reconstruct diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index e9b2f27b0d00..e6dcafbd98f0 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -1863,7 +1863,8 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset { return mAnimations[aIndex % mAnimationTimelineCount].GetTimeline(); } - uint8_t mMozForceBrokenImageIcon; // (0 if not forcing, otherwise forcing) + mozilla::StyleBoolInteger mMozForceBrokenImageIcon; + mozilla::StyleBoolInteger mMozSubtreeHiddenOnlyVisually; mozilla::StyleImeMode mIMEMode; mozilla::StyleWindowDragging mWindowDragging; mozilla::StyleWindowShadow mWindowShadow; diff --git a/layout/style/test/ListCSSProperties.cpp b/layout/style/test/ListCSSProperties.cpp index f0edbb3f3773..a9f46e6ac702 100644 --- a/layout/style/test/ListCSSProperties.cpp +++ b/layout/style/test/ListCSSProperties.cpp @@ -104,6 +104,7 @@ const char* gInaccessibleProperties[] = { "-moz-min-font-size-ratio", // parsed by UA sheets only "-moz-box-layout", // chrome-only internal properties "-moz-font-smoothing-background-color", // chrome-only internal properties + "-moz-subtree-hidden-only-visually", // chrome-only internal properties "-moz-window-input-region-margin", // chrome-only internal properties "-moz-window-opacity", // chrome-only internal properties "-moz-window-transform", // chrome-only internal properties diff --git a/layout/style/test/mochitest.ini b/layout/style/test/mochitest.ini index f81c2897423d..75cfbecc265e 100644 --- a/layout/style/test/mochitest.ini +++ b/layout/style/test/mochitest.ini @@ -134,8 +134,6 @@ skip-if = true # Bug 701060 [test_bug418986-2.html] [test_bug437915.html] [test_bug450191.html] -[test_bug453896_deck.html] -support-files = bug453896_iframe.html [test_bug470769.html] [test_bug499655.html] [test_bug499655.xhtml] diff --git a/layout/style/test/test_bug453896_deck.html b/layout/style/test/test_bug453896_deck.html deleted file mode 100644 index 0ecf6b459ff2..000000000000 --- a/layout/style/test/test_bug453896_deck.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - Test for Bug 453896 - - - - -Mozilla Bug 453896 -
- -
- - - -
- -
-
-
- - - diff --git a/layout/style/test/test_non_content_accessible_values.html b/layout/style/test/test_non_content_accessible_values.html index 106b49971507..c1f640be730c 100644 --- a/layout/style/test/test_non_content_accessible_values.html +++ b/layout/style/test/test_non_content_accessible_values.html @@ -19,7 +19,6 @@ const NON_CONTENT_ACCESSIBLE_VALUES = { "-moz-autofill-background", ], "display": [ - "-moz-deck", "-moz-popup", "-moz-box", "-moz-inline-box", diff --git a/layout/xul/crashtests/290743.html b/layout/xul/crashtests/290743.html deleted file mode 100644 index 95e679004317..000000000000 --- a/layout/xul/crashtests/290743.html +++ /dev/null @@ -1,6 +0,0 @@ - -Testcase bug 290743 - This display:-moz-deck testcase freezes Mozilla - - - - diff --git a/layout/xul/crashtests/311457-1.html b/layout/xul/crashtests/311457-1.html deleted file mode 100644 index e5b6ecdd63e6..000000000000 --- a/layout/xul/crashtests/311457-1.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - -
- -
Y
- - - \ No newline at end of file diff --git a/layout/xul/crashtests/374102-1.xhtml b/layout/xul/crashtests/374102-1.xhtml deleted file mode 100644 index 7e85f0d21cae..000000000000 --- a/layout/xul/crashtests/374102-1.xhtml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/layout/xul/crashtests/399013.xhtml b/layout/xul/crashtests/399013.xhtml deleted file mode 100644 index b2694460b6d3..000000000000 --- a/layout/xul/crashtests/399013.xhtml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/layout/xul/crashtests/crashtests.list b/layout/xul/crashtests/crashtests.list index 39b42794d8f4..04797e55040f 100644 --- a/layout/xul/crashtests/crashtests.list +++ b/layout/xul/crashtests/crashtests.list @@ -5,12 +5,10 @@ load chrome://reftest/content/crashtests/layout/xul/crashtests/151826-1.xhtml load chrome://reftest/content/crashtests/layout/xul/crashtests/168724-1.xhtml load chrome://reftest/content/crashtests/layout/xul/crashtests/189814-1.xhtml skip-if(Android) load chrome://reftest/content/crashtests/layout/xul/crashtests/289410-1.xhtml -load 290743.html load chrome://reftest/content/crashtests/layout/xul/crashtests/291702-1.xhtml load chrome://reftest/content/crashtests/layout/xul/crashtests/291702-2.xhtml load chrome://reftest/content/crashtests/layout/xul/crashtests/291702-3.xhtml load chrome://reftest/content/crashtests/layout/xul/crashtests/294371-1.xhtml -load 311457-1.html load chrome://reftest/content/crashtests/layout/xul/crashtests/322786-1.xhtml skip-if(Android) load chrome://reftest/content/crashtests/layout/xul/crashtests/325377.xhtml skip-if(Android) load chrome://reftest/content/crashtests/layout/xul/crashtests/326879-1.xhtml @@ -24,7 +22,6 @@ load chrome://reftest/content/crashtests/layout/xul/crashtests/366112-1.xhtml skip-if(Android) load chrome://reftest/content/crashtests/layout/xul/crashtests/366203-1.xhtml load 367185-1.xhtml load 369942-1.xhtml -skip-if(Android) load chrome://reftest/content/crashtests/layout/xul/crashtests/374102-1.xhtml load 376137-1.html load 376137-2.html load 377592-1.svg @@ -39,7 +36,6 @@ load 384871-1.html load chrome://reftest/content/crashtests/layout/xul/crashtests/386642.xhtml load chrome://reftest/content/crashtests/layout/xul/crashtests/387080-1.xhtml load 391974-1.html -skip-if(Android) load chrome://reftest/content/crashtests/layout/xul/crashtests/399013.xhtml load 402912-1.xhtml load 404192.xhtml load chrome://reftest/content/crashtests/layout/xul/crashtests/408904-1.xhtml diff --git a/layout/xul/moz.build b/layout/xul/moz.build index 3043ac37fc8d..ac7f97668fc2 100644 --- a/layout/xul/moz.build +++ b/layout/xul/moz.build @@ -23,7 +23,6 @@ UNIFIED_SOURCES += [ "nsBoxFrame.cpp", "nsBoxLayout.cpp", "nsBoxLayoutState.cpp", - "nsDeckFrame.cpp", "nsDocElementBoxFrame.cpp", "nsImageBoxFrame.cpp", "nsLeafBoxFrame.cpp", @@ -39,7 +38,6 @@ UNIFIED_SOURCES += [ "nsSliderFrame.cpp", "nsSplitterFrame.cpp", "nsSprocketLayout.cpp", - "nsStackLayout.cpp", "nsTextBoxFrame.cpp", "nsXULPopupManager.cpp", "nsXULTooltipListener.cpp", diff --git a/layout/xul/nsBox.cpp b/layout/xul/nsBox.cpp index f89af8cd6c69..d8cbd1a3a97c 100644 --- a/layout/xul/nsBox.cpp +++ b/layout/xul/nsBox.cpp @@ -308,8 +308,7 @@ nsresult nsIFrame::SyncXULLayout(nsBoxLayoutState& aBoxLayoutState) { nsresult nsIFrame::XULRedraw(nsBoxLayoutState& aState) { if (aState.PaintingDisabled()) return NS_OK; - // nsStackLayout, at least, expects us to repaint descendants even - // if a damage rect is provided + // Unclear whether we could get away with just InvalidateFrame(). InvalidateFrameSubtree(); return NS_OK; diff --git a/layout/xul/nsDeckFrame.cpp b/layout/xul/nsDeckFrame.cpp deleted file mode 100644 index c82627cb8b40..000000000000 --- a/layout/xul/nsDeckFrame.cpp +++ /dev/null @@ -1,283 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// -// Eric Vaughan -// Netscape Communications -// -// See documentation in associated header file -// - -#include "nsDeckFrame.h" -#include "mozilla/ComputedStyle.h" -#include "mozilla/PresShell.h" -#include "nsLayoutUtils.h" -#include "nsPresContext.h" -#include "nsIContent.h" -#include "nsCOMPtr.h" -#include "nsNameSpaceManager.h" -#include "nsGkAtoms.h" -#include "nsHTMLParts.h" -#include "nsCSSRendering.h" -#include "nsViewManager.h" -#include "nsBoxLayoutState.h" -#include "nsStackLayout.h" -#include "nsDisplayList.h" -#include "nsContainerFrame.h" -#include "nsContentUtils.h" -#include "nsXULPopupManager.h" -#include "nsImageBoxFrame.h" -#include "nsImageFrame.h" - -#ifdef ACCESSIBILITY -# include "nsAccessibilityService.h" -#endif - -using namespace mozilla; - -nsIFrame* NS_NewDeckFrame(PresShell* aPresShell, ComputedStyle* aStyle) { - return new (aPresShell) nsDeckFrame(aStyle, aPresShell->GetPresContext()); -} - -NS_IMPL_FRAMEARENA_HELPERS(nsDeckFrame) - -NS_QUERYFRAME_HEAD(nsDeckFrame) - NS_QUERYFRAME_ENTRY(nsDeckFrame) -NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame) - -nsDeckFrame::nsDeckFrame(ComputedStyle* aStyle, nsPresContext* aPresContext) - : nsBoxFrame(aStyle, aPresContext, kClassID) { - nsCOMPtr layout; - NS_NewStackLayout(layout); - SetXULLayoutManager(layout); -} - -nsresult nsDeckFrame::AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute, - int32_t aModType) { - nsresult rv = - nsBoxFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType); - - // if the index changed hide the old element and make the new element visible - if (aAttribute == nsGkAtoms::selectedIndex) { - IndexChanged(); - } - - return rv; -} - -void nsDeckFrame::Init(nsIContent* aContent, nsContainerFrame* aParent, - nsIFrame* aPrevInFlow) { - nsBoxFrame::Init(aContent, aParent, aPrevInFlow); - - mIndex = GetSelectedIndex(); -} - -void nsDeckFrame::ShowBox(nsIFrame* aBox) { Animate(aBox, true); } - -void nsDeckFrame::HideBox(nsIFrame* aBox) { - PresShell::ClearMouseCapture(aBox); - Animate(aBox, false); -} - -void nsDeckFrame::IndexChanged() { - // did the index change? - int32_t index = GetSelectedIndex(); - - if (index == mIndex) return; - - // redraw - InvalidateFrame(); - - // hide the currently showing box - nsIFrame* currentBox = GetSelectedBox(); - if (currentBox) // only hide if it exists - HideBox(currentBox); - - mSelectedBoxCache = nullptr; - - mIndex = index; - - ShowBox(GetSelectedBox()); - -#ifdef ACCESSIBILITY - nsAccessibilityService* accService = GetAccService(); - if (accService) { - accService->DeckPanelSwitched(PresContext()->GetPresShell(), mContent, - currentBox, GetSelectedBox()); - } -#endif - - // Force any popups that might be anchored on elements within hidden - // box to update. - nsXULPopupManager* pm = nsXULPopupManager::GetInstance(); - if (pm && currentBox) { - pm->UpdatePopupPositions(currentBox->PresContext()->RefreshDriver()); - } -} - -int32_t nsDeckFrame::GetSelectedIndex() { - // default index is 0 - int32_t index = 0; - - // get the index attribute - nsAutoString value; - if (mContent->AsElement()->GetAttr(kNameSpaceID_None, - nsGkAtoms::selectedIndex, value)) { - nsresult error; - - // convert it to an integer - index = value.ToInteger(&error); - } - - return index; -} - -nsIFrame* nsDeckFrame::GetSelectedBox() { - if (!mSelectedBoxCache && mIndex >= 0) { - mSelectedBoxCache = (mIndex >= 0) ? mFrames.FrameAt(mIndex) : nullptr; - } - return mSelectedBoxCache; -} - -void nsDeckFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, - const nsDisplayListSet& aLists) { - // if a tab is hidden all its children are too. - if (StyleVisibility()->mVisible == StyleVisibility::Hidden) { - return; - } - nsBoxFrame::BuildDisplayList(aBuilder, aLists); -} - -void nsDeckFrame::RemoveFrame(ChildListID aListID, nsIFrame* aOldFrame) { - nsIFrame* currentFrame = GetSelectedBox(); - if (aOldFrame == currentFrame) { - mSelectedBoxCache = nullptr; - } - - if (currentFrame && aOldFrame && currentFrame != aOldFrame) { - // If the frame we're removing is at an index that's less - // than mIndex, that means we're going to be shifting indexes - // by 1. - // - // We attempt to keep the same child displayed by automatically - // updating our internal notion of the current index. - int32_t removedIndex = mFrames.IndexOf(aOldFrame); - MOZ_ASSERT(removedIndex >= 0, - "A deck child was removed that was not in mFrames."); - if (removedIndex < mIndex) { - // This shouldn't invalidate our cache, but be really paranoid, it's not - // that important to keep our cache here. - mSelectedBoxCache = nullptr; - - mIndex--; - // This is going to cause us to handle the index change in IndexedChanged, - // but since the new index will match mIndex, it's essentially a noop. - nsContentUtils::AddScriptRunner(new nsSetAttrRunnable( - mContent->AsElement(), nsGkAtoms::selectedIndex, mIndex)); - } - } - nsBoxFrame::RemoveFrame(aListID, aOldFrame); -} - -void nsDeckFrame::BuildDisplayListForChildren(nsDisplayListBuilder* aBuilder, - const nsDisplayListSet& aLists) { - // only paint the selected box - nsIFrame* box = GetSelectedBox(); - if (!box) return; - - // Putting the child in the background list. This is a little weird but - // it matches what we were doing before. - nsDisplayListSet set(aLists, aLists.BlockBorderBackgrounds()); - BuildDisplayListForChild(aBuilder, box, set); -} - -void nsDeckFrame::Animate(nsIFrame* aParentBox, bool start) { - if (!aParentBox) return; - - nsImageBoxFrame* imgBoxFrame = do_QueryFrame(aParentBox); - nsImageFrame* imgFrame = do_QueryFrame(aParentBox); - - if (imgBoxFrame) { - if (start) - imgBoxFrame->RestartAnimation(); - else - imgBoxFrame->StopAnimation(); - } - - if (imgFrame) { - if (start) - imgFrame->RestartAnimation(); - else - imgFrame->StopAnimation(); - } - - for (const auto& childList : aParentBox->ChildLists()) { - for (nsIFrame* child : childList.mList) { - Animate(child, start); - } - } -} - -NS_IMETHODIMP -nsDeckFrame::DoXULLayout(nsBoxLayoutState& aState) { - // Make sure we tweak the state so it does not resize our children. - // We will do that. - ReflowChildFlags oldFlags = aState.LayoutFlags(); - aState.SetLayoutFlags(ReflowChildFlags::NoSizeView); - - // do a normal layout - nsresult rv = nsBoxFrame::DoXULLayout(aState); - - // and other than our browser's tab shouldn't have any - // or