Skip trailing position loop, if possible
There's no need to set the trailing position on left-to-right layouts as the nodes will already have what we need (x, y, width, and height). This means we still have an extra cost for reversed layout directions but they are not as common as LTR ones.
This commit is contained in:
@@ -1041,8 +1041,11 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, css_direction
|
||||
paddingAndBorderAxisMain
|
||||
);
|
||||
|
||||
if (mainAxis == CSS_FLEX_DIRECTION_ROW_REVERSE ||
|
||||
mainAxis == CSS_FLEX_DIRECTION_COLUMN_REVERSE) {
|
||||
needsMainTrailingPos = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCrossDimDefined) {
|
||||
node->layout.dimensions[dim[crossAxis]] = fmaxf(
|
||||
@@ -1053,8 +1056,11 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, css_direction
|
||||
paddingAndBorderAxisCross
|
||||
);
|
||||
|
||||
if (crossAxis == CSS_FLEX_DIRECTION_ROW_REVERSE ||
|
||||
crossAxis == CSS_FLEX_DIRECTION_COLUMN_REVERSE) {
|
||||
needsCrossTrailingPos = true;
|
||||
}
|
||||
}
|
||||
|
||||
// <Loop F> Set trailing position if necessary
|
||||
if (needsMainTrailingPos || needsCrossTrailingPos) {
|
||||
|
@@ -909,8 +909,11 @@ var computeLayout = (function() {
|
||||
paddingAndBorderAxisMain
|
||||
);
|
||||
|
||||
if (mainAxis == CSS_FLEX_DIRECTION_ROW_REVERSE ||
|
||||
mainAxis == CSS_FLEX_DIRECTION_COLUMN_REVERSE) {
|
||||
needsMainTrailingPos = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCrossDimDefined) {
|
||||
node.layout[dim[crossAxis]] = fmaxf(
|
||||
@@ -921,8 +924,11 @@ var computeLayout = (function() {
|
||||
paddingAndBorderAxisCross
|
||||
);
|
||||
|
||||
if (crossAxis == CSS_FLEX_DIRECTION_ROW_REVERSE ||
|
||||
crossAxis == CSS_FLEX_DIRECTION_COLUMN_REVERSE) {
|
||||
needsCrossTrailingPos = true;
|
||||
}
|
||||
}
|
||||
|
||||
// <Loop F> Set trailing position if necessary
|
||||
if (needsMainTrailingPos || needsCrossTrailingPos) {
|
||||
|
@@ -858,8 +858,11 @@ public class LayoutEngine {
|
||||
paddingAndBorderAxisMain
|
||||
);
|
||||
|
||||
if (mainAxis == CSS_FLEX_DIRECTION_ROW_REVERSE ||
|
||||
mainAxis == CSS_FLEX_DIRECTION_COLUMN_REVERSE) {
|
||||
needsMainTrailingPos = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isCrossDimDefined) {
|
||||
node.layout.dimensions[dim[crossAxis]] = Math.max(
|
||||
@@ -870,8 +873,11 @@ public class LayoutEngine {
|
||||
paddingAndBorderAxisCross
|
||||
);
|
||||
|
||||
if (crossAxis == CSS_FLEX_DIRECTION_ROW_REVERSE ||
|
||||
crossAxis == CSS_FLEX_DIRECTION_COLUMN_REVERSE) {
|
||||
needsCrossTrailingPos = true;
|
||||
}
|
||||
}
|
||||
|
||||
// <Loop F> Set trailing position if necessary
|
||||
if (needsMainTrailingPos || needsCrossTrailingPos) {
|
||||
|
Reference in New Issue
Block a user