mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1052063 - Expand the APZCTreeManagerTester to take care of more boilerplate. r=botond
This commit is contained in:
parent
25e89f6eaa
commit
56148e11f5
@ -30,14 +30,6 @@ using ::testing::InSequence;
|
|||||||
|
|
||||||
class Task;
|
class Task;
|
||||||
|
|
||||||
class APZCTreeManagerTester : public ::testing::Test {
|
|
||||||
protected:
|
|
||||||
virtual void SetUp() {
|
|
||||||
gfxPrefs::GetSingleton();
|
|
||||||
AsyncPanZoomController::SetThreadAssertionsEnabled(false);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
class ScopedGfxPref {
|
class ScopedGfxPref {
|
||||||
public:
|
public:
|
||||||
@ -1323,9 +1315,63 @@ TEST_F(APZCGestureDetectorTester, DoubleTapPreventDefaultBoth) {
|
|||||||
apzc->AssertStateIsReset();
|
apzc->AssertStateIsReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Layer tree for HitTesting1
|
class APZCTreeManagerTester : public ::testing::Test {
|
||||||
static already_AddRefed<mozilla::layers::Layer>
|
protected:
|
||||||
CreateTestLayerTree1(nsRefPtr<LayerManager>& aLayerManager, nsTArray<nsRefPtr<Layer> >& aLayers) {
|
virtual void SetUp() {
|
||||||
|
gfxPrefs::GetSingleton();
|
||||||
|
AsyncPanZoomController::SetThreadAssertionsEnabled(false);
|
||||||
|
|
||||||
|
TimeStamp testStartTime = TimeStamp::Now();
|
||||||
|
AsyncPanZoomController::SetFrameTime(testStartTime);
|
||||||
|
|
||||||
|
mcc = new NiceMock<MockContentController>();
|
||||||
|
manager = new TestAPZCTreeManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void TearDown() {
|
||||||
|
manager->ClearTree();
|
||||||
|
}
|
||||||
|
|
||||||
|
TimeStamp testStartTime;
|
||||||
|
nsRefPtr<MockContentController> mcc;
|
||||||
|
|
||||||
|
nsTArray<nsRefPtr<Layer> > layers;
|
||||||
|
nsRefPtr<LayerManager> lm;
|
||||||
|
nsRefPtr<Layer> root;
|
||||||
|
|
||||||
|
nsRefPtr<TestAPZCTreeManager> manager;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void SetScrollableFrameMetrics(Layer* aLayer, FrameMetrics::ViewID aScrollId,
|
||||||
|
// The scrollable rect is only used in HitTesting2,
|
||||||
|
// HitTesting1 doesn't care about it.
|
||||||
|
CSSRect aScrollableRect = CSSRect(-1, -1, -1, -1)) {
|
||||||
|
FrameMetrics metrics;
|
||||||
|
metrics.SetScrollId(aScrollId);
|
||||||
|
nsIntRect layerBound = aLayer->GetVisibleRegion().GetBounds();
|
||||||
|
metrics.mCompositionBounds = ParentLayerRect(layerBound.x, layerBound.y,
|
||||||
|
layerBound.width, layerBound.height);
|
||||||
|
metrics.mScrollableRect = aScrollableRect;
|
||||||
|
metrics.SetScrollOffset(CSSPoint(0, 0));
|
||||||
|
aLayer->SetFrameMetrics(metrics);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class APZHitTestingTester : public APZCTreeManagerTester {
|
||||||
|
protected:
|
||||||
|
Matrix4x4 transformToApzc;
|
||||||
|
Matrix4x4 transformToGecko;
|
||||||
|
|
||||||
|
already_AddRefed<AsyncPanZoomController> GetTargetAPZC(const ScreenPoint& aPoint) {
|
||||||
|
nsRefPtr<AsyncPanZoomController> hit = manager->GetTargetAPZC(aPoint, nullptr);
|
||||||
|
if (hit) {
|
||||||
|
manager->GetInputTransforms(hit.get(), transformToApzc, transformToGecko);
|
||||||
|
}
|
||||||
|
return hit.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void CreateHitTesting1LayerTree() {
|
||||||
const char* layerTreeSyntax = "c(ttcc)";
|
const char* layerTreeSyntax = "c(ttcc)";
|
||||||
// LayerID 0 1234
|
// LayerID 0 1234
|
||||||
nsIntRegion layerVisibleRegion[] = {
|
nsIntRegion layerVisibleRegion[] = {
|
||||||
@ -1335,19 +1381,10 @@ CreateTestLayerTree1(nsRefPtr<LayerManager>& aLayerManager, nsTArray<nsRefPtr<La
|
|||||||
nsIntRegion(nsIntRect(10,10,20,20)),
|
nsIntRegion(nsIntRect(10,10,20,20)),
|
||||||
nsIntRegion(nsIntRect(5,5,20,20)),
|
nsIntRegion(nsIntRect(5,5,20,20)),
|
||||||
};
|
};
|
||||||
Matrix4x4 transforms[] = {
|
root = CreateLayerTree(layerTreeSyntax, layerVisibleRegion, nullptr, lm, layers);
|
||||||
Matrix4x4(),
|
|
||||||
Matrix4x4(),
|
|
||||||
Matrix4x4(),
|
|
||||||
Matrix4x4(),
|
|
||||||
Matrix4x4(),
|
|
||||||
};
|
|
||||||
return CreateLayerTree(layerTreeSyntax, layerVisibleRegion, transforms, aLayerManager, aLayers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Layer Tree for HitTesting2
|
void CreateHitTesting2LayerTree() {
|
||||||
static already_AddRefed<mozilla::layers::Layer>
|
|
||||||
CreateTestLayerTree2(nsRefPtr<LayerManager>& aLayerManager, nsTArray<nsRefPtr<Layer> >& aLayers) {
|
|
||||||
const char* layerTreeSyntax = "c(cc(c))";
|
const char* layerTreeSyntax = "c(cc(c))";
|
||||||
// LayerID 0 12 3
|
// LayerID 0 12 3
|
||||||
nsIntRegion layerVisibleRegion[] = {
|
nsIntRegion layerVisibleRegion[] = {
|
||||||
@ -1359,56 +1396,24 @@ CreateTestLayerTree2(nsRefPtr<LayerManager>& aLayerManager, nsTArray<nsRefPtr<La
|
|||||||
Matrix4x4 transforms[] = {
|
Matrix4x4 transforms[] = {
|
||||||
Matrix4x4(),
|
Matrix4x4(),
|
||||||
Matrix4x4(),
|
Matrix4x4(),
|
||||||
Matrix4x4(),
|
Matrix4x4().Scale(2, 1, 1),
|
||||||
Matrix4x4(),
|
Matrix4x4(),
|
||||||
};
|
};
|
||||||
return CreateLayerTree(layerTreeSyntax, layerVisibleRegion, transforms, aLayerManager, aLayers);
|
root = CreateLayerTree(layerTreeSyntax, layerVisibleRegion, transforms, lm, layers);
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
SetScrollableFrameMetrics(root, FrameMetrics::START_SCROLL_ID, CSSRect(0, 0, 200, 200));
|
||||||
SetScrollableFrameMetrics(Layer* aLayer, FrameMetrics::ViewID aScrollId,
|
SetScrollableFrameMetrics(layers[1], FrameMetrics::START_SCROLL_ID + 1, CSSRect(0, 0, 80, 80));
|
||||||
// The scrollable rect is only used in HitTesting2,
|
SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID + 2, CSSRect(0, 0, 80, 80));
|
||||||
// HitTesting1 doesn't care about it.
|
|
||||||
CSSRect aScrollableRect = CSSRect(-1, -1, -1, -1))
|
|
||||||
{
|
|
||||||
FrameMetrics metrics;
|
|
||||||
metrics.SetScrollId(aScrollId);
|
|
||||||
nsIntRect layerBound = aLayer->GetVisibleRegion().GetBounds();
|
|
||||||
metrics.mCompositionBounds = ParentLayerRect(layerBound.x, layerBound.y,
|
|
||||||
layerBound.width, layerBound.height);
|
|
||||||
metrics.mScrollableRect = aScrollableRect;
|
|
||||||
metrics.SetScrollOffset(CSSPoint(0, 0));
|
|
||||||
aLayer->SetFrameMetrics(metrics);
|
|
||||||
}
|
|
||||||
|
|
||||||
static already_AddRefed<AsyncPanZoomController>
|
|
||||||
GetTargetAPZC(APZCTreeManager* manager, const ScreenPoint& aPoint,
|
|
||||||
Matrix4x4& aTransformToApzcOut, Matrix4x4& aTransformToGeckoOut)
|
|
||||||
{
|
|
||||||
nsRefPtr<AsyncPanZoomController> hit = manager->GetTargetAPZC(aPoint, nullptr);
|
|
||||||
if (hit) {
|
|
||||||
manager->GetInputTransforms(hit.get(), aTransformToApzcOut, aTransformToGeckoOut);
|
|
||||||
}
|
|
||||||
return hit.forget();
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// A simple hit testing test that doesn't involve any transforms on layers.
|
// A simple hit testing test that doesn't involve any transforms on layers.
|
||||||
TEST_F(APZCTreeManagerTester, HitTesting1) {
|
TEST_F(APZHitTestingTester, HitTesting1) {
|
||||||
nsTArray<nsRefPtr<Layer> > layers;
|
CreateHitTesting1LayerTree();
|
||||||
nsRefPtr<LayerManager> lm;
|
ScopedLayerTreeRegistration registration(0, root, mcc);
|
||||||
nsRefPtr<Layer> root = CreateTestLayerTree1(lm, layers);
|
|
||||||
|
|
||||||
TimeStamp testStartTime = TimeStamp::Now();
|
|
||||||
AsyncPanZoomController::SetFrameTime(testStartTime);
|
|
||||||
nsRefPtr<MockContentController> mcc = new NiceMock<MockContentController>();
|
|
||||||
ScopedLayerTreeRegistration controller(0, root, mcc);
|
|
||||||
|
|
||||||
nsRefPtr<APZCTreeManager> manager = new TestAPZCTreeManager();
|
|
||||||
Matrix4x4 transformToApzc;
|
|
||||||
Matrix4x4 transformToGecko;
|
|
||||||
|
|
||||||
// No APZC attached so hit testing will return no APZC at (20,20)
|
// No APZC attached so hit testing will return no APZC at (20,20)
|
||||||
nsRefPtr<AsyncPanZoomController> hit = GetTargetAPZC(manager, ScreenPoint(20, 20), transformToApzc, transformToGecko);
|
nsRefPtr<AsyncPanZoomController> hit = GetTargetAPZC(ScreenPoint(20, 20));
|
||||||
AsyncPanZoomController* nullAPZC = nullptr;
|
AsyncPanZoomController* nullAPZC = nullptr;
|
||||||
EXPECT_EQ(nullAPZC, hit.get());
|
EXPECT_EQ(nullAPZC, hit.get());
|
||||||
EXPECT_EQ(Matrix4x4(), transformToApzc);
|
EXPECT_EQ(Matrix4x4(), transformToApzc);
|
||||||
@ -1419,7 +1424,7 @@ TEST_F(APZCTreeManagerTester, HitTesting1) {
|
|||||||
// Now we have a root APZC that will match the page
|
// Now we have a root APZC that will match the page
|
||||||
SetScrollableFrameMetrics(root, FrameMetrics::START_SCROLL_ID);
|
SetScrollableFrameMetrics(root, FrameMetrics::START_SCROLL_ID);
|
||||||
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0, paintSequenceNumber++);
|
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0, paintSequenceNumber++);
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(15, 15), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(15, 15));
|
||||||
EXPECT_EQ(root->GetAsyncPanZoomController(), hit.get());
|
EXPECT_EQ(root->GetAsyncPanZoomController(), hit.get());
|
||||||
// expect hit point at LayerIntPoint(15, 15)
|
// expect hit point at LayerIntPoint(15, 15)
|
||||||
EXPECT_EQ(Point(15, 15), transformToApzc * Point(15, 15));
|
EXPECT_EQ(Point(15, 15), transformToApzc * Point(15, 15));
|
||||||
@ -1429,7 +1434,7 @@ TEST_F(APZCTreeManagerTester, HitTesting1) {
|
|||||||
SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID + 1);
|
SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID + 1);
|
||||||
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0, paintSequenceNumber++);
|
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0, paintSequenceNumber++);
|
||||||
EXPECT_NE(root->GetAsyncPanZoomController(), layers[3]->GetAsyncPanZoomController());
|
EXPECT_NE(root->GetAsyncPanZoomController(), layers[3]->GetAsyncPanZoomController());
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(25, 25), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(25, 25));
|
||||||
EXPECT_EQ(layers[3]->GetAsyncPanZoomController(), hit.get());
|
EXPECT_EQ(layers[3]->GetAsyncPanZoomController(), hit.get());
|
||||||
// expect hit point at LayerIntPoint(25, 25)
|
// expect hit point at LayerIntPoint(25, 25)
|
||||||
EXPECT_EQ(Point(25, 25), transformToApzc * Point(25, 25));
|
EXPECT_EQ(Point(25, 25), transformToApzc * Point(25, 25));
|
||||||
@ -1437,63 +1442,40 @@ TEST_F(APZCTreeManagerTester, HitTesting1) {
|
|||||||
|
|
||||||
// At this point, layers[4] obscures layers[3] at the point (15, 15) so
|
// At this point, layers[4] obscures layers[3] at the point (15, 15) so
|
||||||
// hitting there should hit the root APZC
|
// hitting there should hit the root APZC
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(15, 15), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(15, 15));
|
||||||
EXPECT_EQ(root->GetAsyncPanZoomController(), hit.get());
|
EXPECT_EQ(root->GetAsyncPanZoomController(), hit.get());
|
||||||
|
|
||||||
// Now test hit testing when we have two scrollable layers
|
// Now test hit testing when we have two scrollable layers
|
||||||
SetScrollableFrameMetrics(layers[4], FrameMetrics::START_SCROLL_ID + 2);
|
SetScrollableFrameMetrics(layers[4], FrameMetrics::START_SCROLL_ID + 2);
|
||||||
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0, paintSequenceNumber++);
|
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0, paintSequenceNumber++);
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(15, 15), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(15, 15));
|
||||||
EXPECT_EQ(layers[4]->GetAsyncPanZoomController(), hit.get());
|
EXPECT_EQ(layers[4]->GetAsyncPanZoomController(), hit.get());
|
||||||
// expect hit point at LayerIntPoint(15, 15)
|
// expect hit point at LayerIntPoint(15, 15)
|
||||||
EXPECT_EQ(Point(15, 15), transformToApzc * Point(15, 15));
|
EXPECT_EQ(Point(15, 15), transformToApzc * Point(15, 15));
|
||||||
EXPECT_EQ(Point(15, 15), transformToGecko * Point(15, 15));
|
EXPECT_EQ(Point(15, 15), transformToGecko * Point(15, 15));
|
||||||
|
|
||||||
// Hit test ouside the reach of layer[3,4] but inside root
|
// Hit test ouside the reach of layer[3,4] but inside root
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(90, 90), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(90, 90));
|
||||||
EXPECT_EQ(root->GetAsyncPanZoomController(), hit.get());
|
EXPECT_EQ(root->GetAsyncPanZoomController(), hit.get());
|
||||||
// expect hit point at LayerIntPoint(90, 90)
|
// expect hit point at LayerIntPoint(90, 90)
|
||||||
EXPECT_EQ(Point(90, 90), transformToApzc * Point(90, 90));
|
EXPECT_EQ(Point(90, 90), transformToApzc * Point(90, 90));
|
||||||
EXPECT_EQ(Point(90, 90), transformToGecko * Point(90, 90));
|
EXPECT_EQ(Point(90, 90), transformToGecko * Point(90, 90));
|
||||||
|
|
||||||
// Hit test ouside the reach of any layer
|
// Hit test ouside the reach of any layer
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(1000, 10), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(1000, 10));
|
||||||
EXPECT_EQ(nullAPZC, hit.get());
|
EXPECT_EQ(nullAPZC, hit.get());
|
||||||
EXPECT_EQ(Matrix4x4(), transformToApzc);
|
EXPECT_EQ(Matrix4x4(), transformToApzc);
|
||||||
EXPECT_EQ(Matrix4x4(), transformToGecko);
|
EXPECT_EQ(Matrix4x4(), transformToGecko);
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(-1000, 10), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(-1000, 10));
|
||||||
EXPECT_EQ(nullAPZC, hit.get());
|
EXPECT_EQ(nullAPZC, hit.get());
|
||||||
EXPECT_EQ(Matrix4x4(), transformToApzc);
|
EXPECT_EQ(Matrix4x4(), transformToApzc);
|
||||||
EXPECT_EQ(Matrix4x4(), transformToGecko);
|
EXPECT_EQ(Matrix4x4(), transformToGecko);
|
||||||
|
|
||||||
manager->ClearTree();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// A more involved hit testing test that involves css and async transforms.
|
// A more involved hit testing test that involves css and async transforms.
|
||||||
TEST_F(APZCTreeManagerTester, HitTesting2) {
|
TEST_F(APZHitTestingTester, HitTesting2) {
|
||||||
nsTArray<nsRefPtr<Layer> > layers;
|
CreateHitTesting2LayerTree();
|
||||||
nsRefPtr<LayerManager> lm;
|
ScopedLayerTreeRegistration registration(0, root, mcc);
|
||||||
nsRefPtr<Layer> root = CreateTestLayerTree2(lm, layers);
|
|
||||||
|
|
||||||
TimeStamp testStartTime = TimeStamp::Now();
|
|
||||||
AsyncPanZoomController::SetFrameTime(testStartTime);
|
|
||||||
nsRefPtr<MockContentController> mcc = new NiceMock<MockContentController>();
|
|
||||||
ScopedLayerTreeRegistration controller(0, root, mcc);
|
|
||||||
|
|
||||||
nsRefPtr<TestAPZCTreeManager> manager = new TestAPZCTreeManager();
|
|
||||||
nsRefPtr<AsyncPanZoomController> hit;
|
|
||||||
Matrix4x4 transformToApzc;
|
|
||||||
Matrix4x4 transformToGecko;
|
|
||||||
|
|
||||||
// Set a CSS transform on one of the layers.
|
|
||||||
Matrix4x4 transform;
|
|
||||||
transform = transform * Matrix4x4().Scale(2, 1, 1);
|
|
||||||
layers[2]->SetBaseTransform(transform);
|
|
||||||
|
|
||||||
// Make some other layers scrollable.
|
|
||||||
SetScrollableFrameMetrics(root, FrameMetrics::START_SCROLL_ID, CSSRect(0, 0, 200, 200));
|
|
||||||
SetScrollableFrameMetrics(layers[1], FrameMetrics::START_SCROLL_ID + 1, CSSRect(0, 0, 80, 80));
|
|
||||||
SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID + 2, CSSRect(0, 0, 80, 80));
|
|
||||||
|
|
||||||
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0, 0);
|
manager->UpdatePanZoomControllerTree(nullptr, root, false, 0, 0);
|
||||||
|
|
||||||
@ -1508,7 +1490,7 @@ TEST_F(APZCTreeManagerTester, HitTesting2) {
|
|||||||
AsyncPanZoomController* apzc3 = layers[3]->GetAsyncPanZoomController();
|
AsyncPanZoomController* apzc3 = layers[3]->GetAsyncPanZoomController();
|
||||||
|
|
||||||
// Hit an area that's clearly on the root layer but not any of the child layers.
|
// Hit an area that's clearly on the root layer but not any of the child layers.
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(75, 25), transformToApzc, transformToGecko);
|
nsRefPtr<AsyncPanZoomController> hit = GetTargetAPZC(ScreenPoint(75, 25));
|
||||||
EXPECT_EQ(apzcroot, hit.get());
|
EXPECT_EQ(apzcroot, hit.get());
|
||||||
EXPECT_EQ(Point(75, 25), transformToApzc * Point(75, 25));
|
EXPECT_EQ(Point(75, 25), transformToApzc * Point(75, 25));
|
||||||
EXPECT_EQ(Point(75, 25), transformToGecko * Point(75, 25));
|
EXPECT_EQ(Point(75, 25), transformToGecko * Point(75, 25));
|
||||||
@ -1520,19 +1502,19 @@ TEST_F(APZCTreeManagerTester, HitTesting2) {
|
|||||||
// scale-only transform that we set on layers[2] would be invalid because
|
// scale-only transform that we set on layers[2] would be invalid because
|
||||||
// it would place the layer into overscroll, as its composition bounds
|
// it would place the layer into overscroll, as its composition bounds
|
||||||
// start at x=10 but its content at x=20).
|
// start at x=10 but its content at x=20).
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(15, 75), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(15, 75));
|
||||||
EXPECT_EQ(apzcroot, hit.get());
|
EXPECT_EQ(apzcroot, hit.get());
|
||||||
EXPECT_EQ(Point(15, 75), transformToApzc * Point(15, 75));
|
EXPECT_EQ(Point(15, 75), transformToApzc * Point(15, 75));
|
||||||
EXPECT_EQ(Point(15, 75), transformToGecko * Point(15, 75));
|
EXPECT_EQ(Point(15, 75), transformToGecko * Point(15, 75));
|
||||||
|
|
||||||
// Hit an area on layers[1].
|
// Hit an area on layers[1].
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(25, 25), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(25, 25));
|
||||||
EXPECT_EQ(apzc1, hit.get());
|
EXPECT_EQ(apzc1, hit.get());
|
||||||
EXPECT_EQ(Point(25, 25), transformToApzc * Point(25, 25));
|
EXPECT_EQ(Point(25, 25), transformToApzc * Point(25, 25));
|
||||||
EXPECT_EQ(Point(25, 25), transformToGecko * Point(25, 25));
|
EXPECT_EQ(Point(25, 25), transformToGecko * Point(25, 25));
|
||||||
|
|
||||||
// Hit an area on layers[3].
|
// Hit an area on layers[3].
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(25, 75), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(25, 75));
|
||||||
EXPECT_EQ(apzc3, hit.get());
|
EXPECT_EQ(apzc3, hit.get());
|
||||||
// transformToApzc should unapply layers[2]'s transform
|
// transformToApzc should unapply layers[2]'s transform
|
||||||
EXPECT_EQ(Point(12.5, 75), transformToApzc * Point(25, 75));
|
EXPECT_EQ(Point(12.5, 75), transformToApzc * Point(25, 75));
|
||||||
@ -1541,7 +1523,7 @@ TEST_F(APZCTreeManagerTester, HitTesting2) {
|
|||||||
|
|
||||||
// Hit an area on layers[3] that would be on the root if layers[2]
|
// Hit an area on layers[3] that would be on the root if layers[2]
|
||||||
// weren't transformed.
|
// weren't transformed.
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(75, 75), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(75, 75));
|
||||||
EXPECT_EQ(apzc3, hit.get());
|
EXPECT_EQ(apzc3, hit.get());
|
||||||
// transformToApzc should unapply layers[2]'s transform
|
// transformToApzc should unapply layers[2]'s transform
|
||||||
EXPECT_EQ(Point(37.5, 75), transformToApzc * Point(75, 75));
|
EXPECT_EQ(Point(37.5, 75), transformToApzc * Point(75, 75));
|
||||||
@ -1563,7 +1545,7 @@ TEST_F(APZCTreeManagerTester, HitTesting2) {
|
|||||||
ApzcPanNoFling(apzcroot, time, 100, 50);
|
ApzcPanNoFling(apzcroot, time, 100, 50);
|
||||||
|
|
||||||
// Hit where layers[3] used to be. It should now hit the root.
|
// Hit where layers[3] used to be. It should now hit the root.
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(75, 75), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(75, 75));
|
||||||
EXPECT_EQ(apzcroot, hit.get());
|
EXPECT_EQ(apzcroot, hit.get());
|
||||||
// transformToApzc doesn't unapply the root's own async transform
|
// transformToApzc doesn't unapply the root's own async transform
|
||||||
EXPECT_EQ(Point(75, 75), transformToApzc * Point(75, 75));
|
EXPECT_EQ(Point(75, 75), transformToApzc * Point(75, 75));
|
||||||
@ -1573,7 +1555,7 @@ TEST_F(APZCTreeManagerTester, HitTesting2) {
|
|||||||
EXPECT_EQ(Point(75, 75), transformToGecko * Point(75, 75));
|
EXPECT_EQ(Point(75, 75), transformToGecko * Point(75, 75));
|
||||||
|
|
||||||
// Hit where layers[1] used to be and where layers[3] should now be.
|
// Hit where layers[1] used to be and where layers[3] should now be.
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(25, 25), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(25, 25));
|
||||||
EXPECT_EQ(apzc3, hit.get());
|
EXPECT_EQ(apzc3, hit.get());
|
||||||
// transformToApzc unapplies both layers[2]'s css transform and the root's
|
// transformToApzc unapplies both layers[2]'s css transform and the root's
|
||||||
// async transform
|
// async transform
|
||||||
@ -1589,7 +1571,7 @@ TEST_F(APZCTreeManagerTester, HitTesting2) {
|
|||||||
ApzcPanNoFling(apzcroot, time, 100, 50);
|
ApzcPanNoFling(apzcroot, time, 100, 50);
|
||||||
|
|
||||||
// Hit where layers[3] used to be. It should now hit the root.
|
// Hit where layers[3] used to be. It should now hit the root.
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(75, 75), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(75, 75));
|
||||||
EXPECT_EQ(apzcroot, hit.get());
|
EXPECT_EQ(apzcroot, hit.get());
|
||||||
// transformToApzc doesn't unapply the root's own async transform
|
// transformToApzc doesn't unapply the root's own async transform
|
||||||
EXPECT_EQ(Point(75, 75), transformToApzc * Point(75, 75));
|
EXPECT_EQ(Point(75, 75), transformToApzc * Point(75, 75));
|
||||||
@ -1598,15 +1580,13 @@ TEST_F(APZCTreeManagerTester, HitTesting2) {
|
|||||||
EXPECT_EQ(Point(75, 125), transformToGecko * Point(75, 75));
|
EXPECT_EQ(Point(75, 125), transformToGecko * Point(75, 75));
|
||||||
|
|
||||||
// Hit where layers[1] used to be. It should now hit the root.
|
// Hit where layers[1] used to be. It should now hit the root.
|
||||||
hit = GetTargetAPZC(manager, ScreenPoint(25, 25), transformToApzc, transformToGecko);
|
hit = GetTargetAPZC(ScreenPoint(25, 25));
|
||||||
EXPECT_EQ(apzcroot, hit.get());
|
EXPECT_EQ(apzcroot, hit.get());
|
||||||
// transformToApzc doesn't unapply the root's own async transform
|
// transformToApzc doesn't unapply the root's own async transform
|
||||||
EXPECT_EQ(Point(25, 25), transformToApzc * Point(25, 25));
|
EXPECT_EQ(Point(25, 25), transformToApzc * Point(25, 25));
|
||||||
// transformToGecko unapplies the full async transform of -100 pixels, and then
|
// transformToGecko unapplies the full async transform of -100 pixels, and then
|
||||||
// reapplies the "D" transform of -50 leading to an overall adjustment of +50
|
// reapplies the "D" transform of -50 leading to an overall adjustment of +50
|
||||||
EXPECT_EQ(Point(25, 75), transformToGecko * Point(25, 25));
|
EXPECT_EQ(Point(25, 75), transformToGecko * Point(25, 25));
|
||||||
|
|
||||||
manager->ClearTree();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class TaskRunMetrics {
|
class TaskRunMetrics {
|
||||||
|
Loading…
Reference in New Issue
Block a user