mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-26 06:38:36 +00:00
Bug 66834. Autocomplete swallowing clicks. Fixing for Windows and leaving bug open. r=pinkerton, sr=hyatt
This commit is contained in:
parent
b840b8f912
commit
ab3b47f2ed
@ -150,6 +150,7 @@ public:
|
||||
NS_IMETHOD GetWidget(nsIWidget **aWidget) = 0;
|
||||
|
||||
NS_IMETHOD IsMenuBar(PRBool& isMenuBar) = 0;
|
||||
NS_IMETHOD ConsumeOutsideClicks(PRBool& aConsumeOutsideClicks) = 0;
|
||||
|
||||
NS_IMETHOD DismissChain() = 0;
|
||||
NS_IMETHOD HideChain() = 0;
|
||||
|
@ -75,6 +75,8 @@ public:
|
||||
NS_IMETHOD SetActive(PRBool aActiveFlag);
|
||||
NS_IMETHOD GetIsActive(PRBool& isActive) { isActive = IsActive(); return NS_OK; };
|
||||
NS_IMETHOD IsMenuBar(PRBool& isMenuBar) { isMenuBar = PR_TRUE; return NS_OK; };
|
||||
NS_IMETHOD ConsumeOutsideClicks(PRBool& aConsumeOutsideClicks) \
|
||||
{aConsumeOutsideClicks = PR_FALSE; return NS_OK;};
|
||||
|
||||
NS_IMETHOD SetIsContextMenu(PRBool aIsContextMenu) { return NS_OK; };
|
||||
NS_IMETHOD GetIsContextMenu(PRBool& aIsContextMenu) { aIsContextMenu = PR_FALSE; return NS_OK; };
|
||||
|
@ -97,7 +97,9 @@ nsMenuDismissalListener::SetCurrentMenuParent(nsIMenuParent* aMenuParent)
|
||||
if (!widget)
|
||||
return;
|
||||
|
||||
widget->CaptureRollupEvents(this, PR_TRUE, PR_TRUE);
|
||||
PRBool consumeOutsideClicks = PR_FALSE;
|
||||
aMenuParent->ConsumeOutsideClicks(consumeOutsideClicks);
|
||||
widget->CaptureRollupEvents(this, PR_TRUE, consumeOutsideClicks);
|
||||
mWidget = widget;
|
||||
|
||||
NS_ADDREF(nsMenuFrame::sDismissalListener = this);
|
||||
|
@ -1423,6 +1423,54 @@ NS_IMETHODIMP nsMenuPopupFrame::GetCurrentMenuItem(nsIMenuFrame** aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMenuPopupFrame::ConsumeOutsideClicks(PRBool& aConsumeOutsideClicks)
|
||||
{
|
||||
/*
|
||||
* When this popup is open, should clicks outside of it be consumed?
|
||||
* Return PR_TRUE if the popup hould rollup on an outside click,
|
||||
* but consume that click so it can't be used for anything else.
|
||||
* Return PR_FALSE to allow clicks outside the popup to activate content
|
||||
* even when the popup is open.
|
||||
* ---------------------------------------------------------------------
|
||||
*
|
||||
* Should clicks outside of a popup be eaten?
|
||||
*
|
||||
* Menus Autocomplete Comboboxes
|
||||
* Mac Eat No Eat
|
||||
* Win No No Eat
|
||||
* Unix Eat No Eat
|
||||
*
|
||||
*/
|
||||
|
||||
aConsumeOutsideClicks = PR_TRUE;
|
||||
|
||||
nsCOMPtr<nsIContent> parentContent;
|
||||
mContent->GetParent(*getter_AddRefs(parentContent));
|
||||
|
||||
if (parentContent) {
|
||||
nsCOMPtr<nsIAtom> parentTag;
|
||||
parentContent->GetTag(*getter_AddRefs(parentTag));
|
||||
if (parentTag == nsXULAtoms::menulist)
|
||||
return NS_OK; // Consume outside clicks for combo boxes on all platforms
|
||||
if (parentTag == nsXULAtoms::menu) {
|
||||
#ifdef XP_WIN
|
||||
// Don't consume outside clicks for menus in Windows
|
||||
aConsumeOutsideClicks = PR_FALSE;
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
if (parentTag == nsXULAtoms::textbox) {
|
||||
// Don't consume outside clicks for autocomplete widget
|
||||
nsAutoString typeString;
|
||||
parentContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, typeString);
|
||||
if (typeString.EqualsIgnoreCase("autocomplete"))
|
||||
aConsumeOutsideClicks = PR_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIScrollableView* nsMenuPopupFrame::GetScrollableView(nsIFrame* aStart)
|
||||
{
|
||||
if ( ! aStart )
|
||||
|
@ -91,6 +91,7 @@ public:
|
||||
NS_IMETHOD SetActive(PRBool aActiveFlag) { return NS_OK; }; // We don't care.
|
||||
NS_IMETHOD GetIsActive(PRBool& isActive) { isActive = PR_FALSE; return NS_OK; };
|
||||
NS_IMETHOD IsMenuBar(PRBool& isMenuBar) { isMenuBar = PR_FALSE; return NS_OK; };
|
||||
NS_IMETHOD ConsumeOutsideClicks(PRBool& aConsumeOutsideClicks);
|
||||
NS_IMETHOD SetIsContextMenu(PRBool aIsContextMenu) { mIsContextMenu = aIsContextMenu; return NS_OK; };
|
||||
NS_IMETHOD GetIsContextMenu(PRBool& aIsContextMenu) { aIsContextMenu = mIsContextMenu; return NS_OK; };
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user