зеркало из https://github.com/mozilla/gecko-dev.git
Add APZ support for test.mousescroll callbacks. (bug 1142866 part 3, r=kats)
This commit is contained in:
Родитель
302fa4036d
Коммит
fba0c47c1f
|
@ -571,6 +571,11 @@ child:
|
|||
int32_t aModifiers,
|
||||
bool aPreventDefault);
|
||||
|
||||
/**
|
||||
* APZ notification for mouse scroll testing events.
|
||||
*/
|
||||
MouseScrollTestEvent(ViewID aScrollId, nsString aEvent);
|
||||
|
||||
CompositionEvent(WidgetCompositionEvent event);
|
||||
|
||||
SelectionEvent(WidgetSelectionEvent event);
|
||||
|
|
|
@ -2199,6 +2199,13 @@ TabChild::RecvMouseWheelEvent(const WidgetWheelEvent& aEvent,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvMouseScrollTestEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent)
|
||||
{
|
||||
APZCCallbackHelper::NotifyMozMouseScrollEvent(aScrollId, aEvent);
|
||||
return true;
|
||||
}
|
||||
|
||||
static Touch*
|
||||
GetTouchForIdentifier(const WidgetTouchEvent& aEvent, int32_t aId)
|
||||
{
|
||||
|
|
|
@ -365,6 +365,8 @@ public:
|
|||
const int32_t& aCharCode,
|
||||
const int32_t& aModifiers,
|
||||
const bool& aPreventDefault) override;
|
||||
virtual bool RecvMouseScrollTestEvent(const FrameMetrics::ViewID& aScrollId,
|
||||
const nsString& aEvent) override;
|
||||
virtual bool RecvCompositionEvent(const mozilla::WidgetCompositionEvent& event) override;
|
||||
virtual bool RecvSelectionEvent(const mozilla::WidgetSelectionEvent& event) override;
|
||||
virtual bool RecvActivateFrameEvent(const nsString& aType, const bool& capture) override;
|
||||
|
|
|
@ -973,6 +973,14 @@ void TabParent::NotifyAPZStateChange(ViewID aViewId,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::NotifyMouseScrollTestEvent(const ViewID& aScrollId, const nsString& aEvent)
|
||||
{
|
||||
if (!mIsDestroyed) {
|
||||
unused << SendMouseScrollTestEvent(aScrollId, aEvent);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
TabParent::Activate()
|
||||
{
|
||||
|
|
|
@ -242,6 +242,7 @@ public:
|
|||
void NotifyAPZStateChange(ViewID aViewId,
|
||||
APZStateChange aChange,
|
||||
int aArg);
|
||||
void NotifyMouseScrollTestEvent(const ViewID& aScrollId, const nsString& aEvent);
|
||||
void Activate();
|
||||
void Deactivate();
|
||||
|
||||
|
|
|
@ -141,7 +141,6 @@ public:
|
|||
EndTouch,
|
||||
APZStateChangeSentinel
|
||||
};
|
||||
|
||||
/**
|
||||
* General notices of APZ state changes for consumers.
|
||||
* |aGuid| identifies the APZC originating the state change.
|
||||
|
@ -153,6 +152,12 @@ public:
|
|||
APZStateChange aChange,
|
||||
int aArg = 0) {}
|
||||
|
||||
/**
|
||||
* Notify content of a MozMouseScrollFailed event.
|
||||
*/
|
||||
virtual void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent)
|
||||
{}
|
||||
|
||||
GeckoContentController() {}
|
||||
virtual void Destroy() {}
|
||||
|
||||
|
|
|
@ -1476,6 +1476,21 @@ nsEventStatus AsyncPanZoomController::OnScrollWheel(const ScrollWheelInput& aEve
|
|||
double deltaX, deltaY;
|
||||
GetScrollWheelDelta(aEvent, deltaX, deltaY);
|
||||
|
||||
if ((deltaX || deltaY) &&
|
||||
!CanScroll(deltaX, deltaY) &&
|
||||
mInputQueue->GetCurrentWheelTransaction())
|
||||
{
|
||||
// We can't scroll this apz anymore, so we simply drop the event.
|
||||
if (gfxPrefs::MouseScrollTestingEnabled()) {
|
||||
if (nsRefPtr<GeckoContentController> controller = GetGeckoContentController()) {
|
||||
controller->NotifyMozMouseScrollEvent(
|
||||
mFrameMetrics.GetScrollId(),
|
||||
NS_LITERAL_STRING("MozMouseScrollFailed"));
|
||||
}
|
||||
}
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
switch (aEvent.mScrollMode) {
|
||||
case ScrollWheelInput::SCROLLMODE_INSTANT: {
|
||||
// Decompose into pan events for simplicity.
|
||||
|
@ -1526,6 +1541,17 @@ nsEventStatus AsyncPanZoomController::OnScrollWheel(const ScrollWheelInput& aEve
|
|||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
void
|
||||
AsyncPanZoomController::NotifyMozMouseScrollEvent(const nsString& aString) const
|
||||
{
|
||||
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
|
||||
if (!controller) {
|
||||
return;
|
||||
}
|
||||
|
||||
controller->NotifyMozMouseScrollEvent(mFrameMetrics.GetScrollId(), aString);
|
||||
}
|
||||
|
||||
nsEventStatus AsyncPanZoomController::OnPanMayBegin(const PanGestureInput& aEvent) {
|
||||
APZC_LOG("%p got a pan-maybegin in state %d\n", this, mState);
|
||||
|
||||
|
|
|
@ -369,6 +369,8 @@ public:
|
|||
// direction.
|
||||
bool CanScroll(double aDeltaX, double aDeltaY) const;
|
||||
|
||||
void NotifyMozMouseScrollEvent(const nsString& aString) const;
|
||||
|
||||
protected:
|
||||
// Protected destructor, to discourage deletion outside of Release():
|
||||
~AsyncPanZoomController();
|
||||
|
|
|
@ -305,6 +305,11 @@ WheelBlockState::MaybeTimeout(const TimeStamp& aTimeStamp)
|
|||
|
||||
TBS_LOG("%p wheel transaction timed out\n", this);
|
||||
|
||||
if (gfxPrefs::MouseScrollTestingEnabled()) {
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetApzc();
|
||||
apzc->NotifyMozMouseScrollEvent(NS_LITERAL_STRING("MozMouseScrollTransactionTimeout"));
|
||||
}
|
||||
|
||||
EndTransaction();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -170,7 +170,6 @@ InputQueue::ReceiveScrollWheelInput(const nsRefPtr<AsyncPanZoomController>& aTar
|
|||
}
|
||||
}
|
||||
|
||||
// If we have a block, it should be in a wheel transaction.
|
||||
MOZ_ASSERT(!block || block->InTransaction());
|
||||
|
||||
if (!block) {
|
||||
|
|
|
@ -666,6 +666,24 @@ APZCCallbackHelper::SendSetAllowedTouchBehaviorNotification(
|
|||
aCallback->Run(aInputBlockId, flags);
|
||||
}
|
||||
|
||||
void
|
||||
APZCCallbackHelper::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent)
|
||||
{
|
||||
nsCOMPtr<nsIContent> targetContent = nsLayoutUtils::FindContentFor(aScrollId);
|
||||
if (!targetContent) {
|
||||
return;
|
||||
}
|
||||
nsCOMPtr<nsIDocument> ownerDoc = targetContent->OwnerDoc();
|
||||
if (!ownerDoc) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsContentUtils::DispatchTrustedEvent(
|
||||
ownerDoc, targetContent,
|
||||
aEvent,
|
||||
true, true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -181,6 +181,9 @@ public:
|
|||
const WidgetTouchEvent& aEvent,
|
||||
uint64_t aInputBlockId,
|
||||
const nsRefPtr<SetAllowedTouchBehaviorCallback>& aCallback);
|
||||
|
||||
/* Notify content of a mouse scroll testing event. */
|
||||
static void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -199,4 +199,15 @@ ChromeProcessController::NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
|||
mAPZEventState->ProcessAPZStateChange(GetDocument(), aGuid.mScrollId, aChange, aArg);
|
||||
}
|
||||
|
||||
void
|
||||
ChromeProcessController::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent)
|
||||
{
|
||||
if (MessageLoop::current() != mUILoop) {
|
||||
mUILoop->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &ChromeProcessController::NotifyMozMouseScrollEvent, aScrollId, aEvent));
|
||||
return;
|
||||
}
|
||||
|
||||
APZCCallbackHelper::NotifyMozMouseScrollEvent(aScrollId, aEvent);
|
||||
}
|
||||
|
|
|
@ -55,6 +55,8 @@ public:
|
|||
virtual void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
|
||||
APZStateChange aChange,
|
||||
int aArg) override;
|
||||
virtual void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId,
|
||||
const nsString& aEvent) override;
|
||||
private:
|
||||
nsCOMPtr<nsIWidget> mWidget;
|
||||
nsRefPtr<APZEventState> mAPZEventState;
|
||||
|
|
|
@ -339,7 +339,7 @@ private:
|
|||
MouseWheelHasScrollDeltaOverride, bool, false);
|
||||
DECL_GFX_PREF(Live, "mousewheel.transaction.ignoremovedelay",MouseWheelIgnoreMoveDelayMs, int32_t, (int32_t)100);
|
||||
DECL_GFX_PREF(Live, "mousewheel.transaction.timeout", MouseWheelTransactionTimeoutMs, int32_t, (int32_t)1500);
|
||||
|
||||
DECL_GFX_PREF(Live, "test.mousescroll", MouseScrollTestingEnabled, bool, false);
|
||||
|
||||
DECL_GFX_PREF(Live, "nglayout.debug.widget_update_flashing", WidgetUpdateFlashing, bool, false);
|
||||
DECL_GFX_PREF(Live, "ui.click_hold_context_menus.delay", UiClickHoldContextMenusDelay, int32_t, 500);
|
||||
|
|
|
@ -256,6 +256,20 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent) override {
|
||||
if (MessageLoop::current() != mUILoop) {
|
||||
mUILoop->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &RemoteContentController::NotifyMozMouseScrollEvent, aScrollId, aEvent));
|
||||
return;
|
||||
}
|
||||
|
||||
if (mRenderFrame) {
|
||||
TabParent* browser = TabParent::GetFrom(mRenderFrame->Manager());
|
||||
browser->NotifyMouseScrollTestEvent(aScrollId, aEvent);
|
||||
}
|
||||
}
|
||||
|
||||
// Methods used by RenderFrameParent to set fields stored here.
|
||||
|
||||
void SaveZoomConstraints(const ZoomConstraints& aConstraints)
|
||||
|
|
Загрузка…
Ссылка в новой задаче