Bug 1221913 - Make swiping work correctly in e10s mode even if APZ is off. r=kats

This commit is contained in:
Markus Stange 2015-11-27 17:33:50 +01:00
parent 4fbf6b0b4f
commit 99251d4098
3 changed files with 34 additions and 10 deletions

View File

@ -1808,10 +1808,11 @@ TabChild::RecvMouseWheelEvent(const WidgetWheelEvent& aEvent,
event.widget = mPuppetWidget;
APZCCallbackHelper::DispatchWidgetEvent(event);
if (event.mCanTriggerSwipe) {
SendRespondStartSwipeEvent(aInputBlockId, event.TriggersSwipe());
}
if (aEvent.mFlags.mHandledByAPZ) {
if (event.mCanTriggerSwipe) {
SendRespondStartSwipeEvent(aInputBlockId, event.TriggersSwipe());
}
mAPZEventState->ProcessWheelEvent(event, aGuid, aInputBlockId);
}
return true;

View File

@ -2694,6 +2694,12 @@ TabParent::ApzAwareEventRoutingToChild(ScrollableLayerGuid* aOutTargetGuid,
uint64_t* aOutInputBlockId,
nsEventStatus* aOutApzResponse)
{
// Let the widget know that the event will be sent to the child process,
// which will (hopefully) send a confirmation notice back to APZ.
// Do this even if APZ is off since we need it for swipe gesture support on
// OS X without APZ.
InputAPZContext::SetRoutedToChildProcess();
if (AsyncPanZoomEnabled()) {
if (aOutTargetGuid) {
*aOutTargetGuid = InputAPZContext::GetTargetLayerGuid();
@ -2715,10 +2721,6 @@ TabParent::ApzAwareEventRoutingToChild(ScrollableLayerGuid* aOutTargetGuid,
if (aOutApzResponse) {
*aOutApzResponse = InputAPZContext::GetApzResponse();
}
// Let the widget know that the event will be sent to the child process,
// which will (hopefully) send a confirmation notice back to APZ.
InputAPZContext::SetRoutedToChildProcess();
} else {
if (aOutInputBlockId) {
*aOutInputBlockId = 0;

View File

@ -65,6 +65,7 @@
#include "mozilla/layers/CompositorOGL.h"
#include "mozilla/layers/CompositorParent.h"
#include "mozilla/layers/BasicCompositor.h"
#include "mozilla/layers/InputAPZContext.h"
#include "gfxUtils.h"
#include "gfxPrefs.h"
#include "mozilla/gfx/2D.h"
@ -2616,6 +2617,10 @@ nsChildView::TrackScrollEventAsSwipe(const mozilla::PanGestureInput& aSwipeStart
mSwipeTracker = new SwipeTracker(*this, aSwipeStartEvent,
aAllowedDirections, direction);
if (!mAPZC) {
mCurrentPanGestureBelongsToSwipe = true;
}
}
void
@ -2826,11 +2831,27 @@ nsChildView::DispatchAPZWheelInputEvent(InputData& aEvent, bool aCanTriggerSwipe
event = panInput.ToWidgetWheelEvent(this);
if (aCanTriggerSwipe) {
SwipeInfo swipeInfo = SendMayStartSwipe(panInput);
// We're in the non-APZ case here, but we still want to know whether
// the event was routed to a child process, so we use InputAPZContext
// to get that piece of information.
ScrollableLayerGuid guid;
InputAPZContext context(guid, 0, nsEventStatus_eIgnore);
event.mCanTriggerSwipe = swipeInfo.wantsSwipe;
DispatchEvent(&event, status);
if (event.TriggersSwipe()) {
TrackScrollEventAsSwipe(panInput, swipeInfo.allowedDirections);
mCurrentPanGestureBelongsToSwipe = true;
if (swipeInfo.wantsSwipe) {
if (context.WasRoutedToChildProcess()) {
// We don't know whether this event can start a swipe, so we need
// to queue up events and wait for a call to ReportSwipeStarted.
mSwipeEventQueue = MakeUnique<SwipeEventQueue>(swipeInfo.allowedDirections, 0);
} else if (event.TriggersSwipe()) {
TrackScrollEventAsSwipe(panInput, swipeInfo.allowedDirections);
}
}
if (mSwipeEventQueue && mSwipeEventQueue->inputBlockId == 0) {
mSwipeEventQueue->queuedEvents.AppendElement(panInput);
}
return;
}