Commit 8e1dc38d authored by Edgar Chen's avatar Edgar Chen Committed by Pier Angelo Vendrame
Browse files

Bug 1743329 - Use nsMenuPopupFrame in GetVisiblePopups(); r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D211619

A further change was needed in nsCaret.cpp, see
!1048 (comment 3046018)
parent 45a8a295
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -855,7 +855,7 @@ size_t nsCaret::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const {
bool nsCaret::IsMenuPopupHidingCaret() {
  // Check if there are open popups.
  nsXULPopupManager* popMgr = nsXULPopupManager::GetInstance();
  nsTArray<nsIFrame*> popups;
  nsTArray<nsMenuPopupFrame*> popups;
  popMgr->GetVisiblePopups(popups);

  if (popups.Length() == 0)
@@ -873,7 +873,7 @@ bool nsCaret::IsMenuPopupHidingCaret() {
  // If there's a menu popup open before the popup with
  // the caret, don't show the caret.
  for (uint32_t i = 0; i < popups.Length(); i++) {
    nsMenuPopupFrame* popupFrame = static_cast<nsMenuPopupFrame*>(popups[i]);
    nsMenuPopupFrame* popupFrame = popups[i];
    nsIContent* popupContent = popupFrame->GetContent();

    if (caretContent->IsInclusiveDescendantOf(popupContent)) {
+3 −2
Original line number Diff line number Diff line
@@ -138,6 +138,7 @@
#include "nsIScrollableFrame.h"
#include "nsIWidget.h"
#include "nsListControlFrame.h"
#include "nsMenuPopupFrame.h"
#include "nsPIDOMWindow.h"
#include "nsPlaceholderFrame.h"
#include "nsPresContext.h"
@@ -1757,10 +1758,10 @@ nsIFrame* nsLayoutUtils::GetPopupFrameForPoint(
  if (!pm) {
    return nullptr;
  }
  nsTArray<nsIFrame*> popups;
  nsTArray<nsMenuPopupFrame*> popups;
  pm->GetVisiblePopups(popups);
  // Search from top to bottom
  for (nsIFrame* popup : popups) {
  for (nsMenuPopupFrame* popup : popups) {
    if (popup->PresContext()->GetRootPresContext() != aRootPresContext) {
      continue;
    }