mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 998025 - Ignore touch events when in an overscrolled state. r=kats
--HG-- extra : rebase_source : c7b6928915d589773aa536cf002c70c9e26fd371
This commit is contained in:
parent
98eba5d681
commit
c205d40a5c
@ -722,8 +722,9 @@ bool TabParent::SendRealMouseEvent(WidgetMouseEvent& event)
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
MaybeForwardEventToRenderFrame(event, nullptr);
|
||||
if (!MapEventCoordinatesForChildProcess(&event)) {
|
||||
nsEventStatus status = MaybeForwardEventToRenderFrame(event, nullptr);
|
||||
if (status == nsEventStatus_eConsumeNoDefault ||
|
||||
!MapEventCoordinatesForChildProcess(&event)) {
|
||||
return false;
|
||||
}
|
||||
return PBrowserParent::SendRealMouseEvent(event);
|
||||
@ -789,8 +790,9 @@ bool TabParent::SendMouseWheelEvent(WidgetWheelEvent& event)
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
MaybeForwardEventToRenderFrame(event, nullptr);
|
||||
if (!MapEventCoordinatesForChildProcess(&event)) {
|
||||
nsEventStatus status = MaybeForwardEventToRenderFrame(event, nullptr);
|
||||
if (status == nsEventStatus_eConsumeNoDefault ||
|
||||
!MapEventCoordinatesForChildProcess(&event)) {
|
||||
return false;
|
||||
}
|
||||
return PBrowserParent::SendMouseWheelEvent(event);
|
||||
@ -910,9 +912,9 @@ bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
|
||||
}
|
||||
|
||||
ScrollableLayerGuid guid;
|
||||
MaybeForwardEventToRenderFrame(event, &guid);
|
||||
nsEventStatus status = MaybeForwardEventToRenderFrame(event, &guid);
|
||||
|
||||
if (mIsDestroyed) {
|
||||
if (status == nsEventStatus_eConsumeNoDefault || mIsDestroyed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1889,13 +1891,14 @@ TabParent::UseAsyncPanZoom()
|
||||
GetScrollingBehavior() == ASYNC_PAN_ZOOM);
|
||||
}
|
||||
|
||||
void
|
||||
nsEventStatus
|
||||
TabParent::MaybeForwardEventToRenderFrame(WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid)
|
||||
{
|
||||
if (RenderFrameParent* rfp = GetRenderFrame()) {
|
||||
rfp->NotifyInputEvent(aEvent, aOutTargetGuid);
|
||||
return rfp->NotifyInputEvent(aEvent, aOutTargetGuid);
|
||||
}
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -381,8 +381,8 @@ private:
|
||||
// |aOutTargetGuid| will contain the identifier
|
||||
// of the APZC instance that handled the event. aOutTargetGuid may be
|
||||
// null.
|
||||
void MaybeForwardEventToRenderFrame(WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid);
|
||||
nsEventStatus MaybeForwardEventToRenderFrame(WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid);
|
||||
// The offset for the child process which is sampled at touch start. This
|
||||
// means that the touch events are relative to where the frame was at the
|
||||
// start of the touch. We need to look for a better solution to this
|
||||
|
@ -38,6 +38,7 @@ static bool gPrintApzcTree = false;
|
||||
|
||||
APZCTreeManager::APZCTreeManager()
|
||||
: mTreeLock("APZCTreeLock"),
|
||||
mInOverscrolledApzc(false),
|
||||
mTouchCount(0),
|
||||
mApzcTreeLog("apzctree")
|
||||
{
|
||||
@ -66,7 +67,7 @@ APZCTreeManager::GetAllowedTouchBehavior(WidgetInputEvent* aEvent,
|
||||
spt.x = touchEvent->touches[i]->mRefPoint.x;
|
||||
spt.y = touchEvent->touches[i]->mRefPoint.y;
|
||||
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(spt);
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(spt, nullptr);
|
||||
aOutValues.AppendElement(apzc
|
||||
? apzc->GetAllowedTouchBehavior(spt)
|
||||
: AllowedTouchBehavior::UNKNOWN);
|
||||
@ -378,14 +379,17 @@ APZCTreeManager::ReceiveInputEvent(const InputData& aEvent,
|
||||
// MULTITOUCH_START input contains all active touches of the current
|
||||
// session thus resetting mTouchCount.
|
||||
mTouchCount = multiTouchInput.mTouches.Length();
|
||||
mApzcForInputBlock = GetTargetAPZC(ScreenPoint(multiTouchInput.mTouches[0].mScreenPoint));
|
||||
mInOverscrolledApzc = false;
|
||||
mApzcForInputBlock = GetTargetAPZC(ScreenPoint(multiTouchInput.mTouches[0].mScreenPoint),
|
||||
&mInOverscrolledApzc);
|
||||
if (multiTouchInput.mTouches.Length() == 1) {
|
||||
// If we have one touch point, this might be the start of a pan.
|
||||
// Prepare for possible overscroll handoff.
|
||||
BuildOverscrollHandoffChain(mApzcForInputBlock);
|
||||
}
|
||||
for (size_t i = 1; i < multiTouchInput.mTouches.Length(); i++) {
|
||||
nsRefPtr<AsyncPanZoomController> apzc2 = GetTargetAPZC(ScreenPoint(multiTouchInput.mTouches[i].mScreenPoint));
|
||||
nsRefPtr<AsyncPanZoomController> apzc2 = GetTargetAPZC(ScreenPoint(multiTouchInput.mTouches[i].mScreenPoint),
|
||||
&mInOverscrolledApzc);
|
||||
mApzcForInputBlock = CommonAncestor(mApzcForInputBlock.get(), apzc2.get());
|
||||
APZC_LOG("Using APZC %p as the common ancestor\n", mApzcForInputBlock.get());
|
||||
// For now, we only ever want to do pinching on the root APZC for a given layers id. So
|
||||
@ -415,8 +419,11 @@ APZCTreeManager::ReceiveInputEvent(const InputData& aEvent,
|
||||
for (size_t i = 0; i < inputForApzc.mTouches.Length(); i++) {
|
||||
ApplyTransform(&(inputForApzc.mTouches[i].mScreenPoint), transformToApzc);
|
||||
}
|
||||
result = mApzcForInputBlock->ReceiveInputEvent(inputForApzc);
|
||||
mApzcForInputBlock->ReceiveInputEvent(inputForApzc);
|
||||
}
|
||||
result = mInOverscrolledApzc ? nsEventStatus_eConsumeNoDefault
|
||||
: mApzcForInputBlock ? nsEventStatus_eConsumeDoDefault
|
||||
: nsEventStatus_eIgnore;
|
||||
if (multiTouchInput.mType == MultiTouchInput::MULTITOUCH_CANCEL ||
|
||||
multiTouchInput.mType == MultiTouchInput::MULTITOUCH_END) {
|
||||
if (mTouchCount >= multiTouchInput.mTouches.Length()) {
|
||||
@ -430,31 +437,42 @@ APZCTreeManager::ReceiveInputEvent(const InputData& aEvent,
|
||||
// then null it out so we don't keep a dangling reference and leak things.
|
||||
if (mTouchCount == 0) {
|
||||
mApzcForInputBlock = nullptr;
|
||||
mInOverscrolledApzc = false;
|
||||
ClearOverscrollHandoffChain();
|
||||
}
|
||||
}
|
||||
break;
|
||||
} case PINCHGESTURE_INPUT: {
|
||||
const PinchGestureInput& pinchInput = aEvent.AsPinchGestureInput();
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(pinchInput.mFocusPoint);
|
||||
bool inOverscrolledApzc = false;
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(pinchInput.mFocusPoint,
|
||||
&inOverscrolledApzc);
|
||||
if (apzc) {
|
||||
apzc->GetGuid(aOutTargetGuid);
|
||||
GetInputTransforms(apzc, transformToApzc, transformToGecko);
|
||||
PinchGestureInput inputForApzc(pinchInput);
|
||||
ApplyTransform(&(inputForApzc.mFocusPoint), transformToApzc);
|
||||
result = apzc->ReceiveInputEvent(inputForApzc);
|
||||
apzc->ReceiveInputEvent(inputForApzc);
|
||||
}
|
||||
result = inOverscrolledApzc ? nsEventStatus_eConsumeNoDefault
|
||||
: apzc ? nsEventStatus_eConsumeDoDefault
|
||||
: nsEventStatus_eIgnore;
|
||||
break;
|
||||
} case TAPGESTURE_INPUT: {
|
||||
const TapGestureInput& tapInput = aEvent.AsTapGestureInput();
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(ScreenPoint(tapInput.mPoint));
|
||||
bool inOverscrolledApzc = false;
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(ScreenPoint(tapInput.mPoint),
|
||||
&inOverscrolledApzc);
|
||||
if (apzc) {
|
||||
apzc->GetGuid(aOutTargetGuid);
|
||||
GetInputTransforms(apzc, transformToApzc, transformToGecko);
|
||||
TapGestureInput inputForApzc(tapInput);
|
||||
ApplyTransform(&(inputForApzc.mPoint), transformToApzc);
|
||||
result = apzc->ReceiveInputEvent(inputForApzc);
|
||||
apzc->ReceiveInputEvent(inputForApzc);
|
||||
}
|
||||
result = inOverscrolledApzc ? nsEventStatus_eConsumeNoDefault
|
||||
: apzc ? nsEventStatus_eConsumeDoDefault
|
||||
: nsEventStatus_eIgnore;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -462,10 +480,12 @@ APZCTreeManager::ReceiveInputEvent(const InputData& aEvent,
|
||||
}
|
||||
|
||||
already_AddRefed<AsyncPanZoomController>
|
||||
APZCTreeManager::GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent)
|
||||
APZCTreeManager::GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent,
|
||||
bool* aOutInOverscrolledApzc)
|
||||
{
|
||||
ScreenPoint point = ScreenPoint(aEvent.touches[0]->mRefPoint.x, aEvent.touches[0]->mRefPoint.y);
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(point);
|
||||
// Ignore events if any touch hits inside an overscrolled apzc.
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(point, aOutInOverscrolledApzc);
|
||||
if (aEvent.touches.Length() == 1) {
|
||||
// If we have one touch point, this might be the start of a pan.
|
||||
// Prepare for possible overscroll handoff.
|
||||
@ -473,7 +493,7 @@ APZCTreeManager::GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent)
|
||||
}
|
||||
for (size_t i = 1; i < aEvent.touches.Length(); i++) {
|
||||
point = ScreenPoint(aEvent.touches[i]->mRefPoint.x, aEvent.touches[i]->mRefPoint.y);
|
||||
nsRefPtr<AsyncPanZoomController> apzc2 = GetTargetAPZC(point);
|
||||
nsRefPtr<AsyncPanZoomController> apzc2 = GetTargetAPZC(point, aOutInOverscrolledApzc);
|
||||
apzc = CommonAncestor(apzc.get(), apzc2.get());
|
||||
APZC_LOG("Using APZC %p as the common ancestor\n", apzc.get());
|
||||
// For now, we only ever want to do pinching on the root APZC for a given layers id. So
|
||||
@ -490,15 +510,15 @@ APZCTreeManager::ProcessTouchEvent(WidgetTouchEvent& aEvent,
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsEventStatus ret = nsEventStatus_eIgnore;
|
||||
if (!aEvent.touches.Length()) {
|
||||
return ret;
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
if (aEvent.message == NS_TOUCH_START) {
|
||||
// NS_TOUCH_START event contains all active touches of the current
|
||||
// session thus resetting mTouchCount.
|
||||
mTouchCount = aEvent.touches.Length();
|
||||
mApzcForInputBlock = GetTouchInputBlockAPZC(aEvent);
|
||||
mInOverscrolledApzc = false;
|
||||
mApzcForInputBlock = GetTouchInputBlockAPZC(aEvent, &mInOverscrolledApzc);
|
||||
if (mApzcForInputBlock) {
|
||||
// Cache apz transform so it can be used for future events in this block.
|
||||
gfx3DMatrix transformToGecko;
|
||||
@ -519,7 +539,7 @@ APZCTreeManager::ProcessTouchEvent(WidgetTouchEvent& aEvent,
|
||||
for (size_t i = 0; i < inputForApzc.mTouches.Length(); i++) {
|
||||
ApplyTransform(&(inputForApzc.mTouches[i].mScreenPoint), transformToApzc);
|
||||
}
|
||||
ret = mApzcForInputBlock->ReceiveInputEvent(inputForApzc);
|
||||
mApzcForInputBlock->ReceiveInputEvent(inputForApzc);
|
||||
|
||||
// For computing the event to pass back to Gecko, use the up-to-date transforms.
|
||||
// This ensures that transformToApzc and transformToGecko are in sync
|
||||
@ -531,6 +551,9 @@ APZCTreeManager::ProcessTouchEvent(WidgetTouchEvent& aEvent,
|
||||
ApplyTransform(&(aEvent.touches[i]->mRefPoint), outTransform);
|
||||
}
|
||||
}
|
||||
nsEventStatus result = mInOverscrolledApzc ? nsEventStatus_eConsumeNoDefault
|
||||
: mApzcForInputBlock ? nsEventStatus_eConsumeDoDefault
|
||||
: nsEventStatus_eIgnore;
|
||||
// If we have an mApzcForInputBlock and it's the end of the touch sequence
|
||||
// then null it out so we don't keep a dangling reference and leak things.
|
||||
if (aEvent.message == NS_TOUCH_CANCEL ||
|
||||
@ -544,10 +567,11 @@ APZCTreeManager::ProcessTouchEvent(WidgetTouchEvent& aEvent,
|
||||
}
|
||||
if (mTouchCount == 0) {
|
||||
mApzcForInputBlock = nullptr;
|
||||
mInOverscrolledApzc = false;
|
||||
ClearOverscrollHandoffChain();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
@ -555,7 +579,7 @@ APZCTreeManager::TransformCoordinateToGecko(const ScreenIntPoint& aPoint,
|
||||
LayoutDeviceIntPoint* aOutTransformedPoint)
|
||||
{
|
||||
MOZ_ASSERT(aOutTransformedPoint);
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aPoint);
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aPoint, nullptr);
|
||||
if (apzc && aOutTransformedPoint) {
|
||||
gfx3DMatrix transformToApzc;
|
||||
gfx3DMatrix transformToGecko;
|
||||
@ -573,18 +597,22 @@ APZCTreeManager::ProcessEvent(WidgetInputEvent& aEvent,
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Transform the refPoint
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(ScreenPoint(aEvent.refPoint.x, aEvent.refPoint.y));
|
||||
if (!apzc) {
|
||||
return nsEventStatus_eIgnore;
|
||||
// Transform the refPoint.
|
||||
// If the event hits an overscrolled APZC, instruct the caller to ignore it.
|
||||
bool inOverscrolledApzc = false;
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(ScreenPoint(aEvent.refPoint.x, aEvent.refPoint.y),
|
||||
&inOverscrolledApzc);
|
||||
if (apzc) {
|
||||
apzc->GetGuid(aOutTargetGuid);
|
||||
gfx3DMatrix transformToApzc;
|
||||
gfx3DMatrix transformToGecko;
|
||||
GetInputTransforms(apzc, transformToApzc, transformToGecko);
|
||||
gfx3DMatrix outTransform = transformToApzc * transformToGecko;
|
||||
ApplyTransform(&(aEvent.refPoint), outTransform);
|
||||
}
|
||||
apzc->GetGuid(aOutTargetGuid);
|
||||
gfx3DMatrix transformToApzc;
|
||||
gfx3DMatrix transformToGecko;
|
||||
GetInputTransforms(apzc, transformToApzc, transformToGecko);
|
||||
gfx3DMatrix outTransform = transformToApzc * transformToGecko;
|
||||
ApplyTransform(&(aEvent.refPoint), outTransform);
|
||||
return nsEventStatus_eIgnore;
|
||||
return inOverscrolledApzc ? nsEventStatus_eConsumeNoDefault
|
||||
: apzc ? nsEventStatus_eConsumeDoDefault
|
||||
: nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
nsEventStatus
|
||||
@ -848,17 +876,8 @@ APZCTreeManager::CanBePanned(AsyncPanZoomController* aApzc)
|
||||
bool
|
||||
APZCTreeManager::HitTestAPZC(const ScreenIntPoint& aPoint)
|
||||
{
|
||||
MonitorAutoLock lock(mTreeLock);
|
||||
nsRefPtr<AsyncPanZoomController> target;
|
||||
// The root may have siblings, so check those too
|
||||
gfxPoint point(aPoint.x, aPoint.y);
|
||||
for (AsyncPanZoomController* apzc = mRootApzc; apzc; apzc = apzc->GetPrevSibling()) {
|
||||
target = GetAPZCAtPoint(apzc, point);
|
||||
if (target) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
nsRefPtr<AsyncPanZoomController> target = GetTargetAPZC(aPoint, nullptr);
|
||||
return target != nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<AsyncPanZoomController>
|
||||
@ -884,14 +903,14 @@ struct CompareByScrollPriority
|
||||
};
|
||||
|
||||
already_AddRefed<AsyncPanZoomController>
|
||||
APZCTreeManager::GetTargetAPZC(const ScreenPoint& aPoint)
|
||||
APZCTreeManager::GetTargetAPZC(const ScreenPoint& aPoint, bool* aOutInOverscrolledApzc)
|
||||
{
|
||||
MonitorAutoLock lock(mTreeLock);
|
||||
nsRefPtr<AsyncPanZoomController> target;
|
||||
// The root may have siblings, so check those too
|
||||
gfxPoint point(aPoint.x, aPoint.y);
|
||||
for (AsyncPanZoomController* apzc = mRootApzc; apzc; apzc = apzc->GetPrevSibling()) {
|
||||
target = GetAPZCAtPoint(apzc, point);
|
||||
target = GetAPZCAtPoint(apzc, point, aOutInOverscrolledApzc);
|
||||
if (target) {
|
||||
break;
|
||||
}
|
||||
@ -1024,7 +1043,9 @@ APZCTreeManager::FindTargetAPZC(AsyncPanZoomController* aApzc, const ScrollableL
|
||||
}
|
||||
|
||||
AsyncPanZoomController*
|
||||
APZCTreeManager::GetAPZCAtPoint(AsyncPanZoomController* aApzc, const gfxPoint& aHitTestPoint)
|
||||
APZCTreeManager::GetAPZCAtPoint(AsyncPanZoomController* aApzc,
|
||||
const gfxPoint& aHitTestPoint,
|
||||
bool* aOutInOverscrolledApzc)
|
||||
{
|
||||
mTreeLock.AssertCurrentThreadOwns();
|
||||
|
||||
@ -1059,20 +1080,33 @@ APZCTreeManager::GetAPZCAtPoint(AsyncPanZoomController* aApzc, const gfxPoint& a
|
||||
aHitTestPoint.x, aHitTestPoint.y,
|
||||
hitTestPointForChildLayers.x, hitTestPointForChildLayers.y, aApzc);
|
||||
|
||||
AsyncPanZoomController* result = nullptr;
|
||||
// This walks the tree in depth-first, reverse order, so that it encounters
|
||||
// APZCs front-to-back on the screen.
|
||||
for (AsyncPanZoomController* child = aApzc->GetLastChild(); child; child = child->GetPrevSibling()) {
|
||||
AsyncPanZoomController* match = GetAPZCAtPoint(child, hitTestPointForChildLayers);
|
||||
AsyncPanZoomController* match = GetAPZCAtPoint(child, hitTestPointForChildLayers, aOutInOverscrolledApzc);
|
||||
if (match) {
|
||||
return match;
|
||||
result = match;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (aApzc->VisibleRegionContains(ViewAs<ParentLayerPixel>(hitTestPointForThisLayer))) {
|
||||
if (!result && aApzc->VisibleRegionContains(ViewAs<ParentLayerPixel>(hitTestPointForThisLayer))) {
|
||||
APZC_LOG("Successfully matched untransformed point %f %f to visible region for APZC %p\n",
|
||||
hitTestPointForThisLayer.x, hitTestPointForThisLayer.y, aApzc);
|
||||
return aApzc;
|
||||
result = aApzc;
|
||||
}
|
||||
return nullptr;
|
||||
|
||||
// If we are overscrolled, and the point matches us or one of our children,
|
||||
// the result is inside an overscrolled APZC, inform our caller of this
|
||||
// (callers typically ignore events targeted at overscrolled APZCs).
|
||||
if (result && aApzc->IsOverscrolled()) {
|
||||
if (aOutInOverscrolledApzc) {
|
||||
*aOutInOverscrolledApzc = true;
|
||||
}
|
||||
result = nullptr;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* This function sets the aTransformToApzcOut and aTransformToGeckoOut out-parameters
|
||||
|
@ -311,19 +311,25 @@ public:
|
||||
used by other production code.
|
||||
*/
|
||||
already_AddRefed<AsyncPanZoomController> GetTargetAPZC(const ScrollableLayerGuid& aGuid);
|
||||
already_AddRefed<AsyncPanZoomController> GetTargetAPZC(const ScreenPoint& aPoint);
|
||||
already_AddRefed<AsyncPanZoomController> GetTargetAPZC(const ScreenPoint& aPoint,
|
||||
bool* aOutInOverscrolledApzc);
|
||||
void GetInputTransforms(AsyncPanZoomController *aApzc, gfx3DMatrix& aTransformToApzcOut,
|
||||
gfx3DMatrix& aTransformToGeckoOut);
|
||||
private:
|
||||
/* Helpers */
|
||||
AsyncPanZoomController* FindTargetAPZC(AsyncPanZoomController* aApzc, FrameMetrics::ViewID aScrollId);
|
||||
AsyncPanZoomController* FindTargetAPZC(AsyncPanZoomController* aApzc, const ScrollableLayerGuid& aGuid);
|
||||
AsyncPanZoomController* GetAPZCAtPoint(AsyncPanZoomController* aApzc, const gfxPoint& aHitTestPoint);
|
||||
AsyncPanZoomController* GetAPZCAtPoint(AsyncPanZoomController* aApzc,
|
||||
const gfxPoint& aHitTestPoint,
|
||||
bool* aOutInOverscrolledApzc);
|
||||
already_AddRefed<AsyncPanZoomController> CommonAncestor(AsyncPanZoomController* aApzc1, AsyncPanZoomController* aApzc2);
|
||||
already_AddRefed<AsyncPanZoomController> RootAPZCForLayersId(AsyncPanZoomController* aApzc);
|
||||
already_AddRefed<AsyncPanZoomController> GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent);
|
||||
nsEventStatus ProcessTouchEvent(WidgetTouchEvent& touchEvent, ScrollableLayerGuid* aOutTargetGuid);
|
||||
nsEventStatus ProcessEvent(WidgetInputEvent& inputEvent, ScrollableLayerGuid* aOutTargetGuid);
|
||||
already_AddRefed<AsyncPanZoomController> GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent,
|
||||
bool* aOutInOverscrolledApzc);
|
||||
nsEventStatus ProcessTouchEvent(WidgetTouchEvent& touchEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid);
|
||||
nsEventStatus ProcessEvent(WidgetInputEvent& inputEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid);
|
||||
void UpdateZoomConstraintsRecursively(AsyncPanZoomController* aApzc,
|
||||
const ZoomConstraints& aConstraints);
|
||||
void ClearOverscrollHandoffChain();
|
||||
@ -363,6 +369,10 @@ private:
|
||||
* input delivery thread, and so does not require locking.
|
||||
*/
|
||||
nsRefPtr<AsyncPanZoomController> mApzcForInputBlock;
|
||||
/* Whether the current input event block is being ignored because the touch-start
|
||||
* was inside an overscrolled APZC.
|
||||
*/
|
||||
bool mInOverscrolledApzc;
|
||||
/* The number of touch points we are tracking that are currently on the screen. */
|
||||
uint32_t mTouchCount;
|
||||
/* The transform from root screen coordinates into mApzcForInputBlock's
|
||||
|
@ -1099,7 +1099,7 @@ static already_AddRefed<AsyncPanZoomController>
|
||||
GetTargetAPZC(APZCTreeManager* manager, const ScreenPoint& aPoint,
|
||||
gfx3DMatrix& aTransformToApzcOut, gfx3DMatrix& aTransformToGeckoOut)
|
||||
{
|
||||
nsRefPtr<AsyncPanZoomController> hit = manager->GetTargetAPZC(aPoint);
|
||||
nsRefPtr<AsyncPanZoomController> hit = manager->GetTargetAPZC(aPoint, nullptr);
|
||||
if (hit) {
|
||||
manager->GetInputTransforms(hit.get(), aTransformToApzcOut, aTransformToGeckoOut);
|
||||
}
|
||||
|
@ -931,13 +931,14 @@ RenderFrameParent::OwnerContentChanged(nsIContent* aContent)
|
||||
BuildViewMap();
|
||||
}
|
||||
|
||||
void
|
||||
nsEventStatus
|
||||
RenderFrameParent::NotifyInputEvent(WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid)
|
||||
{
|
||||
if (GetApzcTreeManager()) {
|
||||
GetApzcTreeManager()->ReceiveInputEvent(aEvent, aOutTargetGuid);
|
||||
return GetApzcTreeManager()->ReceiveInputEvent(aEvent, aOutTargetGuid);
|
||||
}
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -109,8 +109,8 @@ public:
|
||||
* of the APZC instance that handled the event, if one was found. This
|
||||
* argument may be null.
|
||||
*/
|
||||
void NotifyInputEvent(WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid);
|
||||
nsEventStatus NotifyInputEvent(WidgetInputEvent& aEvent,
|
||||
ScrollableLayerGuid* aOutTargetGuid);
|
||||
|
||||
void ZoomToRect(uint32_t aPresShellId, ViewID aViewId, const CSSRect& aRect);
|
||||
|
||||
|
@ -1231,7 +1231,10 @@ MetroInput::HandleFirstTouchStartEvent(WidgetTouchEvent* aEvent)
|
||||
|
||||
WidgetTouchEvent transformedEvent(*aEvent);
|
||||
DUMP_TOUCH_IDS("APZC(1)", aEvent);
|
||||
mWidget->ApzReceiveInputEvent(&transformedEvent, &mTargetAPZCGuid);
|
||||
nsEventStatus result = mWidget->ApzReceiveInputEvent(&transformedEvent, &mTargetAPZCGuid);
|
||||
if (result == nsEventStatus_eConsumeNoDefault) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (gTouchActionPropertyEnabled) {
|
||||
nsTArray<TouchBehaviorFlags> touchBehaviors;
|
||||
@ -1285,6 +1288,9 @@ MetroInput::HandleFirstTouchMoveEvent(WidgetTouchEvent* aEvent)
|
||||
WidgetTouchEvent transformedEvent(*aEvent);
|
||||
DUMP_TOUCH_IDS("APZC(2)", aEvent);
|
||||
apzcStatus = mWidget->ApzReceiveInputEvent(&transformedEvent, &mTargetAPZCGuid);
|
||||
if (apzcStatus == nsEventStatus_eConsumeNoDefault) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We need to dispatch here only touch event, not pointer one.
|
||||
// That's because according to the spec pointer events doesn't imply pointermove event
|
||||
@ -1306,7 +1312,7 @@ MetroInput::HandleFirstTouchMoveEvent(WidgetTouchEvent* aEvent)
|
||||
if (nsEventStatus_eConsumeNoDefault == contentStatus) {
|
||||
// Touchmove handler consumed touch.
|
||||
mContentConsumingTouch = true;
|
||||
} else if (nsEventStatus_eConsumeNoDefault == apzcStatus) {
|
||||
} else if (nsEventStatus_eConsumeDoDefault == apzcStatus) {
|
||||
// Apzc triggered default behavior.
|
||||
mApzConsumingTouch = true;
|
||||
}
|
||||
@ -1418,6 +1424,9 @@ MetroInput::DeliverNextQueuedTouchEvent()
|
||||
|
||||
DUMP_TOUCH_IDS("APZC(3)", event);
|
||||
status = mWidget->ApzReceiveInputEvent(event, nullptr);
|
||||
if (status == nsEventStatus_eConsumeNoDefault) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we're getting a new touch (touch start) after some touch start/move
|
||||
// events we need to reset touch behavior for touches.
|
||||
@ -1430,7 +1439,7 @@ MetroInput::DeliverNextQueuedTouchEvent()
|
||||
|
||||
// Send the event to content unless APZC is consuming it.
|
||||
if (!mApzConsumingTouch) {
|
||||
if (status == nsEventStatus_eConsumeNoDefault) {
|
||||
if (status == nsEventStatus_eConsumeDoDefault) {
|
||||
mApzConsumingTouch = true;
|
||||
DispatchTouchCancel(event);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user