mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Merge branch 'master' into update-objc
This commit is contained in:
@@ -45,9 +45,9 @@ typedef NS_ENUM(NSUInteger, ASStackLayoutAlignItems) {
|
||||
ASStackLayoutAlignItemsCenter,
|
||||
/** Expand children to fill cross axis */
|
||||
ASStackLayoutAlignItemsStretch,
|
||||
/** Children align to their first baseline. Only available for horizontal stack nodes */
|
||||
/** Children align to their first baseline. Only available for horizontal stack spec */
|
||||
ASStackLayoutAlignItemsBaselineFirst,
|
||||
/** Children align to their last baseline. Only available for horizontal stack nodes */
|
||||
/** Children align to their last baseline. Only available for horizontal stack spec */
|
||||
ASStackLayoutAlignItemsBaselineLast,
|
||||
};
|
||||
|
||||
@@ -66,8 +66,4 @@ typedef NS_ENUM(NSUInteger, ASStackLayoutAlignSelf) {
|
||||
ASStackLayoutAlignSelfCenter,
|
||||
/** Expand to fill cross axis */
|
||||
ASStackLayoutAlignSelfStretch,
|
||||
/** Children align to their first baseline. Only available for horizontal stack nodes */
|
||||
ASStackLayoutAlignSelfBaselineFirst,
|
||||
/** Children align to their last baseline. Only available for horizontal stack nodes */
|
||||
ASStackLayoutAlignSelfBaselineLast,
|
||||
};
|
||||
|
||||
@@ -101,7 +101,6 @@
|
||||
std::vector<id<ASLayoutable>> stackChildren = std::vector<id<ASLayoutable>>();
|
||||
for (id<ASLayoutable> child in self.children) {
|
||||
stackChildren.push_back(child);
|
||||
needsBaselinePass |= child.alignSelf == ASStackLayoutAlignSelfBaselineFirst || child.alignSelf == ASStackLayoutAlignSelfBaselineLast;
|
||||
}
|
||||
|
||||
const auto unpositionedLayout = ASStackUnpositionedLayout::compute(stackChildren, style, constrainedSize);
|
||||
@@ -109,12 +108,21 @@
|
||||
|
||||
CGSize finalSize = CGSizeZero;
|
||||
NSArray *sublayouts = nil;
|
||||
if (needsBaselinePass) {
|
||||
const auto baselinePositionedLayout = ASStackBaselinePositionedLayout::compute(positionedLayout, style, constrainedSize);
|
||||
|
||||
// regardless of whether or not this stack aligns to baseline, we should let ASStackBaselinePositionedLayout::compute find the max ascender
|
||||
// and min descender in case this spec is a child in another spec that wants to align to a baseline.
|
||||
const auto baselinePositionedLayout = ASStackBaselinePositionedLayout::compute(positionedLayout, style, constrainedSize);
|
||||
if (self.direction == ASStackLayoutDirectionVertical) {
|
||||
ASDN::MutexLocker l(_propertyLock);
|
||||
self.ascender = [[self.children firstObject] ascender];
|
||||
self.descender = [[self.children lastObject] descender];
|
||||
} else {
|
||||
ASDN::MutexLocker l(_propertyLock);
|
||||
self.ascender = baselinePositionedLayout.ascender;
|
||||
self.descender = baselinePositionedLayout.descender;
|
||||
|
||||
}
|
||||
|
||||
if (needsBaselinePass) {
|
||||
finalSize = directionSize(style.direction, unpositionedLayout.stackDimensionSum, baselinePositionedLayout.crossSize);
|
||||
sublayouts = [NSArray arrayWithObjects:&baselinePositionedLayout.sublayouts[0] count:baselinePositionedLayout.sublayouts.size()];
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user