mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Move APZ handling of wheel events from nsWindow to RenderFrameParent. (bug 1013432 part 7, r=kats)
--HG-- extra : rebase_source : 6ee0db41a21d333deb511a6403f8178b7fe01bb9
This commit is contained in:
parent
a986c06526
commit
2d2f1f58bd
@ -901,6 +901,30 @@ APZCTreeManager::ProcessEvent(WidgetInputEvent& aEvent,
|
||||
return result;
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
APZCTreeManager::ProcessWheelEvent(WidgetWheelEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId)
|
||||
{
|
||||
ScrollWheelInput::ScrollMode scrollMode = ScrollWheelInput::SCROLLMODE_INSTANT;
|
||||
if (Preferences::GetBool("general.smoothScroll")) {
|
||||
scrollMode = ScrollWheelInput::SCROLLMODE_SMOOTH;
|
||||
}
|
||||
|
||||
ScreenPoint origin(aEvent.refPoint.x, aEvent.refPoint.y);
|
||||
ScrollWheelInput input(aEvent.time, aEvent.timeStamp, 0,
|
||||
scrollMode,
|
||||
ScrollWheelInput::SCROLLDELTA_LINE,
|
||||
origin,
|
||||
aEvent.lineOrPageDeltaX,
|
||||
aEvent.lineOrPageDeltaY);
|
||||
|
||||
nsEventStatus status = ReceiveInputEvent(input, aOutTargetGuid, aOutInputBlockId);
|
||||
aEvent.refPoint.x = input.mOrigin.x;
|
||||
aEvent.refPoint.y = input.mOrigin.y;
|
||||
return status;
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
APZCTreeManager::ReceiveInputEvent(WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
@ -934,6 +958,17 @@ APZCTreeManager::ReceiveInputEvent(WidgetInputEvent& aEvent,
|
||||
}
|
||||
return result;
|
||||
}
|
||||
case eWheelEventClass: {
|
||||
WidgetWheelEvent& wheelEvent = *aEvent.AsWheelEvent();
|
||||
if (wheelEvent.IsControl() ||
|
||||
wheelEvent.deltaMode != nsIDOMWheelEvent::DOM_DELTA_LINE)
|
||||
{
|
||||
// Don't send through APZ if we could be ctrl+zooming or if the delta
|
||||
// mode is not line-based.
|
||||
return ProcessEvent(aEvent, aOutTargetGuid, aOutInputBlockId);
|
||||
}
|
||||
return ProcessWheelEvent(wheelEvent, aOutTargetGuid, aOutInputBlockId);
|
||||
}
|
||||
default: {
|
||||
return ProcessEvent(aEvent, aOutTargetGuid, aOutInputBlockId);
|
||||
}
|
||||
|
@ -414,6 +414,9 @@ private:
|
||||
nsEventStatus ProcessTouchInput(MultiTouchInput& aInput,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
nsEventStatus ProcessWheelEvent(WidgetWheelEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
nsEventStatus ProcessEvent(WidgetInputEvent& inputEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid,
|
||||
uint64_t* aOutInputBlockId);
|
||||
|
@ -187,7 +187,6 @@
|
||||
#endif
|
||||
|
||||
#include "mozilla/layers/CompositorParent.h"
|
||||
#include "InputData.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -3740,48 +3739,8 @@ bool nsWindow::DispatchKeyboardEvent(WidgetGUIEvent* event)
|
||||
return ConvertStatus(status);
|
||||
}
|
||||
|
||||
nsEventStatus nsWindow::MaybeDispatchAsyncWheelEvent(WidgetGUIEvent* aEvent)
|
||||
{
|
||||
if (aEvent->mClass != eWheelEventClass) {
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
WidgetWheelEvent* event = aEvent->AsWheelEvent();
|
||||
|
||||
// Otherwise, scroll-zoom won't work.
|
||||
if (event->IsControl()) {
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
|
||||
// Other scrolling modes aren't supported yet.
|
||||
if (event->deltaMode != nsIDOMWheelEvent::DOM_DELTA_LINE) {
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
ScrollWheelInput::ScrollMode scrollMode = ScrollWheelInput::SCROLLMODE_INSTANT;
|
||||
if (Preferences::GetBool("general.smoothScroll"))
|
||||
scrollMode = ScrollWheelInput::SCROLLMODE_SMOOTH;
|
||||
|
||||
ScreenPoint origin(event->refPoint.x, event->refPoint.y);
|
||||
ScrollWheelInput input(event->time, event->timeStamp, 0,
|
||||
scrollMode,
|
||||
ScrollWheelInput::SCROLLDELTA_LINE,
|
||||
origin,
|
||||
event->lineOrPageDeltaX,
|
||||
event->lineOrPageDeltaY);
|
||||
|
||||
ScrollableLayerGuid ignoreGuid;
|
||||
return mAPZC->ReceiveInputEvent(input, &ignoreGuid, nullptr);
|
||||
}
|
||||
|
||||
bool nsWindow::DispatchScrollEvent(WidgetGUIEvent* aEvent)
|
||||
{
|
||||
if (mAPZC) {
|
||||
if (MaybeDispatchAsyncWheelEvent(aEvent) == nsEventStatus_eConsumeNoDefault)
|
||||
return true;
|
||||
}
|
||||
|
||||
nsEventStatus status;
|
||||
DispatchEvent(aEvent, status);
|
||||
return ConvertStatus(status);
|
||||
|
@ -392,8 +392,6 @@ protected:
|
||||
void OnWindowPosChanging(LPWINDOWPOS& info);
|
||||
void OnSysColorChanged();
|
||||
|
||||
nsEventStatus MaybeDispatchAsyncWheelEvent(mozilla::WidgetGUIEvent* aEvent);
|
||||
|
||||
/**
|
||||
* Function that registers when the user has been active (used for detecting
|
||||
* when the user is idle).
|
||||
|
Loading…
Reference in New Issue
Block a user