Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Minor fixes in cross size determination step
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenhuy committed Jan 17, 2017
1 parent 05085a3 commit b6c171a
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions AsyncDisplayKit/Private/ASStackUnpositionedLayout.mm
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,8 @@ static void computeCrossSizeAndBaseline(const std::vector<ASStackLayoutSpecItem>
CGFloat &crossSize,
CGFloat &baseline)
{
// Early return if the stack has a definite cross size
const auto minCrossSize = crossDimension(style.direction, sizeRange.min);
const auto maxCrossSize = crossDimension(style.direction, sizeRange.max);
if (minCrossSize == maxCrossSize) {
crossSize = minCrossSize;
baseline = 0;
return;
}

// Step 1. Collect all the flex items whose align-self is baseline. Find the largest of the distances
// between each item’s baseline and its hypothetical outer cross-start edge (aka. its ascender value),
Expand All @@ -183,8 +177,9 @@ static void computeCrossSizeAndBaseline(const std::vector<ASStackLayoutSpecItem>
CGFloat baseline = ASStackUnpositionedLayout::baselineForItem(style, item);
maxStartToBaselineDistance = MAX(maxStartToBaselineDistance, baseline);
maxBaselineToEndDistance = MAX(maxBaselineToEndDistance, crossDimension(style.direction, item.layout.size) - baseline);
} else {
maxItemCrossSize = MAX(maxItemCrossSize, crossDimension(style.direction, item.layout.size));
}
maxItemCrossSize = MAX(maxItemCrossSize, crossDimension(style.direction, item.layout.size));
}

// Step 3. The used cross-size of the flex line is the largest of the numbers found in the previous two steps and zero.
Expand Down

0 comments on commit b6c171a

Please sign in to comment.