зеркало из https://github.com/mozilla/gecko-dev.git
Forward Windows scroll events to APZ when async scrolling is enabled. (bug 1086162 part 2, r=jmathies)
This commit is contained in:
Родитель
028b163679
Коммит
e05810e552
|
@ -186,6 +186,9 @@
|
||||||
#define SM_CONVERTIBLESLATEMODE 0x2003
|
#define SM_CONVERTIBLESLATEMODE 0x2003
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "mozilla/layers/CompositorParent.h"
|
||||||
|
#include "InputData.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
using namespace mozilla::gfx;
|
using namespace mozilla::gfx;
|
||||||
|
@ -3736,10 +3739,50 @@ bool nsWindow::DispatchKeyboardEvent(WidgetGUIEvent* event)
|
||||||
return ConvertStatus(status);
|
return ConvertStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsWindow::DispatchScrollEvent(WidgetGUIEvent* event)
|
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;
|
nsEventStatus status;
|
||||||
DispatchEvent(event, status);
|
DispatchEvent(aEvent, status);
|
||||||
return ConvertStatus(status);
|
return ConvertStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7672,6 +7715,19 @@ void nsWindow::PickerClosed()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CompositorParent* nsWindow::NewCompositorParent(int aSurfaceWidth,
|
||||||
|
int aSurfaceHeight)
|
||||||
|
{
|
||||||
|
CompositorParent *compositor = new CompositorParent(this, false, aSurfaceWidth, aSurfaceHeight);
|
||||||
|
|
||||||
|
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||||
|
mAPZC = CompositorParent::GetAPZCTreeManager(compositor->RootLayerTreeId());
|
||||||
|
APZCTreeManager::SetDPI(GetDPI());
|
||||||
|
}
|
||||||
|
|
||||||
|
return compositor;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
**************************************************************
|
**************************************************************
|
||||||
**
|
**
|
||||||
|
|
|
@ -40,10 +40,9 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "nsUXThemeData.h"
|
#include "nsUXThemeData.h"
|
||||||
|
|
||||||
#include "nsIDOMMouseEvent.h"
|
#include "nsIDOMMouseEvent.h"
|
||||||
|
|
||||||
#include "nsIIdleServiceInternal.h"
|
#include "nsIIdleServiceInternal.h"
|
||||||
|
#include "mozilla/layers/APZCTreeManager.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forward class definitions
|
* Forward class definitions
|
||||||
|
@ -75,6 +74,8 @@ class nsWindow : public nsWindowBase
|
||||||
typedef mozilla::widget::TaskbarWindowPreview TaskbarWindowPreview;
|
typedef mozilla::widget::TaskbarWindowPreview TaskbarWindowPreview;
|
||||||
typedef mozilla::widget::NativeKey NativeKey;
|
typedef mozilla::widget::NativeKey NativeKey;
|
||||||
typedef mozilla::widget::MSGResult MSGResult;
|
typedef mozilla::widget::MSGResult MSGResult;
|
||||||
|
typedef mozilla::layers::APZCTreeManager APZCTreeManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
nsWindow();
|
nsWindow();
|
||||||
|
|
||||||
|
@ -90,6 +91,7 @@ public:
|
||||||
virtual bool DispatchScrollEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE;
|
virtual bool DispatchScrollEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE;
|
||||||
virtual nsWindowBase* GetParentWindowBase(bool aIncludeOwner) MOZ_OVERRIDE;
|
virtual nsWindowBase* GetParentWindowBase(bool aIncludeOwner) MOZ_OVERRIDE;
|
||||||
virtual bool IsTopLevelWidget() MOZ_OVERRIDE { return mIsTopWidgetWindow; }
|
virtual bool IsTopLevelWidget() MOZ_OVERRIDE { return mIsTopWidgetWindow; }
|
||||||
|
virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight) MOZ_OVERRIDE;
|
||||||
|
|
||||||
// nsIWidget interface
|
// nsIWidget interface
|
||||||
NS_IMETHOD Create(nsIWidget *aParent,
|
NS_IMETHOD Create(nsIWidget *aParent,
|
||||||
|
@ -390,6 +392,8 @@ protected:
|
||||||
void OnWindowPosChanging(LPWINDOWPOS& info);
|
void OnWindowPosChanging(LPWINDOWPOS& info);
|
||||||
void OnSysColorChanged();
|
void OnSysColorChanged();
|
||||||
|
|
||||||
|
nsEventStatus MaybeDispatchAsyncWheelEvent(mozilla::WidgetGUIEvent* aEvent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function that registers when the user has been active (used for detecting
|
* Function that registers when the user has been active (used for detecting
|
||||||
* when the user is idle).
|
* when the user is idle).
|
||||||
|
@ -591,6 +595,8 @@ protected:
|
||||||
|
|
||||||
static bool sNeedsToInitMouseWheelSettings;
|
static bool sNeedsToInitMouseWheelSettings;
|
||||||
static void InitMouseWheelScrollData();
|
static void InitMouseWheelScrollData();
|
||||||
|
|
||||||
|
nsRefPtr<APZCTreeManager> mAPZC;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Загрузка…
Ссылка в новой задаче