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:
Lucas Rocha
2015-09-08 15:33:26 +01:00
parent 1ab785b7a3
commit 877a2838a6
3 changed files with 24 additions and 6 deletions

View File

@@ -909,7 +909,10 @@ var computeLayout = (function() {
paddingAndBorderAxisMain
);
needsMainTrailingPos = true;
if (mainAxis == CSS_FLEX_DIRECTION_ROW_REVERSE ||
mainAxis == CSS_FLEX_DIRECTION_COLUMN_REVERSE) {
needsMainTrailingPos = true;
}
}
if (!isCrossDimDefined) {
@@ -921,7 +924,10 @@ var computeLayout = (function() {
paddingAndBorderAxisCross
);
needsCrossTrailingPos = true;
if (crossAxis == CSS_FLEX_DIRECTION_ROW_REVERSE ||
crossAxis == CSS_FLEX_DIRECTION_COLUMN_REVERSE) {
needsCrossTrailingPos = true;
}
}
// <Loop F> Set trailing position if necessary