Bug 631473 - Don't consume mouse scroll events outside arrow panels on OS X. r=mstange r=enndeakin

This commit is contained in:
Frank Yan 2013-03-08 11:48:48 -08:00
Родитель aeff679a81
Коммит 49c0cd1bee
6 изменённых файлов: 29 добавлений и 3 удалений

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

@ -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
*/