зеркало из https://github.com/mozilla/gecko-dev.git
Bug 631473 - Don't consume mouse scroll events outside arrow panels on OS X. r=mstange r=enndeakin
This commit is contained in:
Родитель
aeff679a81
Коммит
49c0cd1bee
|
@ -94,6 +94,7 @@ GK_ATOM(applyTemplates, "apply-templates")
|
|||
GK_ATOM(mozapptype, "mozapptype")
|
||||
GK_ATOM(archive, "archive")
|
||||
GK_ATOM(area, "area")
|
||||
GK_ATOM(arrow, "arrow")
|
||||
GK_ATOM(article, "article")
|
||||
GK_ATOM(ascending, "ascending")
|
||||
GK_ATOM(aside, "aside")
|
||||
|
|
|
@ -178,6 +178,9 @@ public:
|
|||
virtual bool ShouldRollupOnMouseWheelEvent()
|
||||
{ return true; }
|
||||
|
||||
virtual bool ShouldConsumeOnMouseWheelEvent()
|
||||
{ return false; }
|
||||
|
||||
/**
|
||||
* A combobox should not roll up if activated by a mouse activate message
|
||||
* (eg. X-mouse).
|
||||
|
|
|
@ -288,6 +288,7 @@ public:
|
|||
// nsIRollupListener
|
||||
virtual bool Rollup(uint32_t aCount, nsIContent** aLastRolledUp);
|
||||
virtual bool ShouldRollupOnMouseWheelEvent();
|
||||
virtual bool ShouldConsumeOnMouseWheelEvent();
|
||||
virtual bool ShouldRollupOnMouseActivate();
|
||||
virtual uint32_t GetSubmenuWidgetChain(nsTArray<nsIWidget*> *aWidgetChain);
|
||||
virtual void NotifyGeometryChange() {}
|
||||
|
|
|
@ -238,6 +238,21 @@ bool nsXULPopupManager::ShouldRollupOnMouseWheelEvent()
|
|||
return StringBeginsWith(value, NS_LITERAL_STRING("autocomplete"));
|
||||
}
|
||||
|
||||
bool nsXULPopupManager::ShouldConsumeOnMouseWheelEvent()
|
||||
{
|
||||
nsMenuChainItem* item = GetTopVisibleMenu();
|
||||
if (!item)
|
||||
return false;
|
||||
|
||||
nsMenuPopupFrame* frame = item->Frame();
|
||||
if (frame->PopupType() != ePopupTypePanel)
|
||||
return true;
|
||||
|
||||
nsIContent* content = frame->GetContent();
|
||||
return !(content && content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::arrow, eCaseMatters));
|
||||
}
|
||||
|
||||
// a menu should not roll up if activated by a mouse activate message (eg. X-mouse)
|
||||
bool nsXULPopupManager::ShouldRollupOnMouseActivate()
|
||||
{
|
||||
|
|
|
@ -2867,8 +2867,9 @@ NSEvent* gLastDragMouseDownEvent = nil;
|
|||
// check to see if scroll events should roll up the popup
|
||||
if ([theEvent type] == NSScrollWheel) {
|
||||
shouldRollup = rollupListener->ShouldRollupOnMouseWheelEvent();
|
||||
// always consume scroll events that aren't over the popup
|
||||
consumeEvent = YES;
|
||||
// consume scroll events that aren't over the popup
|
||||
// unless the popup is an arrow panel
|
||||
consumeEvent = rollupListener->ShouldConsumeOnMouseWheelEvent();
|
||||
}
|
||||
|
||||
// if we're dealing with menus, we probably have submenus and
|
||||
|
|
|
@ -29,10 +29,15 @@ class nsIRollupListener {
|
|||
virtual bool Rollup(uint32_t aCount, nsIContent** aLastRolledUp) = 0;
|
||||
|
||||
/**
|
||||
* Asks the RollupListener if it should rollup on mousevents
|
||||
* Asks the RollupListener if it should rollup on mouse wheel events
|
||||
*/
|
||||
virtual bool ShouldRollupOnMouseWheelEvent() = 0;
|
||||
|
||||
/**
|
||||
* Asks the RollupListener if it should consume mouse wheel events
|
||||
*/
|
||||
virtual bool ShouldConsumeOnMouseWheelEvent() = 0;
|
||||
|
||||
/**
|
||||
* Asks the RollupListener if it should rollup on mouse activate, eg. X-Mouse
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче