fix a bug which caused double inset being applied when having non-zero left contentInset.

Summary: [IGListCollectionViewLayout]: fix a bug which caused double inset being applied when having non-zero left contentInset.

Reviewed By: jessesquires

Differential Revision: D4692870

fbshipit-source-id: 1a1a3ccf944a83fea3a706b83f54293346b35c5a
This commit is contained in:
Shiyi Zhao 2017-03-10 18:50:59 -08:00 committed by Facebook Github Bot
parent 222b3bb129
commit 7f652e2c17
2 changed files with 5 additions and 5 deletions

View file

@ -373,7 +373,7 @@ static void adjustZIndexForAttributes(UICollectionViewLayoutAttributes *attribut
}
}
const CGRect frame = CGRectMake(contentInset.left + itemX,
const CGRect frame = CGRectMake(itemX,
itemY + insets.top,
itemWidth,
size.height);
@ -393,7 +393,7 @@ static void adjustZIndexForAttributes(UICollectionViewLayoutAttributes *attribut
}
}
const CGRect headerBounds = CGRectMake(contentInset.left + insets.left,
const CGRect headerBounds = CGRectMake(insets.left,
CGRectGetMinY(rollingSectionBounds) - headerSize.height,
paddedWidth,
headerSize.height);

View file

@ -582,9 +582,9 @@ XCTAssertEqual(CGRectGetHeight(expected), CGRectGetHeight(frame)); \
]],
]];
XCTAssertEqual(self.collectionView.contentSize.height, 40);
IGAssertEqualFrame([self headerForSection:0].frame, 30, 0, 40, 10);
IGAssertEqualFrame([self cellForSection:0 item:0].frame, 30, 10, 40, 10);
IGAssertEqualFrame([self cellForSection:0 item:1].frame, 30, 20, 40, 20);
IGAssertEqualFrame([self headerForSection:0].frame, 0, 0, 40, 10);
IGAssertEqualFrame([self cellForSection:0 item:0].frame, 0, 10, 40, 10);
IGAssertEqualFrame([self cellForSection:0 item:1].frame, 0, 20, 40, 20);
}
- (void)test_ {