-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
Summary: some general cleanup Reviewed By: lucasr Differential Revision: D3886866 fbshipit-source-id: e19c1be4af58605933f90b5bf381008338be2236
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1700,16 +1700,17 @@ static void layoutNodeImpl(const CSSNodeRef node, | |
float lineHeight = 0; | ||
for (ii = startIndex; ii < childCount; ii++) { | ||
const CSSNodeRef child = CSSNodeListGet(node->children, ii); | ||
if (child->style.positionType != CSSPositionTypeRelative) { | ||
continue; | ||
} | ||
if (child->lineIndex != i) { | ||
break; | ||
} | ||
if (isLayoutDimDefined(child, crossAxis)) { | ||
lineHeight = fmaxf(lineHeight, | ||
child->layout.measuredDimensions[dim[crossAxis]] + | ||
getMarginAxis(child, crossAxis)); | ||
|
||
if (child->style.positionType == CSSPositionTypeAbsolute) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
emilsjolander
Contributor
|
||
if (child->lineIndex != i) { | ||
break; | ||
} | ||
|
||
if (isLayoutDimDefined(child, crossAxis)) { | ||
lineHeight = fmaxf(lineHeight, | ||
child->layout.measuredDimensions[dim[crossAxis]] + | ||
getMarginAxis(child, crossAxis)); | ||
} | ||
} | ||
} | ||
endIndex = ii; | ||
|
@@ -1718,26 +1719,32 @@ static void layoutNodeImpl(const CSSNodeRef node, | |
if (performLayout) { | ||
for (ii = startIndex; ii < endIndex; ii++) { | ||
const CSSNodeRef child = CSSNodeListGet(node->children, ii); | ||
if (child->style.positionType != CSSPositionTypeRelative) { | ||
continue; | ||
} | ||
|
||
const CSSAlign alignContentAlignItem = getAlignItem(node, child); | ||
if (alignContentAlignItem == CSSAlignFlexStart) { | ||
child->layout.position[pos[crossAxis]] = | ||
currentLead + getLeadingMargin(child, crossAxis); | ||
} else if (alignContentAlignItem == CSSAlignFlexEnd) { | ||
child->layout.position[pos[crossAxis]] = | ||
currentLead + lineHeight - getTrailingMargin(child, crossAxis) - | ||
child->layout.measuredDimensions[dim[crossAxis]]; | ||
} else if (alignContentAlignItem == CSSAlignCenter) { | ||
childHeight = child->layout.measuredDimensions[dim[crossAxis]]; | ||
child->layout.position[pos[crossAxis]] = currentLead + (lineHeight - childHeight) / 2; | ||
} else if (alignContentAlignItem == CSSAlignStretch) { | ||
child->layout.position[pos[crossAxis]] = | ||
currentLead + getLeadingMargin(child, crossAxis); | ||
// TODO(prenaux): Correctly set the height of items with indefinite | ||
// (auto) crossAxis dimension. | ||
if (child->style.positionType == CSSPositionTypeAbsolute) { | ||
switch (getAlignItem(node, child)) { | ||
case CSSAlignFlexStart: | ||
child->layout.position[pos[crossAxis]] = | ||
currentLead + getLeadingMargin(child, crossAxis); | ||
break; | ||
case CSSAlignFlexEnd: | ||
child->layout.position[pos[crossAxis]] = | ||
currentLead + lineHeight - getTrailingMargin(child, crossAxis) - | ||
child->layout.measuredDimensions[dim[crossAxis]]; | ||
break; | ||
case CSSAlignCenter: | ||
childHeight = child->layout.measuredDimensions[dim[crossAxis]]; | ||
child->layout.position[pos[crossAxis]] = | ||
currentLead + (lineHeight - childHeight) / 2; | ||
break; | ||
case CSSAlignStretch: | ||
child->layout.position[pos[crossAxis]] = | ||
currentLead + getLeadingMargin(child, crossAxis); | ||
// TODO(prenaux): Correctly set the height of items with indefinite | ||
// (auto) crossAxis dimension. | ||
break; | ||
default: | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
emilsjolander
Contributor
|
||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
This logic looks different than the logic on the left, is that correct? This part is not just merely cleanup?