mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 11:20:18 +00:00
If a layout has no sublayouts, don't bother initializing its rect table (#394)
This commit is contained in:
parent
f7a6b7ae84
commit
23ee9de615
@ -124,9 +124,11 @@ static std::atomic_bool static_retainsSublayoutLayoutElements = ATOMIC_VAR_INIT(
|
|||||||
|
|
||||||
_sublayouts = sublayouts != nil ? [sublayouts copy] : @[];
|
_sublayouts = sublayouts != nil ? [sublayouts copy] : @[];
|
||||||
|
|
||||||
_elementToRectTable = [ASRectTable rectTableForWeakObjectPointers];
|
if (_sublayouts.count > 0) {
|
||||||
for (ASLayout *layout in sublayouts) {
|
_elementToRectTable = [ASRectTable rectTableForWeakObjectPointers];
|
||||||
[_elementToRectTable setRect:layout.frame forKey:layout.layoutElement];
|
for (ASLayout *layout in sublayouts) {
|
||||||
|
[_elementToRectTable setRect:layout.frame forKey:layout.layoutElement];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_flattened = NO;
|
_flattened = NO;
|
||||||
@ -251,7 +253,7 @@ static std::atomic_bool static_retainsSublayoutLayoutElements = ATOMIC_VAR_INIT(
|
|||||||
|
|
||||||
- (CGRect)frameForElement:(id<ASLayoutElement>)layoutElement
|
- (CGRect)frameForElement:(id<ASLayoutElement>)layoutElement
|
||||||
{
|
{
|
||||||
return [_elementToRectTable rectForKey:layoutElement];
|
return _elementToRectTable ? [_elementToRectTable rectForKey:layoutElement] : CGRectNull;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGRect)frame
|
- (CGRect)frame
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user