Permalink
Browse files

Remove unnecessary indirection

Reviewed By: IanChilds

Differential Revision: D3741988

fbshipit-source-id: fdb31dc45a478508b41c522f0e1b3ef842971b50
  • Loading branch information...
1 parent 61b21bc commit 50b0943c16bba76084ffd116b852b9b7228f1e8d @emilsjolander emilsjolander committed with Facebook Github Bot 3 Aug 22, 2016
Showing with 5 additions and 17 deletions.
  1. +5 −17 React/CSSLayout/CSSLayout.c
@@ -582,10 +582,6 @@ static CSSDirection resolveDirection(CSSNode *node, CSSDirection parentDirection
return direction;
}
-static CSSFlexDirection getFlexDirection(CSSNode *node) {
- return node->style.flexDirection;
-}
-
static CSSFlexDirection resolveAxis(CSSFlexDirection flexDirection, CSSDirection direction) {
if (direction == CSSDirectionRTL) {
if (flexDirection == CSSFlexDirectionRow) {
@@ -612,10 +608,6 @@ static bool isFlex(CSSNode *node) {
(node->style.flexGrow != 0 || node->style.flexShrink != 0));
}
-static bool isFlexWrap(CSSNode *node) {
- return node->style.flexWrap == CSSWrapTypeWrap;
-}
-
static float getDimWithMargin(CSSNode *node, CSSFlexDirection axis) {
return node->layout.measuredDimensions[dim[axis]] + getLeadingMargin(node, axis) +
getTrailingMargin(node, axis);
@@ -646,10 +638,6 @@ static bool isTrailingPosDefined(CSSNode *node, CSSFlexDirection axis) {
computedEdgeValue(node->style.position, trailing[axis], CSSUndefined));
}
-static bool isMeasureDefined(CSSNode *node) {
- return node->measure;
-}
-
static float getLeadingPosition(CSSNode *node, CSSFlexDirection axis) {
if (isRowDirection(axis) &&
!CSSValueIsUndefined(computedEdgeValue(node->style.position, CSSEdgeStart, CSSUndefined))) {
@@ -719,7 +707,7 @@ static float getRelativePosition(CSSNode *node, CSSFlexDirection axis) {
}
static void setPosition(CSSNode *node, CSSDirection direction) {
- CSSFlexDirection mainAxis = resolveAxis(getFlexDirection(node), direction);
+ CSSFlexDirection mainAxis = resolveAxis(node->style.flexDirection, direction);
CSSFlexDirection crossAxis = getCrossFlexDirection(mainAxis, direction);
node->layout.position[leading[mainAxis]] =
@@ -871,7 +859,7 @@ static void layoutNodeImpl(CSSNode *node,
// For content (text) nodes, determine the dimensions based on the text
// contents.
- if (isMeasureDefined(node)) {
+ if (node->measure) {
float innerWidth = availableWidth - marginAxisRow - paddingAndBorderAxisRow;
float innerHeight = availableHeight - marginAxisColumn - paddingAndBorderAxisColumn;
@@ -985,11 +973,11 @@ static void layoutNodeImpl(CSSNode *node,
}
// STEP 1: CALCULATE VALUES FOR REMAINDER OF ALGORITHM
- CSSFlexDirection mainAxis = resolveAxis(getFlexDirection(node), direction);
+ CSSFlexDirection mainAxis = resolveAxis(node->style.flexDirection, direction);
CSSFlexDirection crossAxis = getCrossFlexDirection(mainAxis, direction);
bool isMainAxisRow = isRowDirection(mainAxis);
CSSJustify justifyContent = node->style.justifyContent;
- bool isNodeFlexWrap = isFlexWrap(node);
+ bool isNodeFlexWrap = node->style.flexWrap == CSSWrapTypeWrap;
CSSNode *firstAbsoluteChild = NULL;
CSSNode *currentAbsoluteChild = NULL;
@@ -2023,7 +2011,7 @@ bool layoutNodeInternal(CSSNode *node,
// most
// expensive to measure, so it's worth avoiding redundant measurements if at
// all possible.
- if (isMeasureDefined(node)) {
+ if (node->measure) {
float marginAxisRow = getMarginAxis(node, CSSFlexDirectionRow);
float marginAxisColumn = getMarginAxis(node, CSSFlexDirectionColumn);

0 comments on commit 50b0943

Please sign in to comment.