mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Fixed: optimization with layoutSubviews and viewWillLayout
This commit is contained in:
+14
-3
@@ -128,7 +128,8 @@ var DOMElementPrototype = nil,
|
||||
|
||||
var CPViewFlags = { },
|
||||
CPViewHasCustomDrawRect = 1 << 0,
|
||||
CPViewHasCustomLayoutSubviews = 1 << 1;
|
||||
CPViewHasCustomLayoutSubviews = 1 << 1,
|
||||
CPViewHasCustomViewWillLayout = 1 << 2;
|
||||
|
||||
var CPViewHighDPIDrawingEnabled = YES;
|
||||
|
||||
@@ -317,6 +318,12 @@ var CPViewHighDPIDrawingEnabled = YES;
|
||||
|| [theClass instanceMethodForSelector:@selector(viewWillDraw)] !== [CPView instanceMethodForSelector:@selector(viewWillDraw)])
|
||||
flags |= CPViewHasCustomDrawRect;
|
||||
|
||||
if ([theClass instanceMethodForSelector:@selector(viewWillLayout)] !== [CPView instanceMethodForSelector:@selector(viewWillLayout)])
|
||||
flags |= CPViewHasCustomViewWillLayout;
|
||||
|
||||
if ([theClass instanceMethodForSelector:@selector(layoutSubviews)] !== [CPView instanceMethodForSelector:@selector(layoutSubviews)])
|
||||
flags |= CPViewHasCustomLayoutSubviews;
|
||||
|
||||
CPViewFlags[classUID] = flags;
|
||||
}
|
||||
|
||||
@@ -2637,8 +2644,12 @@ setBoundsOrigin:
|
||||
{
|
||||
_needsLayout = NO;
|
||||
|
||||
[self viewWillLayout];
|
||||
[self layoutSubviews];
|
||||
if (_viewClassFlags & CPViewHasCustomViewWillLayout)
|
||||
[self viewWillLayout];
|
||||
|
||||
if (_viewClassFlags & CPViewHasCustomLayoutSubviews)
|
||||
[self layoutSubviews];
|
||||
|
||||
[self viewDidLayout];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user