зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1337990 - Introduce a PanOptions enumeration for passing options to APZCTesterBase::Pan(). r=kats
MozReview-Commit-ID: 54UZV54IyfD --HG-- extra : rebase_source : 83ef27a26c36f3b7bf72e92ca64a4628a2d6eb9f
This commit is contained in:
Родитель
4c4b9579cd
Коммит
411f673387
|
@ -22,6 +22,7 @@
|
|||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "mozilla/layers/LayerMetricsWrapper.h"
|
||||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "apz/src/AsyncPanZoomController.h"
|
||||
#include "apz/src/HitTestingTreeNode.h"
|
||||
|
@ -288,6 +289,11 @@ public:
|
|||
mcc = new NiceMock<MockContentControllerDelayed>();
|
||||
}
|
||||
|
||||
enum class PanOptions {
|
||||
None = 0,
|
||||
KeepFingerDown = 0x1,
|
||||
};
|
||||
|
||||
template<class InputReceiver>
|
||||
void Tap(const RefPtr<InputReceiver>& aTarget, const ScreenIntPoint& aPoint,
|
||||
TimeDuration aTapLength,
|
||||
|
@ -302,7 +308,7 @@ public:
|
|||
void Pan(const RefPtr<InputReceiver>& aTarget,
|
||||
const ScreenIntPoint& aTouchStart,
|
||||
const ScreenIntPoint& aTouchEnd,
|
||||
bool aKeepFingerDown = false,
|
||||
PanOptions aOptions = PanOptions::None,
|
||||
nsTArray<uint32_t>* aAllowedTouchBehaviors = nullptr,
|
||||
nsEventStatus (*aOutEventStatuses)[4] = nullptr,
|
||||
uint64_t* aOutInputBlockId = nullptr);
|
||||
|
@ -314,7 +320,7 @@ public:
|
|||
*/
|
||||
template<class InputReceiver>
|
||||
void Pan(const RefPtr<InputReceiver>& aTarget, int aTouchStartY,
|
||||
int aTouchEndY, bool aKeepFingerDown = false,
|
||||
int aTouchEndY, PanOptions aOptions = PanOptions::None,
|
||||
nsTArray<uint32_t>* aAllowedTouchBehaviors = nullptr,
|
||||
nsEventStatus (*aOutEventStatuses)[4] = nullptr,
|
||||
uint64_t* aOutInputBlockId = nullptr);
|
||||
|
@ -350,6 +356,8 @@ protected:
|
|||
RefPtr<MockContentControllerDelayed> mcc;
|
||||
};
|
||||
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(APZCTesterBase::PanOptions)
|
||||
|
||||
template<class InputReceiver>
|
||||
void
|
||||
APZCTesterBase::Tap(const RefPtr<InputReceiver>& aTarget,
|
||||
|
@ -399,7 +407,7 @@ void
|
|||
APZCTesterBase::Pan(const RefPtr<InputReceiver>& aTarget,
|
||||
const ScreenIntPoint& aTouchStart,
|
||||
const ScreenIntPoint& aTouchEnd,
|
||||
bool aKeepFingerDown,
|
||||
PanOptions aOptions,
|
||||
nsTArray<uint32_t>* aAllowedTouchBehaviors,
|
||||
nsEventStatus (*aOutEventStatuses)[4],
|
||||
uint64_t* aOutInputBlockId)
|
||||
|
@ -455,7 +463,7 @@ APZCTesterBase::Pan(const RefPtr<InputReceiver>& aTarget,
|
|||
|
||||
mcc->AdvanceBy(TIME_BETWEEN_TOUCH_EVENT);
|
||||
|
||||
if (!aKeepFingerDown) {
|
||||
if (!(aOptions & PanOptions::KeepFingerDown)) {
|
||||
status = TouchUp(aTarget, aTouchEnd, mcc->Time());
|
||||
} else {
|
||||
status = nsEventStatus_eIgnore;
|
||||
|
@ -472,13 +480,13 @@ APZCTesterBase::Pan(const RefPtr<InputReceiver>& aTarget,
|
|||
template<class InputReceiver>
|
||||
void
|
||||
APZCTesterBase::Pan(const RefPtr<InputReceiver>& aTarget,
|
||||
int aTouchStartY, int aTouchEndY, bool aKeepFingerDown,
|
||||
int aTouchStartY, int aTouchEndY, PanOptions aOptions,
|
||||
nsTArray<uint32_t>* aAllowedTouchBehaviors,
|
||||
nsEventStatus (*aOutEventStatuses)[4],
|
||||
uint64_t* aOutInputBlockId)
|
||||
{
|
||||
Pan(aTarget, ScreenIntPoint(10, aTouchStartY), ScreenIntPoint(10, aTouchEndY),
|
||||
aKeepFingerDown, aAllowedTouchBehaviors, aOutEventStatuses, aOutInputBlockId);
|
||||
aOptions, aAllowedTouchBehaviors, aOutEventStatuses, aOutInputBlockId);
|
||||
}
|
||||
|
||||
template<class InputReceiver>
|
||||
|
@ -491,7 +499,7 @@ APZCTesterBase::PanAndCheckStatus(const RefPtr<InputReceiver>& aTarget,
|
|||
uint64_t* aOutInputBlockId)
|
||||
{
|
||||
nsEventStatus statuses[4]; // down, move, move, up
|
||||
Pan(aTarget, aTouchStartY, aTouchEndY, false, aAllowedTouchBehaviors, &statuses, aOutInputBlockId);
|
||||
Pan(aTarget, aTouchStartY, aTouchEndY, PanOptions::None, aAllowedTouchBehaviors, &statuses, aOutInputBlockId);
|
||||
|
||||
EXPECT_EQ(nsEventStatus_eConsumeDoDefault, statuses[0]);
|
||||
|
||||
|
@ -510,7 +518,7 @@ APZCTesterBase::ApzcPanNoFling(const RefPtr<TestAsyncPanZoomController>& aApzc,
|
|||
int aTouchStartY, int aTouchEndY,
|
||||
uint64_t* aOutInputBlockId)
|
||||
{
|
||||
Pan(aApzc, aTouchStartY, aTouchEndY, false, nullptr, nullptr, aOutInputBlockId);
|
||||
Pan(aApzc, aTouchStartY, aTouchEndY, PanOptions::None, nullptr, nullptr, aOutInputBlockId);
|
||||
aApzc->CancelAnimation();
|
||||
}
|
||||
|
||||
|
|
|
@ -344,7 +344,7 @@ TEST_F(APZCBasicTester, OverScrollPanningAbort) {
|
|||
// the pan does not end.
|
||||
int touchStart = 500;
|
||||
int touchEnd = 10;
|
||||
Pan(apzc, touchStart, touchEnd, true); // keep finger down
|
||||
Pan(apzc, touchStart, touchEnd, PanOptions::KeepFingerDown);
|
||||
EXPECT_TRUE(apzc->IsOverscrolled());
|
||||
|
||||
// Check that calling CancelAnimation() while the user is still panning
|
||||
|
|
|
@ -235,7 +235,7 @@ protected:
|
|||
uint64_t blockId = 0;
|
||||
|
||||
// Start the fling down.
|
||||
Pan(apzc, touchStart, touchEnd, false, nullptr, nullptr, &blockId);
|
||||
Pan(apzc, touchStart, touchEnd, PanOptions::None, nullptr, nullptr, &blockId);
|
||||
apzc->ConfirmTarget(blockId);
|
||||
apzc->ContentReceivedInputBlock(blockId, false);
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ TEST_F(APZScrollHandoffTester, StuckInOverscroll_Bug1073250) {
|
|||
TestAsyncPanZoomController* child = ApzcOf(layers[1]);
|
||||
|
||||
// Pan, causing the parent APZC to overscroll.
|
||||
Pan(manager, 10, 40, true /* keep finger down */);
|
||||
Pan(manager, 10, 40, PanOptions::KeepFingerDown);
|
||||
EXPECT_FALSE(child->IsOverscrolled());
|
||||
EXPECT_TRUE(rootApzc->IsOverscrolled());
|
||||
|
||||
|
@ -255,7 +255,7 @@ TEST_F(APZScrollHandoffTester, StuckInOverscroll_Bug1231228) {
|
|||
TestAsyncPanZoomController* child = ApzcOf(layers[1]);
|
||||
|
||||
// Pan, causing the parent APZC to overscroll.
|
||||
Pan(manager, 60, 90, true /* keep finger down */);
|
||||
Pan(manager, 60, 90, PanOptions::KeepFingerDown);
|
||||
EXPECT_FALSE(child->IsOverscrolled());
|
||||
EXPECT_TRUE(rootApzc->IsOverscrolled());
|
||||
|
||||
|
@ -289,7 +289,7 @@ TEST_F(APZScrollHandoffTester, StuckInOverscroll_Bug1240202a) {
|
|||
TestAsyncPanZoomController* child = ApzcOf(layers[1]);
|
||||
|
||||
// Pan, causing the parent APZC to overscroll.
|
||||
Pan(manager, 60, 90, true /* keep finger down */);
|
||||
Pan(manager, 60, 90, PanOptions::KeepFingerDown);
|
||||
EXPECT_FALSE(child->IsOverscrolled());
|
||||
EXPECT_TRUE(rootApzc->IsOverscrolled());
|
||||
|
||||
|
@ -322,7 +322,7 @@ TEST_F(APZScrollHandoffTester, StuckInOverscroll_Bug1240202b) {
|
|||
TestAsyncPanZoomController* child = ApzcOf(layers[1]);
|
||||
|
||||
// Pan, causing the parent APZC to overscroll.
|
||||
Pan(manager, 60, 90, true /* keep finger down */);
|
||||
Pan(manager, 60, 90, PanOptions::KeepFingerDown);
|
||||
EXPECT_FALSE(child->IsOverscrolled());
|
||||
EXPECT_TRUE(rootApzc->IsOverscrolled());
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче