Commit 302db475 authored by Mark Cogan's avatar Mark Cogan Committed by Commit Bot

[iOS] Copy layout attributes in GridLayout.

Sometimes this console message is logged by UIKit:

  UICollectionViewFlowLayout has cached frame mismatch for index path <NSIndexPath: 0xc000000001000016> {length = 2, path = 0 - 8} - cached value: {{21.399999999999991, 901.27999999999997}, {151.20000000000005, 181.79999999999995}}; expected value: {{13, 873}, {168, 202}}

  This is likely occurring because the flow layout subclass GridLayout is modifying attributes returned by UICollectionViewFlowLayout without copying them

This CL copies those attributes.

Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I8b9ba4d4ce4fc01d5960e1321de693fe23e08139
Reviewed-on: https://chromium-review.googlesource.com/1087756Reviewed-by: default avataredchin <edchin@chromium.org>
Commit-Queue: edchin <edchin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565766}
parent 027ae1d4
......@@ -97,8 +97,8 @@ finalLayoutAttributesForDisappearingItemAtIndexPath:
// index path is changing. For an item whose index path is changing, this
// method is called before
// -initialLayoutAttributesForAppearingItemAtIndexPath:
UICollectionViewLayoutAttributes* attributes =
[super finalLayoutAttributesForDisappearingItemAtIndexPath:itemIndexPath];
UICollectionViewLayoutAttributes* attributes = [[super
finalLayoutAttributesForDisappearingItemAtIndexPath:itemIndexPath] copy];
// Disappearing items that aren't being deleted just use the default
// attributes.
if (![self.indexPathsOfDeletingItems containsObject:itemIndexPath]) {
......@@ -123,8 +123,8 @@ initialLayoutAttributesForAppearingItemAtIndexPath:(NSIndexPath*)itemIndexPath {
// index path is changing. For an item whose index path is changing, this
// method is called after
// -finalLayoutAttributesForDisappearingItemAtIndexPath:
UICollectionViewLayoutAttributes* attributes =
[super initialLayoutAttributesForAppearingItemAtIndexPath:itemIndexPath];
UICollectionViewLayoutAttributes* attributes = [[super
initialLayoutAttributesForAppearingItemAtIndexPath:itemIndexPath] copy];
// Appearing items that aren't being inserted just use the default
// attributes.
if (![self.indexPathsOfInsertingItems containsObject:itemIndexPath]) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment