зеркало из https://github.com/mozilla/pjs.git
Bug 282438. Fire menupopupend for context menus and autocomplete. r=bryner, sr=neil
This commit is contained in:
Родитель
02033aa00a
Коммит
650f2060bf
|
@ -2565,19 +2565,20 @@ nsBoxFrame::RegUnregAccessKey(nsPresContext* aPresContext, PRBool aDoReg)
|
|||
|
||||
|
||||
void
|
||||
nsBoxFrame::FireDOMEvent(const nsAString& aDOMEventName)
|
||||
nsBoxFrame::FireDOMEvent(const nsAString& aDOMEventName, nsIContent *aContent)
|
||||
{
|
||||
if (mContent && mPresContext) {
|
||||
// Fire a DOM event for the title change.
|
||||
nsIContent *content = aContent ? aContent : mContent;
|
||||
if (content && mPresContext) {
|
||||
// Fire a DOM event
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
nsCOMPtr<nsIEventListenerManager> manager;
|
||||
mContent->GetListenerManager(getter_AddRefs(manager));
|
||||
content->GetListenerManager(getter_AddRefs(manager));
|
||||
if (manager && NS_SUCCEEDED(manager->CreateEvent(mPresContext, nsnull,
|
||||
NS_LITERAL_STRING("Events"),
|
||||
getter_AddRefs(event)))) {
|
||||
event->InitEvent(aDOMEventName, PR_TRUE, PR_TRUE);
|
||||
PRBool noDefault;
|
||||
mPresContext->EventStateManager()->DispatchNewEvent(mContent, event,
|
||||
mPresContext->EventStateManager()->DispatchNewEvent(content, event,
|
||||
&noDefault);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -204,7 +204,8 @@ public:
|
|||
|
||||
static nsresult LayoutChildAt(nsBoxLayoutState& aState, nsIBox* aBox, const nsRect& aRect);
|
||||
|
||||
void FireDOMEvent(const nsAString& aDOMEventName);
|
||||
// Fire DOM event. If no aContent argument use frame's mContent.
|
||||
void FireDOMEvent(const nsAString& aDOMEventName, nsIContent *aContent = nsnull);
|
||||
|
||||
protected:
|
||||
#ifdef DEBUG_LAYOUT
|
||||
|
|
|
@ -77,6 +77,7 @@ nsPopupFrameList::nsPopupFrameList(nsIContent* aPopupContent, nsPopupFrameList*
|
|||
mPopupContent(aPopupContent),
|
||||
mElementContent(nsnull),
|
||||
mCreateHandlerSucceeded(PR_FALSE),
|
||||
mIsOpen(PR_FALSE),
|
||||
mLastPref(-1,-1)
|
||||
{
|
||||
}
|
||||
|
@ -377,6 +378,7 @@ nsPopupSetFrame::ShowPopup(nsIContent* aElementContent, nsIContent* aPopupConten
|
|||
|
||||
// Generate the popup.
|
||||
entry->mCreateHandlerSucceeded = PR_TRUE;
|
||||
entry->mIsOpen = PR_TRUE;
|
||||
MarkAsGenerated(aPopupContent);
|
||||
|
||||
// determine if this menu is a context menu and flag it
|
||||
|
@ -568,6 +570,10 @@ nsPopupSetFrame::ActivatePopup(nsPopupFrameList* aEntry, PRBool aActivateFlag)
|
|||
viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
|
||||
nsRect r(0, 0, 0, 0);
|
||||
viewManager->ResizeView(view, r);
|
||||
if (aEntry->mIsOpen) {
|
||||
aEntry->mIsOpen = PR_FALSE;
|
||||
FireDOMEvent(NS_LITERAL_STRING("DOMMenuInactive"), aEntry->mPopupContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,7 +72,8 @@ struct nsPopupFrameList {
|
|||
nsAutoString mPopupAlign; // This child's align.
|
||||
|
||||
nsAutoString mPopupType;
|
||||
PRBool mCreateHandlerSucceeded; // Did the create handler succeed?
|
||||
PRPackedBool mCreateHandlerSucceeded; // Did the create handler succeed?
|
||||
PRPackedBool mIsOpen;
|
||||
nsSize mLastPref;
|
||||
|
||||
public:
|
||||
|
|
Загрузка…
Ссылка в новой задаче