Bug 1016035 - Add nsIWidget::ReportSwipeStart and call it after processing wheel events that can trigger swipes. r=kats

This commit is contained in:
Markus Stange 2015-08-28 01:10:48 -04:00
parent 4c1887821a
commit fb05d46806
6 changed files with 34 additions and 2 deletions

View File

@ -475,6 +475,13 @@ parent:
UpdateZoomConstraints(uint32_t aPresShellId, ViewID aViewId,
MaybeZoomConstraints aConstraints);
/**
* Tells the containing widget whether the given input block results in a
* swipe. Should be called in response to a WidgetWheelEvent that has
* mFlags.mCanTriggerSwipe set on it.
*/
RespondStartSwipeEvent(uint64_t aInputBlockId, bool aStartSwipe);
/**
* Brings up the auth prompt dialog.
* Called when this is the PBrowserParent for a nested remote iframe.

View File

@ -1958,6 +1958,9 @@ TabChild::RecvMouseWheelEvent(const WidgetWheelEvent& aEvent,
APZCCallbackHelper::DispatchWidgetEvent(event);
if (aEvent.mFlags.mHandledByAPZ) {
if (event.mCanTriggerSwipe) {
SendRespondStartSwipeEvent(aInputBlockId, event.TriggersSwipe());
}
mAPZEventState->ProcessWheelEvent(event, aGuid, aInputBlockId);
}
return true;

View File

@ -2851,6 +2851,16 @@ TabParent::RecvUpdateZoomConstraints(const uint32_t& aPresShellId,
return true;
}
bool
TabParent::RecvRespondStartSwipeEvent(const uint64_t& aInputBlockId,
const bool& aStartSwipe)
{
if (nsCOMPtr<nsIWidget> widget = GetWidget()) {
widget->ReportSwipeStarted(aInputBlockId, aStartSwipe);
}
return true;
}
bool
TabParent::RecvContentReceivedInputBlock(const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId,

View File

@ -229,6 +229,8 @@ public:
virtual bool RecvUpdateZoomConstraints(const uint32_t& aPresShellId,
const ViewID& aViewId,
const MaybeZoomConstraints& aConstraints) override;
virtual bool RecvRespondStartSwipeEvent(const uint64_t& aInputBlockId,
const bool& aStartSwipe) override;
virtual bool RecvContentReceivedInputBlock(const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId,
const bool& aPreventDefault) override;

View File

@ -1003,6 +1003,9 @@ nsBaseWidget::ProcessUntransformedAPZEvent(WidgetInputEvent* aEvent,
if (wheelEvent->mFlags.mHandledByAPZ) {
APZCCallbackHelper::SendSetTargetAPZCNotification(this, GetDocument(), *aEvent,
aGuid, aInputBlockId);
if (wheelEvent->mCanTriggerSwipe) {
ReportSwipeStarted(aInputBlockId, wheelEvent->TriggersSwipe());
}
mAPZEventState->ProcessWheelEvent(*wheelEvent, aGuid, aInputBlockId);
}
}

View File

@ -122,8 +122,8 @@ typedef void* nsNativeWidget;
#endif
#define NS_IWIDGET_IID \
{ 0x483BF75C, 0xF909, 0x45C3, \
{ 0x95, 0xBE, 0x41, 0x89, 0xDB, 0xCE, 0x2E, 0x13 } };
{ 0x7b736a0c, 0x2262, 0x4f37, \
{ 0xbd, 0xed, 0xe5, 0x60, 0x88, 0x1c, 0x36, 0xdd } }
/*
* Window shadow styles
@ -1285,6 +1285,13 @@ class nsIWidget : public nsISupports {
*/
virtual void UpdateWindowDraggingRegion(const nsIntRegion& aRegion) {}
/**
* Tells the widget whether the given input block results in a swipe.
* Should be called in response to a WidgetWheelEvent that has
* mFlags.mCanTriggerSwipe set on it.
*/
virtual void ReportSwipeStarted(uint64_t aInputBlockId, bool aStartSwipe) {}
/**
* Internal methods
*/