Bug 374471 Make the noautohide attribute live where supported r=enndeakin

This commit is contained in:
Neil Rashbrook 2016-01-31 13:00:44 +00:00
Родитель d3cec93f2b
Коммит 50eb2af64f
3 изменённых файлов: 51 добавлений и 0 удалений

Просмотреть файл

@ -2101,6 +2101,14 @@ nsMenuPopupFrame::AttributeChanged(int32_t aNameSpaceID,
if (aAttribute == nsGkAtoms::left || aAttribute == nsGkAtoms::top)
MoveToAttributePosition();
#ifndef MOZ_GTK2
if (aAttribute == nsGkAtoms::noautohide) {
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
if (pm)
pm->EnableRollup(mContent, !IsNoAutoHide());
}
#endif
if (aAttribute == nsGkAtoms::label) {
// set the label for the titlebar
nsView* view = GetView();

Просмотреть файл

@ -1236,6 +1236,41 @@ nsXULPopupManager::HidePopupsInList(const nsTArray<nsMenuPopupFrame *> &aFrames)
SetCaptureState(nullptr);
}
void
nsXULPopupManager::EnableRollup(nsIContent* aPopup, bool aShouldRollup)
{
#ifndef MOZ_GTK
if (aShouldRollup) {
nsMenuChainItem* item = mNoHidePanels;
while (item) {
if (item->Content() == aPopup) {
item->Detach(&mNoHidePanels);
nsIContent* oldmenu = nullptr;
if (mPopups)
oldmenu = mPopups->Content();
item->SetParent(mPopups);
mPopups = item;
SetCaptureState(oldmenu);
return;
}
item = item->GetParent();
}
} else {
nsMenuChainItem* item = mPopups;
while (item) {
if (item->Content() == aPopup) {
item->Detach(&mPopups);
item->SetParent(mNoHidePanels);
mNoHidePanels = item;
SetCaptureState(nullptr);
return;
}
item = item->GetParent();
}
}
#endif
}
bool
nsXULPopupManager::IsChildOfDocShell(nsIDocument* aDoc, nsIDocShellTreeItem* aExpected)
{

Просмотреть файл

@ -484,6 +484,14 @@ public:
*/
void HidePopupsInDocShell(nsIDocShellTreeItem* aDocShellToHide);
/**
* Enable or disable the dynamic noautohide state of a panel.
*
* aPanel - the panel whose state is to change
* aShouldRollup - whether the panel is no longer noautohide
*/
void EnableRollup(nsIContent* aPopup, bool aShouldRollup);
/**
* Execute a menu command from the triggering event aEvent.
*