mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-30 18:31:08 +00:00
Close the autocomplete popup if a context menu is opened (bug 296526), patch by martijn, r=me
This commit is contained in:
parent
dd7caa2186
commit
c2391975f2
@ -86,6 +86,7 @@ NS_INTERFACE_MAP_BEGIN(nsFormFillController)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMLoadListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCompositionListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMContextMenuListener)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFormFillController)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMFocusListener)
|
||||
NS_INTERFACE_MAP_END
|
||||
@ -220,7 +221,7 @@ nsFormFillController::SetPopupOpen(PRBool aPopupOpen)
|
||||
} else
|
||||
mFocusedPopup->ClosePopup();
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -875,6 +876,14 @@ nsFormFillController::Error(nsIDOMEvent *aLoadEvent)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFormFillController::ContextMenu(nsIDOMEvent* aContextMenuEvent)
|
||||
{
|
||||
if (mFocusedPopup)
|
||||
mFocusedPopup->ClosePopup();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//// nsFormFillController
|
||||
|
||||
@ -894,9 +903,9 @@ nsFormFillController::AddWindowListeners(nsIDOMWindow *aWindow)
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
target->AddEventListener(NS_LITERAL_STRING("focus"),
|
||||
NS_STATIC_CAST(nsIDOMFocusListener *, this),
|
||||
PR_TRUE);
|
||||
target->AddEventListener(NS_LITERAL_STRING("focus"),
|
||||
NS_STATIC_CAST(nsIDOMFocusListener *, this),
|
||||
PR_TRUE);
|
||||
|
||||
target->AddEventListener(NS_LITERAL_STRING("blur"),
|
||||
NS_STATIC_CAST(nsIDOMFocusListener *, this),
|
||||
@ -925,6 +934,10 @@ nsFormFillController::AddWindowListeners(nsIDOMWindow *aWindow)
|
||||
target->AddEventListener(NS_LITERAL_STRING("compositionend"),
|
||||
NS_STATIC_CAST(nsIDOMCompositionListener *, this),
|
||||
PR_TRUE);
|
||||
|
||||
target->AddEventListener(NS_LITERAL_STRING("contextmenu"),
|
||||
NS_STATIC_CAST(nsIDOMContextMenuListener *, this),
|
||||
PR_TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
@ -946,8 +959,8 @@ nsFormFillController::RemoveWindowListeners(nsIDOMWindow *aWindow)
|
||||
return;
|
||||
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("focus"),
|
||||
NS_STATIC_CAST(nsIDOMFocusListener *, this),
|
||||
PR_TRUE);
|
||||
NS_STATIC_CAST(nsIDOMFocusListener *, this),
|
||||
PR_TRUE);
|
||||
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("blur"),
|
||||
NS_STATIC_CAST(nsIDOMFocusListener *, this),
|
||||
@ -976,6 +989,10 @@ nsFormFillController::RemoveWindowListeners(nsIDOMWindow *aWindow)
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("compositionend"),
|
||||
NS_STATIC_CAST(nsIDOMCompositionListener *, this),
|
||||
PR_TRUE);
|
||||
|
||||
target->RemoveEventListener(NS_LITERAL_STRING("contextmenu"),
|
||||
NS_STATIC_CAST(nsIDOMContextMenuListener *, this),
|
||||
PR_TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
@ -983,7 +1000,7 @@ nsFormFillController::AddKeyListener(nsIDOMHTMLInputElement *aInput)
|
||||
{
|
||||
if (!aInput)
|
||||
return;
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(aInput);
|
||||
|
||||
target->AddEventListener(NS_LITERAL_STRING("keypress"),
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "nsIDOMFormListener.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIDOMLoadListener.h"
|
||||
#include "nsIDOMContextMenuListener.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIDocShell.h"
|
||||
@ -67,7 +68,8 @@ class nsFormFillController : public nsIFormFillController,
|
||||
public nsIDOMCompositionListener,
|
||||
public nsIDOMFormListener,
|
||||
public nsIDOMMouseListener,
|
||||
public nsIDOMLoadListener
|
||||
public nsIDOMLoadListener,
|
||||
public nsIDOMContextMenuListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
@ -114,6 +116,9 @@ public:
|
||||
NS_IMETHOD Abort(nsIDOMEvent *aLoadEvent);
|
||||
NS_IMETHOD Error(nsIDOMEvent *aLoadEvent);
|
||||
|
||||
// nsIDOMContextMenuListener
|
||||
NS_IMETHOD ContextMenu(nsIDOMEvent* aContextMenuEvent);
|
||||
|
||||
nsFormFillController();
|
||||
virtual ~nsFormFillController();
|
||||
|
||||
|
@ -516,7 +516,10 @@
|
||||
|
||||
<handler event="blur" phase="capturing"
|
||||
action="if (!this._dontBlur) this.detachController();"/>
|
||||
|
||||
|
||||
<handler event="contextmenu" phase="capturing"
|
||||
action="this.closePopup();"/>
|
||||
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user