mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 03:09:56 +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] : @[];
|
||||
|
||||
_elementToRectTable = [ASRectTable rectTableForWeakObjectPointers];
|
||||
for (ASLayout *layout in sublayouts) {
|
||||
[_elementToRectTable setRect:layout.frame forKey:layout.layoutElement];
|
||||
if (_sublayouts.count > 0) {
|
||||
_elementToRectTable = [ASRectTable rectTableForWeakObjectPointers];
|
||||
for (ASLayout *layout in sublayouts) {
|
||||
[_elementToRectTable setRect:layout.frame forKey:layout.layoutElement];
|
||||
}
|
||||
}
|
||||
|
||||
_flattened = NO;
|
||||
@ -251,7 +253,7 @@ static std::atomic_bool static_retainsSublayoutLayoutElements = ATOMIC_VAR_INIT(
|
||||
|
||||
- (CGRect)frameForElement:(id<ASLayoutElement>)layoutElement
|
||||
{
|
||||
return [_elementToRectTable rectForKey:layoutElement];
|
||||
return _elementToRectTable ? [_elementToRectTable rectForKey:layoutElement] : CGRectNull;
|
||||
}
|
||||
|
||||
- (CGRect)frame
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user