Bug 1270902 - Ensure scroll handoff parents are specified in the layer trees used by APZ gtests. r=kats
MozReview-Commit-ID: BxFheQ058y8
--- a/gfx/layers/apz/test/gtest/APZCBasicTester.h
+++ b/gfx/layers/apz/test/gtest/APZCBasicTester.h
@@ -25,16 +25,17 @@ protected:
{
gfxPrefs::GetSingleton();
APZThreadUtils::SetThreadAssertionsEnabled(false);
APZThreadUtils::SetControllerThread(MessageLoop::current());
tm = new TestAPZCTreeManager(mcc);
apzc = new TestAsyncPanZoomController(0, mcc, tm, mGestureBehavior);
apzc->SetFrameMetrics(TestFrameMetrics());
+ apzc->GetScrollMetadata().SetIsLayersIdRoot(true);
}
/**
* Get the APZC's scroll range in CSS pixels.
*/
CSSRect GetScrollRange() const
{
const FrameMetrics& metrics = apzc->GetFrameMetrics();
--- a/gfx/layers/apz/test/gtest/APZCTreeManagerTester.h
+++ b/gfx/layers/apz/test/gtest/APZCTreeManagerTester.h
@@ -169,16 +169,17 @@ protected:
// LayerID 0 1
nsIntRegion layerVisibleRegion[] = {
nsIntRegion(IntRect(0,0,100,100)),
nsIntRegion(IntRect(0,0,100,100)),
};
root = CreateLayerTree(layerTreeSyntax, layerVisibleRegion, nullptr, lm, layers);
SetScrollableFrameMetrics(layers[0], FrameMetrics::START_SCROLL_ID);
SetScrollableFrameMetrics(layers[1], FrameMetrics::START_SCROLL_ID + 1);
+ SetScrollHandoff(layers[1], layers[0]);
// Make layers[1] the root content
ScrollMetadata childMetadata = layers[1]->GetScrollMetadata(0);
childMetadata.GetMetrics().SetIsRootContent(true);
layers[1]->SetScrollMetadata(childMetadata);
// Both layers are fully dispatch-to-content
EventRegions regions;
--- a/gfx/layers/apz/test/gtest/TestEventRegions.cpp
+++ b/gfx/layers/apz/test/gtest/TestEventRegions.cpp
@@ -140,18 +140,19 @@ protected:
Matrix4x4 layerTransforms[] = {
Matrix4x4(),
Matrix4x4::Translation(50, 0, 0),
Matrix4x4(),
Matrix4x4(),
};
root = CreateLayerTree(layerTreeSyntax, layerVisibleRegions, layerTransforms, lm, layers);
- SetScrollableFrameMetrics(layers[2], FrameMetrics::START_SCROLL_ID + 1, CSSRect(0, 0, 10, 10));
- SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID + 2, CSSRect(0, 0, 100, 100));
+ SetScrollableFrameMetrics(layers[2], FrameMetrics::START_SCROLL_ID, CSSRect(0, 0, 10, 10));
+ SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID + 1, CSSRect(0, 0, 100, 100));
+ SetScrollHandoff(layers[3], layers[2]);
EventRegions regions(nsIntRegion(IntRect(0, 0, 10, 10)));
layers[2]->SetEventRegions(regions);
regions.mHitRegion = nsIntRegion(IntRect(0, 0, 100, 100));
regions.mDispatchToContentHitRegion = nsIntRegion(IntRect(0, 0, 100, 100));
layers[3]->SetEventRegions(regions);
registration = MakeUnique<ScopedLayerTreeRegistration>(manager, 0, root, mcc);
--- a/gfx/layers/apz/test/gtest/TestScrollHandoff.cpp
+++ b/gfx/layers/apz/test/gtest/TestScrollHandoff.cpp
@@ -54,20 +54,23 @@ protected:
nsIntRegion layerVisibleRegion[] = {
nsIntRegion(IntRect(0, 0, 100, 100)), // root
nsIntRegion(IntRect(0, 0, 100, 50)), // scrolling parent 1
nsIntRegion(IntRect(0, 0, 100, 50)), // scrolling child 1
nsIntRegion(IntRect(0, 50, 100, 50)), // scrolling parent 2
nsIntRegion(IntRect(0, 50, 100, 50)) // scrolling child 2
};
root = CreateLayerTree(layerTreeSyntax, layerVisibleRegion, nullptr, lm, layers);
- SetScrollableFrameMetrics(layers[1], FrameMetrics::START_SCROLL_ID, CSSRect(0, 0, 100, 100));
- SetScrollableFrameMetrics(layers[2], FrameMetrics::START_SCROLL_ID + 1, CSSRect(0, 0, 100, 100));
- SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID + 2, CSSRect(0, 50, 100, 100));
- SetScrollableFrameMetrics(layers[4], FrameMetrics::START_SCROLL_ID + 3, CSSRect(0, 50, 100, 100));
+ SetScrollableFrameMetrics(layers[0], FrameMetrics::START_SCROLL_ID, CSSRect(0, 0, 100, 100));
+ SetScrollableFrameMetrics(layers[1], FrameMetrics::START_SCROLL_ID + 1, CSSRect(0, 0, 100, 100));
+ SetScrollableFrameMetrics(layers[2], FrameMetrics::START_SCROLL_ID + 2, CSSRect(0, 0, 100, 100));
+ SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID + 3, CSSRect(0, 50, 100, 100));
+ SetScrollableFrameMetrics(layers[4], FrameMetrics::START_SCROLL_ID + 4, CSSRect(0, 50, 100, 100));
+ SetScrollHandoff(layers[1], layers[0]);
+ SetScrollHandoff(layers[3], layers[0]);
SetScrollHandoff(layers[2], layers[1]);
SetScrollHandoff(layers[4], layers[3]);
registration = MakeUnique<ScopedLayerTreeRegistration>(manager, 0, root, mcc);
manager->UpdateHitTestingTree(nullptr, root, false, 0, 0);
}
void CreateScrollgrabLayerTree(bool makeParentScrollable = true) {
const char* layerTreeSyntax = "c(t)";