Measure with exact measurement when stretch is defined
This commit is contained in:
35
dist/css-layout.h
vendored
35
dist/css-layout.h
vendored
@@ -1064,6 +1064,25 @@ static void layoutNodeImpl(css_node_t* node, float availableWidth, float availab
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If child has no defined size in the cross axis and is set to stretch, set the cross
|
||||||
|
// axis to be measured exactly with the available inner width
|
||||||
|
if (!isMainAxisRow &&
|
||||||
|
!isUndefined(availableInnerWidth) &&
|
||||||
|
!isStyleDimDefined(child, CSS_FLEX_DIRECTION_ROW) &&
|
||||||
|
widthMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, child) == CSS_ALIGN_STRETCH) {
|
||||||
|
childWidth = availableInnerWidth;
|
||||||
|
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
}
|
||||||
|
if (isMainAxisRow &&
|
||||||
|
!isUndefined(availableInnerHeight) &&
|
||||||
|
!isStyleDimDefined(child, CSS_FLEX_DIRECTION_COLUMN) &&
|
||||||
|
heightMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, child) == CSS_ALIGN_STRETCH) {
|
||||||
|
childHeight = availableInnerHeight;
|
||||||
|
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
}
|
||||||
|
|
||||||
// Measure the child
|
// Measure the child
|
||||||
layoutNodeInternal(child, childWidth, childHeight, direction, childWidthMeasureMode, childHeightMeasureMode, false, "measure");
|
layoutNodeInternal(child, childWidth, childHeight, direction, childWidthMeasureMode, childHeightMeasureMode, false, "measure");
|
||||||
|
|
||||||
@@ -1273,7 +1292,13 @@ static void layoutNodeImpl(css_node_t* node, float availableWidth, float availab
|
|||||||
childWidth = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_ROW);
|
childWidth = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_ROW);
|
||||||
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
|
||||||
if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN)) {
|
if (!isUndefined(availableInnerCrossDim) &&
|
||||||
|
!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN) &&
|
||||||
|
heightMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, currentRelativeChild) == CSS_ALIGN_STRETCH) {
|
||||||
|
childHeight = availableInnerCrossDim;
|
||||||
|
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
} else if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN)) {
|
||||||
childHeight = availableInnerCrossDim;
|
childHeight = availableInnerCrossDim;
|
||||||
childHeightMeasureMode = isUndefined(childHeight) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
childHeightMeasureMode = isUndefined(childHeight) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
||||||
} else {
|
} else {
|
||||||
@@ -1284,7 +1309,13 @@ static void layoutNodeImpl(css_node_t* node, float availableWidth, float availab
|
|||||||
childHeight = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN);
|
childHeight = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN);
|
||||||
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
|
||||||
if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_ROW)) {
|
if (!isUndefined(availableInnerCrossDim) &&
|
||||||
|
!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_ROW) &&
|
||||||
|
widthMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, currentRelativeChild) == CSS_ALIGN_STRETCH) {
|
||||||
|
childWidth = availableInnerCrossDim;
|
||||||
|
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
} else if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_ROW)) {
|
||||||
childWidth = availableInnerCrossDim;
|
childWidth = availableInnerCrossDim;
|
||||||
childWidthMeasureMode = isUndefined(childWidth) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
childWidthMeasureMode = isUndefined(childWidth) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
||||||
} else {
|
} else {
|
||||||
|
BIN
dist/css-layout.jar
vendored
BIN
dist/css-layout.jar
vendored
Binary file not shown.
35
dist/css-layout.js
vendored
35
dist/css-layout.js
vendored
@@ -828,6 +828,25 @@ var computeLayout = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If child has no defined size in the cross axis and is set to stretch, set the cross
|
||||||
|
// axis to be measured exactly with the available inner width
|
||||||
|
if (!isMainAxisRow &&
|
||||||
|
!isUndefined(availableInnerWidth) &&
|
||||||
|
!isStyleDimDefined(child, CSS_FLEX_DIRECTION_ROW) &&
|
||||||
|
widthMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, child) == CSS_ALIGN_STRETCH) {
|
||||||
|
childWidth = availableInnerWidth;
|
||||||
|
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
}
|
||||||
|
if (isMainAxisRow &&
|
||||||
|
!isUndefined(availableInnerHeight) &&
|
||||||
|
!isStyleDimDefined(child, CSS_FLEX_DIRECTION_COLUMN) &&
|
||||||
|
heightMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, child) == CSS_ALIGN_STRETCH) {
|
||||||
|
childHeight = availableInnerHeight;
|
||||||
|
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
}
|
||||||
|
|
||||||
// Measure the child
|
// Measure the child
|
||||||
layoutNodeInternal(child, childWidth, childHeight, direction, childWidthMeasureMode, childHeightMeasureMode, false, 'measure');
|
layoutNodeInternal(child, childWidth, childHeight, direction, childWidthMeasureMode, childHeightMeasureMode, false, 'measure');
|
||||||
|
|
||||||
@@ -1037,7 +1056,13 @@ var computeLayout = (function() {
|
|||||||
childWidth = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_ROW);
|
childWidth = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_ROW);
|
||||||
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
|
||||||
if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN)) {
|
if (!isUndefined(availableInnerCrossDim) &&
|
||||||
|
!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN) &&
|
||||||
|
heightMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, currentRelativeChild) == CSS_ALIGN_STRETCH) {
|
||||||
|
childHeight = availableInnerCrossDim;
|
||||||
|
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
} else if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN)) {
|
||||||
childHeight = availableInnerCrossDim;
|
childHeight = availableInnerCrossDim;
|
||||||
childHeightMeasureMode = isUndefined(childHeight) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
childHeightMeasureMode = isUndefined(childHeight) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
||||||
} else {
|
} else {
|
||||||
@@ -1048,7 +1073,13 @@ var computeLayout = (function() {
|
|||||||
childHeight = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN);
|
childHeight = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN);
|
||||||
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
|
||||||
if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_ROW)) {
|
if (!isUndefined(availableInnerCrossDim) &&
|
||||||
|
!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_ROW) &&
|
||||||
|
widthMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, currentRelativeChild) == CSS_ALIGN_STRETCH) {
|
||||||
|
childWidth = availableInnerCrossDim;
|
||||||
|
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
} else if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_ROW)) {
|
||||||
childWidth = availableInnerCrossDim;
|
childWidth = availableInnerCrossDim;
|
||||||
childWidthMeasureMode = isUndefined(childWidth) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
childWidthMeasureMode = isUndefined(childWidth) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
||||||
} else {
|
} else {
|
||||||
|
2
dist/css-layout.min.js
vendored
2
dist/css-layout.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/css-layout.min.js.map
vendored
2
dist/css-layout.min.js.map
vendored
File diff suppressed because one or more lines are too long
35
src/Layout.c
35
src/Layout.c
@@ -859,6 +859,25 @@ static void layoutNodeImpl(css_node_t* node, float availableWidth, float availab
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If child has no defined size in the cross axis and is set to stretch, set the cross
|
||||||
|
// axis to be measured exactly with the available inner width
|
||||||
|
if (!isMainAxisRow &&
|
||||||
|
!isUndefined(availableInnerWidth) &&
|
||||||
|
!isStyleDimDefined(child, CSS_FLEX_DIRECTION_ROW) &&
|
||||||
|
widthMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, child) == CSS_ALIGN_STRETCH) {
|
||||||
|
childWidth = availableInnerWidth;
|
||||||
|
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
}
|
||||||
|
if (isMainAxisRow &&
|
||||||
|
!isUndefined(availableInnerHeight) &&
|
||||||
|
!isStyleDimDefined(child, CSS_FLEX_DIRECTION_COLUMN) &&
|
||||||
|
heightMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, child) == CSS_ALIGN_STRETCH) {
|
||||||
|
childHeight = availableInnerHeight;
|
||||||
|
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
}
|
||||||
|
|
||||||
// Measure the child
|
// Measure the child
|
||||||
layoutNodeInternal(child, childWidth, childHeight, direction, childWidthMeasureMode, childHeightMeasureMode, false, "measure");
|
layoutNodeInternal(child, childWidth, childHeight, direction, childWidthMeasureMode, childHeightMeasureMode, false, "measure");
|
||||||
|
|
||||||
@@ -1068,7 +1087,13 @@ static void layoutNodeImpl(css_node_t* node, float availableWidth, float availab
|
|||||||
childWidth = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_ROW);
|
childWidth = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_ROW);
|
||||||
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
|
||||||
if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN)) {
|
if (!isUndefined(availableInnerCrossDim) &&
|
||||||
|
!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN) &&
|
||||||
|
heightMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, currentRelativeChild) == CSS_ALIGN_STRETCH) {
|
||||||
|
childHeight = availableInnerCrossDim;
|
||||||
|
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
} else if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN)) {
|
||||||
childHeight = availableInnerCrossDim;
|
childHeight = availableInnerCrossDim;
|
||||||
childHeightMeasureMode = isUndefined(childHeight) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
childHeightMeasureMode = isUndefined(childHeight) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
||||||
} else {
|
} else {
|
||||||
@@ -1079,7 +1104,13 @@ static void layoutNodeImpl(css_node_t* node, float availableWidth, float availab
|
|||||||
childHeight = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN);
|
childHeight = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN);
|
||||||
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
|
||||||
if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_ROW)) {
|
if (!isUndefined(availableInnerCrossDim) &&
|
||||||
|
!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_ROW) &&
|
||||||
|
widthMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, currentRelativeChild) == CSS_ALIGN_STRETCH) {
|
||||||
|
childWidth = availableInnerCrossDim;
|
||||||
|
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
} else if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_ROW)) {
|
||||||
childWidth = availableInnerCrossDim;
|
childWidth = availableInnerCrossDim;
|
||||||
childWidthMeasureMode = isUndefined(childWidth) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
childWidthMeasureMode = isUndefined(childWidth) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -809,6 +809,25 @@ var computeLayout = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If child has no defined size in the cross axis and is set to stretch, set the cross
|
||||||
|
// axis to be measured exactly with the available inner width
|
||||||
|
if (!isMainAxisRow &&
|
||||||
|
!isUndefined(availableInnerWidth) &&
|
||||||
|
!isStyleDimDefined(child, CSS_FLEX_DIRECTION_ROW) &&
|
||||||
|
widthMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, child) == CSS_ALIGN_STRETCH) {
|
||||||
|
childWidth = availableInnerWidth;
|
||||||
|
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
}
|
||||||
|
if (isMainAxisRow &&
|
||||||
|
!isUndefined(availableInnerHeight) &&
|
||||||
|
!isStyleDimDefined(child, CSS_FLEX_DIRECTION_COLUMN) &&
|
||||||
|
heightMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, child) == CSS_ALIGN_STRETCH) {
|
||||||
|
childHeight = availableInnerHeight;
|
||||||
|
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
}
|
||||||
|
|
||||||
// Measure the child
|
// Measure the child
|
||||||
layoutNodeInternal(child, childWidth, childHeight, direction, childWidthMeasureMode, childHeightMeasureMode, false, 'measure');
|
layoutNodeInternal(child, childWidth, childHeight, direction, childWidthMeasureMode, childHeightMeasureMode, false, 'measure');
|
||||||
|
|
||||||
@@ -1018,7 +1037,13 @@ var computeLayout = (function() {
|
|||||||
childWidth = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_ROW);
|
childWidth = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_ROW);
|
||||||
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
|
||||||
if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN)) {
|
if (!isUndefined(availableInnerCrossDim) &&
|
||||||
|
!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN) &&
|
||||||
|
heightMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, currentRelativeChild) == CSS_ALIGN_STRETCH) {
|
||||||
|
childHeight = availableInnerCrossDim;
|
||||||
|
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
} else if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN)) {
|
||||||
childHeight = availableInnerCrossDim;
|
childHeight = availableInnerCrossDim;
|
||||||
childHeightMeasureMode = isUndefined(childHeight) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
childHeightMeasureMode = isUndefined(childHeight) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
||||||
} else {
|
} else {
|
||||||
@@ -1029,7 +1054,13 @@ var computeLayout = (function() {
|
|||||||
childHeight = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN);
|
childHeight = updatedMainSize + getMarginAxis(currentRelativeChild, CSS_FLEX_DIRECTION_COLUMN);
|
||||||
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
childHeightMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
|
||||||
if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_ROW)) {
|
if (!isUndefined(availableInnerCrossDim) &&
|
||||||
|
!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_ROW) &&
|
||||||
|
widthMeasureMode == CSS_MEASURE_MODE_EXACTLY &&
|
||||||
|
getAlignItem(node, currentRelativeChild) == CSS_ALIGN_STRETCH) {
|
||||||
|
childWidth = availableInnerCrossDim;
|
||||||
|
childWidthMeasureMode = CSS_MEASURE_MODE_EXACTLY;
|
||||||
|
} else if (!isStyleDimDefined(currentRelativeChild, CSS_FLEX_DIRECTION_ROW)) {
|
||||||
childWidth = availableInnerCrossDim;
|
childWidth = availableInnerCrossDim;
|
||||||
childWidthMeasureMode = isUndefined(childWidth) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
childWidthMeasureMode = isUndefined(childWidth) ? CSS_MEASURE_MODE_UNDEFINED : CSS_MEASURE_MODE_AT_MOST;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -743,6 +743,25 @@ namespace Facebook.CSSLayout
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If child has no defined size in the cross axis and is set to stretch, set the cross
|
||||||
|
// axis to be measured exactly with the available inner width
|
||||||
|
if (!isMainAxisRow &&
|
||||||
|
!float.IsNaN(availableInnerWidth) &&
|
||||||
|
!(child.style.dimensions[dim[CSS_FLEX_DIRECTION_ROW]] >= 0.0) &&
|
||||||
|
widthMeasureMode == CSSMeasureMode.Exactly &&
|
||||||
|
getAlignItem(node, child) == CSSAlign.Stretch) {
|
||||||
|
childWidth = availableInnerWidth;
|
||||||
|
childWidthMeasureMode = CSSMeasureMode.Exactly;
|
||||||
|
}
|
||||||
|
if (isMainAxisRow &&
|
||||||
|
!float.IsNaN(availableInnerHeight) &&
|
||||||
|
!(child.style.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]] >= 0.0) &&
|
||||||
|
heightMeasureMode == CSSMeasureMode.Exactly &&
|
||||||
|
getAlignItem(node, child) == CSSAlign.Stretch) {
|
||||||
|
childHeight = availableInnerHeight;
|
||||||
|
childHeightMeasureMode = CSSMeasureMode.Exactly;
|
||||||
|
}
|
||||||
|
|
||||||
// Measure the child
|
// Measure the child
|
||||||
layoutNodeInternal(layoutContext, child, childWidth, childHeight, direction, childWidthMeasureMode, childHeightMeasureMode, false, "measure");
|
layoutNodeInternal(layoutContext, child, childWidth, childHeight, direction, childWidthMeasureMode, childHeightMeasureMode, false, "measure");
|
||||||
|
|
||||||
@@ -952,7 +971,13 @@ namespace Facebook.CSSLayout
|
|||||||
childWidth = updatedMainSize + (currentRelativeChild.style.margin.getWithFallback(leadingSpacing[CSS_FLEX_DIRECTION_ROW], leading[CSS_FLEX_DIRECTION_ROW]) + currentRelativeChild.style.margin.getWithFallback(trailingSpacing[CSS_FLEX_DIRECTION_ROW], trailing[CSS_FLEX_DIRECTION_ROW]));
|
childWidth = updatedMainSize + (currentRelativeChild.style.margin.getWithFallback(leadingSpacing[CSS_FLEX_DIRECTION_ROW], leading[CSS_FLEX_DIRECTION_ROW]) + currentRelativeChild.style.margin.getWithFallback(trailingSpacing[CSS_FLEX_DIRECTION_ROW], trailing[CSS_FLEX_DIRECTION_ROW]));
|
||||||
childWidthMeasureMode = CSSMeasureMode.Exactly;
|
childWidthMeasureMode = CSSMeasureMode.Exactly;
|
||||||
|
|
||||||
if (!(currentRelativeChild.style.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]] >= 0.0)) {
|
if (!float.IsNaN(availableInnerCrossDim) &&
|
||||||
|
!(currentRelativeChild.style.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]] >= 0.0) &&
|
||||||
|
heightMeasureMode == CSSMeasureMode.Exactly &&
|
||||||
|
getAlignItem(node, currentRelativeChild) == CSSAlign.Stretch) {
|
||||||
|
childHeight = availableInnerCrossDim;
|
||||||
|
childHeightMeasureMode = CSSMeasureMode.Exactly;
|
||||||
|
} else if (!(currentRelativeChild.style.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]] >= 0.0)) {
|
||||||
childHeight = availableInnerCrossDim;
|
childHeight = availableInnerCrossDim;
|
||||||
childHeightMeasureMode = float.IsNaN(childHeight) ? CSSMeasureMode.Undefined : CSSMeasureMode.AtMost;
|
childHeightMeasureMode = float.IsNaN(childHeight) ? CSSMeasureMode.Undefined : CSSMeasureMode.AtMost;
|
||||||
} else {
|
} else {
|
||||||
@@ -963,7 +988,13 @@ namespace Facebook.CSSLayout
|
|||||||
childHeight = updatedMainSize + (currentRelativeChild.style.margin.getWithFallback(leadingSpacing[CSS_FLEX_DIRECTION_COLUMN], leading[CSS_FLEX_DIRECTION_COLUMN]) + currentRelativeChild.style.margin.getWithFallback(trailingSpacing[CSS_FLEX_DIRECTION_COLUMN], trailing[CSS_FLEX_DIRECTION_COLUMN]));
|
childHeight = updatedMainSize + (currentRelativeChild.style.margin.getWithFallback(leadingSpacing[CSS_FLEX_DIRECTION_COLUMN], leading[CSS_FLEX_DIRECTION_COLUMN]) + currentRelativeChild.style.margin.getWithFallback(trailingSpacing[CSS_FLEX_DIRECTION_COLUMN], trailing[CSS_FLEX_DIRECTION_COLUMN]));
|
||||||
childHeightMeasureMode = CSSMeasureMode.Exactly;
|
childHeightMeasureMode = CSSMeasureMode.Exactly;
|
||||||
|
|
||||||
if (!(currentRelativeChild.style.dimensions[dim[CSS_FLEX_DIRECTION_ROW]] >= 0.0)) {
|
if (!float.IsNaN(availableInnerCrossDim) &&
|
||||||
|
!(currentRelativeChild.style.dimensions[dim[CSS_FLEX_DIRECTION_ROW]] >= 0.0) &&
|
||||||
|
widthMeasureMode == CSSMeasureMode.Exactly &&
|
||||||
|
getAlignItem(node, currentRelativeChild) == CSSAlign.Stretch) {
|
||||||
|
childWidth = availableInnerCrossDim;
|
||||||
|
childWidthMeasureMode = CSSMeasureMode.Exactly;
|
||||||
|
} else if (!(currentRelativeChild.style.dimensions[dim[CSS_FLEX_DIRECTION_ROW]] >= 0.0)) {
|
||||||
childWidth = availableInnerCrossDim;
|
childWidth = availableInnerCrossDim;
|
||||||
childWidthMeasureMode = float.IsNaN(childWidth) ? CSSMeasureMode.Undefined : CSSMeasureMode.AtMost;
|
childWidthMeasureMode = float.IsNaN(childWidth) ? CSSMeasureMode.Undefined : CSSMeasureMode.AtMost;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -699,6 +699,25 @@ public class LayoutEngine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If child has no defined size in the cross axis and is set to stretch, set the cross
|
||||||
|
// axis to be measured exactly with the available inner width
|
||||||
|
if (!isMainAxisRow &&
|
||||||
|
!Float.isNaN(availableInnerWidth) &&
|
||||||
|
!(child.style.dimensions[dim[CSS_FLEX_DIRECTION_ROW]] >= 0.0) &&
|
||||||
|
widthMeasureMode == CSSMeasureMode.EXACTLY &&
|
||||||
|
getAlignItem(node, child) == CSSAlign.STRETCH) {
|
||||||
|
childWidth = availableInnerWidth;
|
||||||
|
childWidthMeasureMode = CSSMeasureMode.EXACTLY;
|
||||||
|
}
|
||||||
|
if (isMainAxisRow &&
|
||||||
|
!Float.isNaN(availableInnerHeight) &&
|
||||||
|
!(child.style.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]] >= 0.0) &&
|
||||||
|
heightMeasureMode == CSSMeasureMode.EXACTLY &&
|
||||||
|
getAlignItem(node, child) == CSSAlign.STRETCH) {
|
||||||
|
childHeight = availableInnerHeight;
|
||||||
|
childHeightMeasureMode = CSSMeasureMode.EXACTLY;
|
||||||
|
}
|
||||||
|
|
||||||
// Measure the child
|
// Measure the child
|
||||||
layoutNodeInternal(layoutContext, child, childWidth, childHeight, direction, childWidthMeasureMode, childHeightMeasureMode, false, "measure");
|
layoutNodeInternal(layoutContext, child, childWidth, childHeight, direction, childWidthMeasureMode, childHeightMeasureMode, false, "measure");
|
||||||
|
|
||||||
@@ -908,7 +927,13 @@ public class LayoutEngine {
|
|||||||
childWidth = updatedMainSize + (currentRelativeChild.style.margin.getWithFallback(leadingSpacing[CSS_FLEX_DIRECTION_ROW], leading[CSS_FLEX_DIRECTION_ROW]) + currentRelativeChild.style.margin.getWithFallback(trailingSpacing[CSS_FLEX_DIRECTION_ROW], trailing[CSS_FLEX_DIRECTION_ROW]));
|
childWidth = updatedMainSize + (currentRelativeChild.style.margin.getWithFallback(leadingSpacing[CSS_FLEX_DIRECTION_ROW], leading[CSS_FLEX_DIRECTION_ROW]) + currentRelativeChild.style.margin.getWithFallback(trailingSpacing[CSS_FLEX_DIRECTION_ROW], trailing[CSS_FLEX_DIRECTION_ROW]));
|
||||||
childWidthMeasureMode = CSSMeasureMode.EXACTLY;
|
childWidthMeasureMode = CSSMeasureMode.EXACTLY;
|
||||||
|
|
||||||
if (!(currentRelativeChild.style.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]] >= 0.0)) {
|
if (!Float.isNaN(availableInnerCrossDim) &&
|
||||||
|
!(currentRelativeChild.style.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]] >= 0.0) &&
|
||||||
|
heightMeasureMode == CSSMeasureMode.EXACTLY &&
|
||||||
|
getAlignItem(node, currentRelativeChild) == CSSAlign.STRETCH) {
|
||||||
|
childHeight = availableInnerCrossDim;
|
||||||
|
childHeightMeasureMode = CSSMeasureMode.EXACTLY;
|
||||||
|
} else if (!(currentRelativeChild.style.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]] >= 0.0)) {
|
||||||
childHeight = availableInnerCrossDim;
|
childHeight = availableInnerCrossDim;
|
||||||
childHeightMeasureMode = Float.isNaN(childHeight) ? CSSMeasureMode.UNDEFINED : CSSMeasureMode.AT_MOST;
|
childHeightMeasureMode = Float.isNaN(childHeight) ? CSSMeasureMode.UNDEFINED : CSSMeasureMode.AT_MOST;
|
||||||
} else {
|
} else {
|
||||||
@@ -919,7 +944,13 @@ public class LayoutEngine {
|
|||||||
childHeight = updatedMainSize + (currentRelativeChild.style.margin.getWithFallback(leadingSpacing[CSS_FLEX_DIRECTION_COLUMN], leading[CSS_FLEX_DIRECTION_COLUMN]) + currentRelativeChild.style.margin.getWithFallback(trailingSpacing[CSS_FLEX_DIRECTION_COLUMN], trailing[CSS_FLEX_DIRECTION_COLUMN]));
|
childHeight = updatedMainSize + (currentRelativeChild.style.margin.getWithFallback(leadingSpacing[CSS_FLEX_DIRECTION_COLUMN], leading[CSS_FLEX_DIRECTION_COLUMN]) + currentRelativeChild.style.margin.getWithFallback(trailingSpacing[CSS_FLEX_DIRECTION_COLUMN], trailing[CSS_FLEX_DIRECTION_COLUMN]));
|
||||||
childHeightMeasureMode = CSSMeasureMode.EXACTLY;
|
childHeightMeasureMode = CSSMeasureMode.EXACTLY;
|
||||||
|
|
||||||
if (!(currentRelativeChild.style.dimensions[dim[CSS_FLEX_DIRECTION_ROW]] >= 0.0)) {
|
if (!Float.isNaN(availableInnerCrossDim) &&
|
||||||
|
!(currentRelativeChild.style.dimensions[dim[CSS_FLEX_DIRECTION_ROW]] >= 0.0) &&
|
||||||
|
widthMeasureMode == CSSMeasureMode.EXACTLY &&
|
||||||
|
getAlignItem(node, currentRelativeChild) == CSSAlign.STRETCH) {
|
||||||
|
childWidth = availableInnerCrossDim;
|
||||||
|
childWidthMeasureMode = CSSMeasureMode.EXACTLY;
|
||||||
|
} else if (!(currentRelativeChild.style.dimensions[dim[CSS_FLEX_DIRECTION_ROW]] >= 0.0)) {
|
||||||
childWidth = availableInnerCrossDim;
|
childWidth = availableInnerCrossDim;
|
||||||
childWidthMeasureMode = Float.isNaN(childWidth) ? CSSMeasureMode.UNDEFINED : CSSMeasureMode.AT_MOST;
|
childWidthMeasureMode = Float.isNaN(childWidth) ? CSSMeasureMode.UNDEFINED : CSSMeasureMode.AT_MOST;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user