Bug 1872563. Change WebRenderLayerScrollData::mVisibleRegion from a region to a rect. r=botond

It's only ever set to a rect. This should save a little bit of time serializing this struct.

Differential Revision: https://phabricator.services.mozilla.com/D197469
This commit is contained in:
Timothy Nikkel 2024-01-06 00:58:32 +00:00
parent 21574e46b5
commit 488989b2d9
25 changed files with 135 additions and 141 deletions

View File

@ -1151,8 +1151,7 @@ void APZCTreeManager::NotifyAutoscrollRejected(
void SetHitTestData(HitTestingTreeNode* aNode,
const WebRenderScrollDataWrapper& aLayer,
const EventRegionsOverride& aOverrideFlags) {
aNode->SetHitTestData(aLayer.GetVisibleRegion(),
aLayer.GetRemoteDocumentSize(),
aNode->SetHitTestData(aLayer.GetVisibleRect(), aLayer.GetRemoteDocumentSize(),
aLayer.GetTransformTyped(), aOverrideFlags,
aLayer.GetAsyncZoomContainerId());
}

View File

@ -1000,7 +1000,7 @@ nsEventStatus AsyncPanZoomController::HandleDragEvent(
// scrolling, but here we're interested in the other direction.
ParentLayerRect thumbRect =
(node->GetTransform() * AsyncTransformMatrix())
.TransformBounds(LayerRect(node->GetVisibleRegion().GetBounds()));
.TransformBounds(LayerRect(node->GetVisibleRect()));
ScrollDirection otherDirection = GetPerpendicularDirection(direction);
ParentLayerCoord distance =
GetAxisStart(otherDirection, thumbRect.DistanceTo(aEvent.mLocalOrigin));

View File

@ -249,11 +249,10 @@ bool HitTestingTreeNode::IsPrimaryHolder() const {
LayersId HitTestingTreeNode::GetLayersId() const { return mLayersId; }
void HitTestingTreeNode::SetHitTestData(
const LayerIntRegion& aVisibleRegion,
const LayerIntSize& aRemoteDocumentSize,
const LayerIntRect& aVisibleRect, const LayerIntSize& aRemoteDocumentSize,
const CSSTransformMatrix& aTransform, const EventRegionsOverride& aOverride,
const Maybe<ScrollableLayerGuid::ViewID>& aAsyncZoomContainerId) {
mVisibleRegion = aVisibleRegion;
mVisibleRect = aVisibleRect;
mRemoteDocumentSize = aRemoteDocumentSize;
mTransform = aTransform;
mOverride = aOverride;
@ -291,8 +290,8 @@ LayerToScreenMatrix4x4 HitTestingTreeNode::GetTransformToGecko(
PixelCastJustification::ScreenIsParentLayerForRoot);
}
const LayerIntRegion& HitTestingTreeNode::GetVisibleRegion() const {
return mVisibleRegion;
const LayerIntRect& HitTestingTreeNode::GetVisibleRect() const {
return mVisibleRect;
}
ScreenRect HitTestingTreeNode::GetRemoteDocumentScreenRect(

View File

@ -103,8 +103,7 @@ class HitTestingTreeNode {
/* Hit test related methods */
void SetHitTestData(
const LayerIntRegion& aVisibleRegion,
const LayerIntSize& aRemoteDocumentSize,
const LayerIntRect& aVisibleRect, const LayerIntSize& aRemoteDocumentSize,
const CSSTransformMatrix& aTransform,
const EventRegionsOverride& aOverride,
const Maybe<ScrollableLayerGuid::ViewID>& aAsyncZoomContainerId);
@ -152,7 +151,7 @@ class HitTestingTreeNode {
* |aRemoteLayersId| is the LayersId of the remote subtree for which this
* transform will be used. */
LayerToScreenMatrix4x4 GetTransformToGecko(LayersId aRemoteLayersId) const;
const LayerIntRegion& GetVisibleRegion() const;
const LayerIntRect& GetVisibleRect() const;
/* Returns the screen coordinate rectangle of remote iframe corresponding to
* this node. The rectangle is the result of clipped by ancestor async
@ -205,7 +204,7 @@ class HitTestingTreeNode {
// we use to adjust sticky position content for the toolbar.
Maybe<uint64_t> mStickyPositionAnimationId;
LayerIntRegion mVisibleRegion;
LayerIntRect mVisibleRect;
/* The size of remote iframe on the corresponding layer coordinate.
* It's empty if this node is not for remote iframe. */

View File

@ -87,9 +87,9 @@ class APZCTreeManagerTester : public APZCTesterBase {
}
void CreateScrollData(const char* aTreeShape,
const LayerIntRegion* aVisibleRegions = nullptr,
const LayerIntRect* aVisibleRects = nullptr,
const gfx::Matrix4x4* aTransforms = nullptr) {
layers = TestWRScrollData::Create(aTreeShape, *updater, aVisibleRegions,
layers = TestWRScrollData::Create(aTreeShape, *updater, aVisibleRects,
aTransforms);
root = layers[0];
}
@ -168,9 +168,8 @@ class APZCTreeManagerTester : public APZCTesterBase {
CSSRect aScrollableRect = CSSRect(-1, -1, -1,
-1)) {
auto localTransform = aLayer->GetTransformTyped() * AsyncTransformMatrix();
ParentLayerIntRect compositionBounds =
RoundedToInt(localTransform.TransformBounds(
LayerRect(aLayer->GetVisibleRegion().GetBounds())));
ParentLayerIntRect compositionBounds = RoundedToInt(
localTransform.TransformBounds(LayerRect(aLayer->GetVisibleRect())));
ScrollMetadata metadata = BuildScrollMetadata(
aScrollId, aScrollableRect, ParentLayerRect(compositionBounds));
SetScrollMetadata(aLayer, metadata);
@ -211,10 +210,10 @@ class APZCTreeManagerTester : public APZCTesterBase {
void CreateSimpleScrollingLayer() {
const char* treeShape = "x";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 200, 200),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(layers[0], ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 500, 500));
}

View File

@ -63,10 +63,10 @@ class APZCAxisLockTester : public APZCTreeManagerTester {
void SetupBasicTest() {
const char* treeShape = "x";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 500, 500));
@ -522,11 +522,11 @@ TEST_F(APZCAxisLockTester, TestScrollHandoffAxisLockConflict) {
// Create two scrollable frames. One parent frame with one child.
const char* treeShape = "x(x)";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 100),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 500, 500));
SetScrollableFrameMetrics(layers[1], ScrollableLayerGuid::START_SCROLL_ID + 1,
@ -613,10 +613,10 @@ TEST_F(APZCAxisLockTester, TestScrollHandoffAxisLockConflict) {
// current offset for all axis locking modes.
TEST_P(APZCAxisLockCompatTester, TestPanGestureStart) {
const char* treeShape = "x";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 500, 500));

View File

@ -92,7 +92,7 @@ TEST_F(APZCBasicTester, ComplexTransform) {
const char* treeShape = "x(x)";
// LayerID 0 1
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 300, 300),
LayerIntRect(0, 0, 150, 300),
};
@ -107,8 +107,8 @@ TEST_F(APZCBasicTester, ComplexTransform) {
2.0f, 1.0f,
1.0f); // this is the 2.0 x-axis CSS transform on the child layer
auto layers = TestWRScrollData::Create(treeShape, *updater,
layerVisibleRegion, transforms);
auto layers = TestWRScrollData::Create(treeShape, *updater, layerVisibleRect,
transforms);
ScrollMetadata metadata;
FrameMetrics& metrics = metadata.GetMetrics();

View File

@ -16,12 +16,12 @@ class APZEventRegionsTester : public APZCTreeManagerTester {
void CreateEventRegionsLayerTree1() {
const char* treeShape = "x(xx)";
LayerIntRegion layerVisibleRegions[] = {
LayerIntRect layerVisibleRects[] = {
LayerIntRect(0, 0, 200, 200), // root
LayerIntRect(0, 0, 100, 200), // left half
LayerIntRect(0, 100, 200, 100), // bottom half
};
CreateScrollData(treeShape, layerVisibleRegions);
CreateScrollData(treeShape, layerVisibleRects);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID);
SetScrollableFrameMetrics(layers[1],
ScrollableLayerGuid::START_SCROLL_ID + 1);
@ -37,11 +37,11 @@ class APZEventRegionsTester : public APZCTreeManagerTester {
void CreateEventRegionsLayerTree2() {
const char* treeShape = "x(x)";
LayerIntRegion layerVisibleRegions[] = {
LayerIntRect layerVisibleRects[] = {
LayerIntRect(0, 0, 100, 500),
LayerIntRect(0, 150, 100, 100),
};
CreateScrollData(treeShape, layerVisibleRegions);
CreateScrollData(treeShape, layerVisibleRects);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID);
registration = MakeUnique<ScopedLayerTreeRegistration>(LayersId{0}, mcc);
@ -58,7 +58,7 @@ class APZEventRegionsTester : public APZCTreeManagerTester {
// transforms are different from 3's.
// 2 is a small layer that is the actual target
// 3 is a big layer obscuring 2 with a dispatch-to-content region
LayerIntRegion layerVisibleRegions[] = {
LayerIntRect layerVisibleRects[] = {
LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 0, 0),
LayerIntRect(0, 0, 10, 10),
@ -70,7 +70,7 @@ class APZEventRegionsTester : public APZCTreeManagerTester {
Matrix4x4(),
Matrix4x4(),
};
CreateScrollData(treeShape, layerVisibleRegions, layerTransforms);
CreateScrollData(treeShape, layerVisibleRects, layerTransforms);
SetScrollableFrameMetrics(layers[2], ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 10, 10));

View File

@ -42,10 +42,10 @@ class APZEventResultTester : public APZCTreeManagerTester {
void CreateScrollableRootLayer() {
const char* treeShape = "x";
LayerIntRegion layerVisibleRegions[] = {
LayerIntRect layerVisibleRects[] = {
LayerIntRect(0, 0, 100, 100),
};
CreateScrollData(treeShape, layerVisibleRegions);
CreateScrollData(treeShape, layerVisibleRects);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 200, 200));
ModifyFrameMetrics(root, [](ScrollMetadata& sm, FrameMetrics& metrics) {
@ -357,10 +357,10 @@ TEST_F(APZEventResultTesterMock, HandledByRootApzcFlag) {
// Create simple layer tree containing a dispatch-to-content region
// that covers part but not all of its area.
const char* treeShape = "x";
LayerIntRegion layerVisibleRegions[] = {
LayerIntRect layerVisibleRects[] = {
LayerIntRect(0, 0, 100, 100),
};
CreateScrollData(treeShape, layerVisibleRegions);
CreateScrollData(treeShape, layerVisibleRects);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 200));
ModifyFrameMetrics(root, [](ScrollMetadata& sm, FrameMetrics& metrics) {

View File

@ -14,10 +14,10 @@ class APZCFlingAccelerationTester : public APZCTreeManagerTester {
void SetUp() {
APZCTreeManagerTester::SetUp();
const char* treeShape = "x";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 800, 1000),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 800, 50000));
// Scroll somewhere into the middle of the scroll range, so that we have

View File

@ -36,7 +36,7 @@ class APZHitTestingTester : public APZCTreeManagerTester {
void CreateComplexMultiLayerTree() {
const char* treeShape = "x(xx(x)xx(x(x)xx))";
// LayerID 0 12 3 45 6 7 89
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 300, 400), // root(0)
LayerIntRect(0, 0, 100, 100), // layer(1) in top-left
LayerIntRect(50, 50, 200, 300), // layer(2) centered in root(0)
@ -54,7 +54,7 @@ class APZHitTestingTester : public APZCTreeManagerTester {
LayerIntRect(200, 300, 100,
100), // layer(9) in bottom-right (below (8))
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(layers[1], ScrollableLayerGuid::START_SCROLL_ID);
SetScrollableFrameMetrics(layers[2], ScrollableLayerGuid::START_SCROLL_ID);
SetScrollableFrameMetrics(layers[4],
@ -72,11 +72,11 @@ class APZHitTestingTester : public APZCTreeManagerTester {
void CreateBug1148350LayerTree() {
const char* treeShape = "x(x)";
// LayerID 0 1
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 200, 200),
LayerIntRect(0, 0, 200, 200),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(layers[1], ScrollableLayerGuid::START_SCROLL_ID);
}
};
@ -342,7 +342,7 @@ TEST_F(APZHitTestingTester, Bug1148350) {
SetDefaultAllowedTouchBehavior(manager, blockId);
mcc->AdvanceByMillis(100);
layers[0]->SetVisibleRegion(LayerIntRegion(LayerIntRect(0, 50, 200, 150)));
layers[0]->SetVisibleRect(LayerIntRect(0, 50, 200, 150));
layers[0]->SetTransform(Matrix4x4::Translation(0, 50, 0));
UpdateHitTestingTree();

View File

@ -1649,9 +1649,9 @@ TEST_F(APZCOverscrollTesterMock, OverscrollHandoff) {
SCOPED_GFX_PREF_BOOL("apz.overscroll.enabled", true);
const char* treeShape = "x(x)";
LayerIntRegion layerVisibleRegion[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 50)};
CreateScrollData(treeShape, layerVisibleRegion);
LayerIntRect layerVisibleRect[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 50)};
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 200, 200));
SetScrollableFrameMetrics(layers[1], ScrollableLayerGuid::START_SCROLL_ID + 1,
@ -1683,9 +1683,9 @@ TEST_F(APZCOverscrollTesterMock, VerticalOverscrollHandoffToScrollableRoot) {
// Create a layer tree having two vertical scrollable layers.
const char* treeShape = "x(x)";
LayerIntRegion layerVisibleRegion[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 50)};
CreateScrollData(treeShape, layerVisibleRegion);
LayerIntRect layerVisibleRect[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 50)};
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 200));
SetScrollableFrameMetrics(layers[1], ScrollableLayerGuid::START_SCROLL_ID + 1,
@ -1715,9 +1715,9 @@ TEST_F(APZCOverscrollTesterMock, NoOverscrollHandoffToNonScrollableRoot) {
// Create a layer tree having non-scrollable root and a vertical scrollable
// child.
const char* treeShape = "x(x)";
LayerIntRegion layerVisibleRegion[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 50)};
CreateScrollData(treeShape, layerVisibleRegion);
LayerIntRect layerVisibleRect[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 50)};
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 100));
SetScrollableFrameMetrics(layers[1], ScrollableLayerGuid::START_SCROLL_ID + 1,
@ -1747,9 +1747,9 @@ TEST_F(APZCOverscrollTesterMock, NoOverscrollHandoffOrthogonalPanGesture) {
// Create a layer tree having horizontal scrollable root and a vertical
// scrollable child.
const char* treeShape = "x(x)";
LayerIntRegion layerVisibleRegion[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 50)};
CreateScrollData(treeShape, layerVisibleRegion);
LayerIntRect layerVisibleRect[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 50)};
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 200, 100));
SetScrollableFrameMetrics(layers[1], ScrollableLayerGuid::START_SCROLL_ID + 1,
@ -1780,9 +1780,9 @@ TEST_F(APZCOverscrollTesterMock,
// Create a layer tree having vertical scrollable root and a horizontal
// scrollable child.
const char* treeShape = "x(x)";
LayerIntRegion layerVisibleRegion[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 50)};
CreateScrollData(treeShape, layerVisibleRegion);
LayerIntRect layerVisibleRect[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 50)};
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 200));
SetScrollableFrameMetrics(layers[1], ScrollableLayerGuid::START_SCROLL_ID + 1,
@ -1861,9 +1861,9 @@ TEST_F(APZCOverscrollTesterMock, RetriggeredOverscrollAnimationVelocity) {
// Setup two nested vertical scrollable frames.
const char* treeShape = "x(x)";
LayerIntRegion layerVisibleRegion[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 50)};
CreateScrollData(treeShape, layerVisibleRegion);
LayerIntRect layerVisibleRect[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 50)};
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 200));
SetScrollableFrameMetrics(layers[1], ScrollableLayerGuid::START_SCROLL_ID + 1,
@ -1945,8 +1945,8 @@ TEST_F(APZCOverscrollTesterMock, OverscrollIntoPreventDefault) {
SCOPED_GFX_PREF_BOOL("apz.overscroll.enabled", true);
const char* treeShape = "x";
LayerIntRegion layerVisibleRegions[] = {LayerIntRect(0, 0, 100, 100)};
CreateScrollData(treeShape, layerVisibleRegions);
LayerIntRect layerVisibleRects[] = {LayerIntRect(0, 0, 100, 100)};
CreateScrollData(treeShape, layerVisibleRects);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 200));

View File

@ -20,10 +20,10 @@ class APZCArePointerEventsConsumable : public APZCTreeManagerTester {
void CreateSingleElementTree() {
const char* treeShape = "x";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 500, 500));
@ -36,9 +36,9 @@ class APZCArePointerEventsConsumable : public APZCTreeManagerTester {
void CreateScrollHandoffTree() {
const char* treeShape = "x(x)";
LayerIntRegion layerVisibleRegion[] = {LayerIntRect(0, 0, 200, 200),
LayerIntRect(50, 50, 100, 100)};
CreateScrollData(treeShape, layerVisibleRegion);
LayerIntRect layerVisibleRect[] = {LayerIntRect(0, 0, 200, 200),
LayerIntRect(50, 50, 100, 100)};
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 300, 300));
SetScrollableFrameMetrics(layers[1],

View File

@ -15,9 +15,9 @@ class APZScrollHandoffTester : public APZCTreeManagerTester {
void CreateScrollHandoffLayerTree1() {
const char* treeShape = "x(x)";
LayerIntRegion layerVisibleRegion[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 50, 100, 50)};
CreateScrollData(treeShape, layerVisibleRegion);
LayerIntRect layerVisibleRect[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 50, 100, 50)};
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 200, 200));
SetScrollableFrameMetrics(layers[1],
@ -33,10 +33,10 @@ class APZScrollHandoffTester : public APZCTreeManagerTester {
void CreateScrollHandoffLayerTree2() {
const char* treeShape = "x(x(x))";
LayerIntRegion layerVisibleRegion[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 50, 100, 50)};
CreateScrollData(treeShape, layerVisibleRegion);
LayerIntRect layerVisibleRect[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 50, 100, 50)};
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 200, 200));
SetScrollableFrameMetrics(layers[1],
@ -56,14 +56,14 @@ class APZScrollHandoffTester : public APZCTreeManagerTester {
void CreateScrollHandoffLayerTree3() {
const char* treeShape = "x(x(x)x(x))";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100), // root
LayerIntRect(0, 0, 100, 50), // scrolling parent 1
LayerIntRect(0, 0, 100, 50), // scrolling child 1
LayerIntRect(0, 50, 100, 50), // scrolling parent 2
LayerIntRect(0, 50, 100, 50) // scrolling child 2
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(layers[0], ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 100));
SetScrollableFrameMetrics(layers[1],
@ -90,9 +90,9 @@ class APZScrollHandoffTester : public APZCTreeManagerTester {
// horizontally, and a child layer that is only scrollable vertically.
void CreateScrollHandoffLayerTree4() {
const char* treeShape = "x(x)";
LayerIntRegion layerVisibleRegion[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 100)};
CreateScrollData(treeShape, layerVisibleRegion);
LayerIntRect layerVisibleRect[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 100)};
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 200, 100));
SetScrollableFrameMetrics(layers[1],
@ -108,11 +108,11 @@ class APZScrollHandoffTester : public APZCTreeManagerTester {
// child layer that is only scrollable vertically.
void CreateScrollHandoffLayerTree5() {
const char* treeShape = "x(x)";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100), // scrolling parent
LayerIntRect(0, 50, 100, 50) // scrolling child
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 100));
SetScrollableFrameMetrics(layers[1],
@ -126,11 +126,11 @@ class APZScrollHandoffTester : public APZCTreeManagerTester {
void CreateScrollgrabLayerTree(bool makeParentScrollable = true) {
const char* treeShape = "x(x)";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100), // scroll-grabbing parent
LayerIntRect(0, 20, 100, 80) // child
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
float parentHeight = makeParentScrollable ? 120 : 100;
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, parentHeight));

View File

@ -32,10 +32,10 @@ class APZScrollbarDraggingTester : public APZCTreeManagerTester {
// The first child is the scrollable node, the second child is the
// scrollbar.
const char* treeShape = "x(xx)";
LayerIntRegion layerVisibleRegion[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 50, 100),
LayerIntRect(50, 0, 50, 10)};
CreateScrollData(treeShape, layerVisibleRegion);
LayerIntRect layerVisibleRect[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 50, 100),
LayerIntRect(50, 0, 50, 10)};
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(layers[1], scrollId, CSSRect(0, 0, 50, 1000));
registration = MakeUnique<ScopedLayerTreeRegistration>(LayersId{0}, mcc);
layers[2]->SetScrollbarData(ScrollbarData::CreateForThumb(

View File

@ -21,9 +21,9 @@ TEST_F(APZCSnappingTesterMock, Bug1265510) {
SCOPED_GFX_PREF_BOOL("general.smoothScroll", true);
const char* treeShape = "x(x)";
LayerIntRegion layerVisibleRegion[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 100, 100, 100)};
CreateScrollData(treeShape, layerVisibleRegion);
LayerIntRect layerVisibleRect[] = {LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 100, 100, 100)};
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 200));
SetScrollableFrameMetrics(layers[1], ScrollableLayerGuid::START_SCROLL_ID + 1,
@ -32,8 +32,8 @@ TEST_F(APZCSnappingTesterMock, Bug1265510) {
ScrollSnapInfo snap;
snap.mScrollSnapStrictnessY = StyleScrollSnapStrictness::Mandatory;
snap.mSnapportSize = CSSSize::ToAppUnits(
layerVisibleRegion[0].GetBounds().Size() * LayerToCSSScale(1.0));
snap.mSnapportSize =
CSSSize::ToAppUnits(layerVisibleRect[0].Size() * LayerToCSSScale(1.0));
snap.mSnapTargets.AppendElement(ScrollSnapInfo::SnapTarget(
Nothing(), Some(0 * AppUnitsPerCSSPixel()),
@ -95,18 +95,18 @@ TEST_F(APZCSnappingTesterMock, Bug1265510) {
TEST_F(APZCSnappingTesterMock, Snap_After_Pinch) {
const char* treeShape = "x";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 200));
// Set up some basic scroll snapping
ScrollSnapInfo snap;
snap.mScrollSnapStrictnessY = StyleScrollSnapStrictness::Mandatory;
snap.mSnapportSize = CSSSize::ToAppUnits(
layerVisibleRegion[0].GetBounds().Size() * LayerToCSSScale(1.0));
snap.mSnapportSize =
CSSSize::ToAppUnits(layerVisibleRect[0].Size() * LayerToCSSScale(1.0));
snap.mSnapTargets.AppendElement(ScrollSnapInfo::SnapTarget(
Nothing(), Some(0 * AppUnitsPerCSSPixel()),
@ -155,18 +155,18 @@ TEST_F(APZCSnappingTesterMock, SnapOnPanEndWithZeroVelocity) {
SCOPED_GFX_PREF_INT("apz.velocity_relevance_time_ms", 100);
const char* treeShape = "x";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 400));
// Set up two snap points, 30 and 100.
ScrollSnapInfo snap;
snap.mScrollSnapStrictnessY = StyleScrollSnapStrictness::Mandatory;
snap.mSnapportSize = CSSSize::ToAppUnits(
layerVisibleRegion[0].GetBounds().Size() * LayerToCSSScale(1.0));
snap.mSnapportSize =
CSSSize::ToAppUnits(layerVisibleRect[0].Size() * LayerToCSSScale(1.0));
snap.mSnapTargets.AppendElement(ScrollSnapInfo::SnapTarget(
Nothing(), Some(30 * AppUnitsPerCSSPixel()),
CSSRect::ToAppUnits(CSSRect(0, 30, 10, 10)), StyleScrollSnapStop::Normal,
@ -232,18 +232,18 @@ TEST_F(APZCSnappingTesterMock, SnapOnPanEndWithPositiveVelocity) {
SCOPED_GFX_PREF_INT("apz.velocity_relevance_time_ms", 100);
const char* treeShape = "x";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 400));
// Set up two snap points, 30 and 100.
ScrollSnapInfo snap;
snap.mScrollSnapStrictnessY = StyleScrollSnapStrictness::Mandatory;
snap.mSnapportSize = CSSSize::ToAppUnits(
layerVisibleRegion[0].GetBounds().Size() * LayerToCSSScale(1.0));
snap.mSnapportSize =
CSSSize::ToAppUnits(layerVisibleRect[0].Size() * LayerToCSSScale(1.0));
snap.mSnapTargets.AppendElement(ScrollSnapInfo::SnapTarget(
Nothing(), Some(30 * AppUnitsPerCSSPixel()),
CSSRect::ToAppUnits(CSSRect(0, 30, 10, 10)), StyleScrollSnapStop::Normal,

View File

@ -17,18 +17,18 @@ class APZCSnappingOnMomentumTesterMock : public APZCTreeManagerTester {
TEST_F(APZCSnappingOnMomentumTesterMock, Snap_On_Momentum) {
const char* treeShape = "x";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 500));
// Set up some basic scroll snapping
ScrollSnapInfo snap;
snap.mScrollSnapStrictnessY = StyleScrollSnapStrictness::Mandatory;
snap.mSnapportSize = CSSSize::ToAppUnits(
layerVisibleRegion[0].GetBounds().Size() * LayerToCSSScale(1.0));
snap.mSnapportSize =
CSSSize::ToAppUnits(layerVisibleRect[0].Size() * LayerToCSSScale(1.0));
snap.mSnapTargets.AppendElement(ScrollSnapInfo::SnapTarget(
Nothing(), Some(0 * AppUnitsPerCSSPixel()),
CSSRect::ToAppUnits(CSSRect(0, 0, 10, 10)), StyleScrollSnapStop::Normal,

View File

@ -22,10 +22,10 @@ class APZCTransformNotificationTester : public APZCTreeManagerTester {
void SetupBasicTest() {
const char* treeShape = "x";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 500, 500));
@ -38,10 +38,10 @@ class APZCTransformNotificationTester : public APZCTreeManagerTester {
void SetupNonScrollableTest() {
const char* treeShape = "x";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(root, ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 100, 100));

View File

@ -14,10 +14,10 @@ class APZCTreeManagerGenericTester : public APZCTreeManagerTester {
protected:
void CreateSimpleScrollingLayer() {
const char* treeShape = "x";
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 200, 200),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(layers[0], ScrollableLayerGuid::START_SCROLL_ID,
CSSRect(0, 0, 500, 500));
}
@ -25,12 +25,12 @@ class APZCTreeManagerGenericTester : public APZCTreeManagerTester {
void CreateSimpleMultiLayerTree() {
const char* treeShape = "x(xx)";
// LayerID 0 12
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 50),
LayerIntRect(0, 50, 100, 50),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
}
void CreatePotentiallyLeakingTree() {
@ -51,11 +51,11 @@ class APZCTreeManagerGenericTester : public APZCTreeManagerTester {
void CreateTwoLayerTree(int32_t aRootContentLayerIndex) {
const char* treeShape = "x(x)";
// LayerID 0 1
LayerIntRegion layerVisibleRegion[] = {
LayerIntRect layerVisibleRect[] = {
LayerIntRect(0, 0, 100, 100),
LayerIntRect(0, 0, 100, 100),
};
CreateScrollData(treeShape, layerVisibleRegion);
CreateScrollData(treeShape, layerVisibleRect);
SetScrollableFrameMetrics(layers[0], ScrollableLayerGuid::START_SCROLL_ID);
SetScrollableFrameMetrics(layers[1],
ScrollableLayerGuid::START_SCROLL_ID + 1);

View File

@ -28,7 +28,7 @@ using mozilla::layers::WebRenderScrollDataWrapper;
/* static */
TestWRScrollData TestWRScrollData::Create(const char* aTreeShape,
const APZUpdater& aUpdater,
const LayerIntRegion* aVisibleRegions,
const LayerIntRect* aVisibleRects,
const gfx::Matrix4x4* aTransforms) {
// The WebRenderLayerScrollData tree needs to be created in a fairly
// particular way (for example, each node needs to know the number of
@ -60,8 +60,8 @@ TestWRScrollData TestWRScrollData::Create(const char* aTreeShape,
WebRenderLayerScrollData layer;
APZTestAccess::InitializeForTest(layer, entry.mDescendantCount);
if (aVisibleRegions) {
layer.SetVisibleRegion(aVisibleRegions[entry.mLayerIndex]);
if (aVisibleRects) {
layer.SetVisibleRect(aVisibleRects[entry.mLayerIndex]);
}
if (aTransforms) {
layer.SetTransform(aTransforms[entry.mLayerIndex]);

View File

@ -37,14 +37,14 @@ class TestWRScrollData : public WebRenderScrollData {
* / \
* x x
*
* The caller may optionally provide visible regions and/or transforms
* The caller may optionally provide visible rects and/or transforms
* for the nodes. If provided, the array should contain one element
* for each node, in the same order as in |aTreeShape|.
*/
static TestWRScrollData Create(
const char* aTreeShape, const APZUpdater& aUpdater,
const LayerIntRegion* aVisibleRegions = nullptr,
const gfx::Matrix4x4* aTransforms = nullptr);
static TestWRScrollData Create(const char* aTreeShape,
const APZUpdater& aUpdater,
const LayerIntRect* aVisibleRects = nullptr,
const gfx::Matrix4x4* aTransforms = nullptr);
// These methods allow accessing and manipulating layers based on an index
// representing the order in which they appear in |aTreeShape|.

View File

@ -182,7 +182,7 @@ void WebRenderLayerScrollData::Dump(std::ostream& aOut,
aOut << ", transformIsPerspective";
}
}
aOut << ", visible=" << mVisibleRegion;
aOut << ", visible=" << mVisibleRect;
if (mReferentId) {
aOut << ", refLayersId=" << *mReferentId;
}
@ -438,7 +438,7 @@ void ParamTraits<mozilla::layers::WebRenderLayerScrollData>::Write(
WriteParam(aWriter, aParam.mAncestorTransformId);
WriteParam(aWriter, aParam.mTransform);
WriteParam(aWriter, aParam.mTransformIsPerspective);
WriteParam(aWriter, aParam.mVisibleRegion);
WriteParam(aWriter, aParam.mVisibleRect);
WriteParam(aWriter, aParam.mRemoteDocumentSize);
WriteParam(aWriter, aParam.mReferentId);
WriteParam(aWriter, aParam.mEventRegionsOverride);
@ -465,7 +465,7 @@ bool ParamTraits<mozilla::layers::WebRenderLayerScrollData>::Read(
ReadParam(aReader, &aResult->mAncestorTransformId) &&
ReadParam(aReader, &aResult->mTransform) &&
ReadParam(aReader, &aResult->mTransformIsPerspective) &&
ReadParam(aReader, &aResult->mVisibleRegion) &&
ReadParam(aReader, &aResult->mVisibleRect) &&
ReadParam(aReader, &aResult->mRemoteDocumentSize) &&
ReadParam(aReader, &aResult->mReferentId) &&
ReadParam(aReader, &aResult->mEventRegionsOverride) &&

View File

@ -92,10 +92,8 @@ class WebRenderLayerScrollData final {
return mEventRegionsOverride;
}
void SetVisibleRegion(const LayerIntRegion& aRegion) {
mVisibleRegion = aRegion;
}
const LayerIntRegion& GetVisibleRegion() const { return mVisibleRegion; }
void SetVisibleRect(const LayerIntRect& aRect) { mVisibleRect = aRect; }
const LayerIntRect& GetVisibleRect() const { return mVisibleRect; }
void SetRemoteDocumentSize(const LayerIntSize& aRemoteDocumentSize) {
mRemoteDocumentSize = aRemoteDocumentSize;
}
@ -206,7 +204,7 @@ class WebRenderLayerScrollData final {
ViewID mAncestorTransformId;
gfx::Matrix4x4 mTransform;
bool mTransformIsPerspective;
LayerIntRegion mVisibleRegion;
LayerIntRect mVisibleRect;
// The remote documents only need their size because their origin is always
// (0, 0).
LayerIntSize mRemoteDocumentSize;

View File

@ -339,15 +339,15 @@ class MOZ_STACK_CLASS WebRenderScrollDataWrapper final {
return false;
}
LayerIntRegion GetVisibleRegion() const {
LayerIntRect GetVisibleRect() const {
MOZ_ASSERT(IsValid());
if (AtBottomLayer()) {
return mLayer->GetVisibleRegion();
return mLayer->GetVisibleRect();
}
return ViewAs<LayerPixel>(
TransformBy(mLayer->GetTransformTyped(), mLayer->GetVisibleRegion()),
TransformBy(mLayer->GetTransformTyped(), mLayer->GetVisibleRect()),
PixelCastJustification::MovingDownToChildren);
}

View File

@ -5286,7 +5286,7 @@ bool nsDisplayOwnLayer::UpdateScrollData(WebRenderScrollData* aData,
: mFrame->PresContext()->PresShell()->GetCumulativeResolution();
LayerIntRect layerBounds =
RoundedOut(bounds * LayoutDeviceToLayerScale(resolution));
aLayerData->SetVisibleRegion(LayerIntRegion(layerBounds));
aLayerData->SetVisibleRect(layerBounds);
}
return true;
}