[ASStackLayoutSpec] Performance improvements (#2470)

* Initial commit for ASStackLayoutSpec improvements

* Remove the lock in ASStackLayoutSpec and make the ASStackLayoutSpecStyle const

I think we don't need lock here as the style already has a lock while we set the value

* Add ASStackLayoutSpecItem  that replaces layout specific items

* Prevent baseline pass if not needed

* Update comments
This commit is contained in:
Michael Schneider
2016-10-30 12:07:18 -07:00
committed by GitHub
parent ca203158da
commit 611894329a
7 changed files with 185 additions and 140 deletions

View File

@@ -13,13 +13,15 @@
#import "ASStackPositionedLayout.h"
struct ASStackBaselinePositionedLayout {
const std::vector<ASLayout *> sublayouts;
const CGFloat crossSize;
const CGFloat ascender;
const CGFloat descender;
const std::vector<ASStackLayoutSpecItem> items;
const CGFloat crossSize;
const CGFloat ascender;
const CGFloat descender;
/** Given a positioned layout, computes each child position using baseline alignment. */
static ASStackBaselinePositionedLayout compute(const ASStackPositionedLayout &positionedLayout,
const ASStackLayoutSpecStyle &style,
const ASSizeRange &constrainedSize);
static BOOL needsBaselineAlignment(const ASStackLayoutSpecStyle &style);
};