Commit 13f6a420 authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

Bug 1771262 - z-index should apply to menupopup frames. r=stransky a=pascalc

nsMenuPopupFrame initialized the view z-index to a hard-coded INT32_MAX, but
then reset it on restyles based on ZIndex() in SyncFrameViewProperties().

We specify z-index here, so use a consistent z-index all around:

  https://searchfox.org/mozilla-central/rev/ace2c59e6c56b2dcba25af1aa8903a5e7f9a5857/toolkit/content/xul.css#255-256

I suspect this is also causing that weird bug about menus going under other
menus on macOS (bug 1763990).

Differential Revision: https://phabricator.services.mozilla.com/D148762
parent 0dd35dd1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -10027,7 +10027,8 @@ void nsIFrame::ComputePreserve3DChildrenOverflow(
}

bool nsIFrame::ZIndexApplies() const {
  return StyleDisplay()->IsPositionedStyle() || IsFlexOrGridItem();
  return StyleDisplay()->IsPositionedStyle() || IsFlexOrGridItem() ||
         IsMenuPopupFrame();
}

Maybe<int32_t> nsIFrame::ZIndex() const {
+2 −3
Original line number Diff line number Diff line
@@ -2535,14 +2535,13 @@ void nsMenuPopupFrame::CreatePopupView() {
  // Create a view
  nsView* parentView = viewManager->GetRootView();
  nsViewVisibility visibility = nsViewVisibility_kHide;
  int32_t zIndex = INT32_MAX;
  bool autoZIndex = false;

  NS_ASSERTION(parentView, "no parent view");

  // Create a view
  nsView* view = viewManager->CreateView(GetRect(), parentView, visibility);
  viewManager->SetViewZIndex(view, autoZIndex, zIndex);
  auto zIndex = ZIndex();
  viewManager->SetViewZIndex(view, zIndex.isNothing(), zIndex.valueOr(0));
  // XXX put view last in document order until we can do better
  viewManager->InsertChild(parentView, view, nullptr, true);