mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 815671 part 3. Make nsXULPopupManager::GetVisiblePopups use an array out param instead of returning array object copies. r=roc
This commit is contained in:
parent
3695c38605
commit
542ae8e2de
@ -3111,7 +3111,8 @@ nsFocusManager::GetNextTabbablePanel(nsIDocument* aDocument, nsIFrame* aCurrentP
|
||||
return nullptr;
|
||||
|
||||
// Iterate through the array backwards if aForward is false.
|
||||
nsTArray<nsIFrame *> popups = pm->GetVisiblePopups();
|
||||
nsTArray<nsIFrame *> popups;
|
||||
pm->GetVisiblePopups(popups);
|
||||
int32_t i = aForward ? 0 : popups.Length() - 1;
|
||||
int32_t end = aForward ? popups.Length() : -1;
|
||||
|
||||
|
@ -934,7 +934,8 @@ bool nsCaret::IsMenuPopupHidingCaret()
|
||||
#ifdef MOZ_XUL
|
||||
// Check if there are open popups.
|
||||
nsXULPopupManager *popMgr = nsXULPopupManager::GetInstance();
|
||||
nsTArray<nsIFrame*> popups = popMgr->GetVisiblePopups();
|
||||
nsTArray<nsIFrame*> popups;
|
||||
popMgr->GetVisiblePopups(popups);
|
||||
|
||||
if (popups.Length() == 0)
|
||||
return false; // No popups, so caret can't be hidden by them.
|
||||
|
@ -1192,7 +1192,8 @@ nsLayoutUtils::GetPopupFrameForEventCoordinates(nsPresContext* aPresContext,
|
||||
if (!pm) {
|
||||
return nullptr;
|
||||
}
|
||||
nsTArray<nsIFrame*> popups = pm->GetVisiblePopups();
|
||||
nsTArray<nsIFrame*> popups;
|
||||
pm->GetVisiblePopups(popups);
|
||||
uint32_t i;
|
||||
// Search from top to bottom
|
||||
for (i = 0; i < popups.Length(); i++) {
|
||||
|
@ -490,7 +490,7 @@ public:
|
||||
* Return an array of all the open and visible popup frames for
|
||||
* menus, in order from top to bottom.
|
||||
*/
|
||||
nsTArray<nsIFrame *> GetVisiblePopups();
|
||||
void GetVisiblePopups(nsTArray<nsIFrame *>& aPopups);
|
||||
|
||||
/**
|
||||
* Get the node that last triggered a popup or tooltip in the document
|
||||
|
@ -1325,15 +1325,15 @@ nsXULPopupManager::GetTopPopup(nsPopupType aType)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsTArray<nsIFrame *>
|
||||
nsXULPopupManager::GetVisiblePopups()
|
||||
void
|
||||
nsXULPopupManager::GetVisiblePopups(nsTArray<nsIFrame *>& aPopups)
|
||||
{
|
||||
nsTArray<nsIFrame *> popups;
|
||||
aPopups.Clear();
|
||||
|
||||
nsMenuChainItem* item = mPopups;
|
||||
while (item) {
|
||||
if (item->Frame()->PopupState() == ePopupOpenAndVisible)
|
||||
popups.AppendElement(static_cast<nsIFrame*>(item->Frame()));
|
||||
aPopups.AppendElement(static_cast<nsIFrame*>(item->Frame()));
|
||||
item = item->GetParent();
|
||||
}
|
||||
|
||||
@ -1342,12 +1342,10 @@ nsXULPopupManager::GetVisiblePopups()
|
||||
// skip panels which are not open and visible as well as draggable popups,
|
||||
// as those don't respond to events.
|
||||
if (item->Frame()->PopupState() == ePopupOpenAndVisible && !item->Frame()->IsDragPopup()) {
|
||||
popups.AppendElement(static_cast<nsIFrame*>(item->Frame()));
|
||||
aPopups.AppendElement(static_cast<nsIFrame*>(item->Frame()));
|
||||
}
|
||||
item = item->GetParent();
|
||||
}
|
||||
|
||||
return popups;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMNode>
|
||||
|
Loading…
Reference in New Issue
Block a user