C++ style enums 9/N: FlexDirection (#1394)
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1394 X-link: https://github.com/facebook/react-native/pull/39484 Moves internal usages of YGDirection to Direction. bypass-github-export-checks Changelog: [Internal] Reviewed By: rshest Differential Revision: D49336066 fbshipit-source-id: b49e1ffcd79a427e36ea8d2c26debaa98ef3e4c9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9b99e4fc22
commit
6ec790dd1b
@@ -46,4 +46,5 @@ Pod::Spec.new do |spec|
|
||||
|
||||
all_header_files = 'yoga/**/*.h'
|
||||
spec.private_header_files = Dir.glob(all_header_files) - Dir.glob(public_header_files)
|
||||
spec.preserve_paths = [all_header_files]
|
||||
end
|
||||
|
@@ -89,10 +89,10 @@ ACCESSOR_TEST(
|
||||
|
||||
ACCESSOR_TEST(
|
||||
flexDirection,
|
||||
YGFlexDirectionColumn,
|
||||
YGFlexDirectionColumnReverse,
|
||||
YGFlexDirectionRowReverse,
|
||||
YGFlexDirectionRow)
|
||||
FlexDirection::Column,
|
||||
FlexDirection::ColumnReverse,
|
||||
FlexDirection::RowReverse,
|
||||
FlexDirection::Row)
|
||||
|
||||
ACCESSOR_TEST(
|
||||
justifyContent,
|
||||
|
@@ -439,10 +439,10 @@ void YGNodeStyleSetFlexDirection(
|
||||
const YGNodeRef node,
|
||||
const YGFlexDirection flexDirection) {
|
||||
updateStyle<MSVC_HINT(flexDirection)>(
|
||||
node, &Style::flexDirection, flexDirection);
|
||||
node, &Style::flexDirection, scopedEnum(flexDirection));
|
||||
}
|
||||
YGFlexDirection YGNodeStyleGetFlexDirection(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().flexDirection();
|
||||
return unscopedEnum(resolveRef(node)->getStyle().flexDirection());
|
||||
}
|
||||
|
||||
void YGNodeStyleSetJustifyContent(
|
||||
|
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <yoga/algorithm/FlexDirection.h>
|
||||
#include <yoga/algorithm/ResolveValue.h>
|
||||
#include <yoga/enums/FlexDirection.h>
|
||||
#include <yoga/node/Node.h>
|
||||
#include <yoga/numeric/Comparison.h>
|
||||
#include <yoga/numeric/FloatOptional.h>
|
||||
@@ -17,7 +18,7 @@ namespace facebook::yoga {
|
||||
|
||||
inline float paddingAndBorderForAxis(
|
||||
const yoga::Node* const node,
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) {
|
||||
return (node->getLeadingPaddingAndBorder(axis, widthSize) +
|
||||
node->getTrailingPaddingAndBorder(axis, widthSize))
|
||||
@@ -26,7 +27,7 @@ inline float paddingAndBorderForAxis(
|
||||
|
||||
inline FloatOptional boundAxisWithinMinAndMax(
|
||||
const yoga::Node* const node,
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const FloatOptional value,
|
||||
const float axisSize) {
|
||||
FloatOptional min;
|
||||
@@ -59,7 +60,7 @@ inline FloatOptional boundAxisWithinMinAndMax(
|
||||
// go below the padding and border amount.
|
||||
inline float boundAxis(
|
||||
const yoga::Node* const node,
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float value,
|
||||
const float axisSize,
|
||||
const float widthSize) {
|
||||
|
@@ -51,7 +51,7 @@ bool calculateLayoutInternal(
|
||||
|
||||
static inline float dimensionWithMargin(
|
||||
const yoga::Node* const node,
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) {
|
||||
return node->getLayout().measuredDimensions[dimension(axis)] +
|
||||
(node->getLeadingMargin(axis, widthSize) +
|
||||
@@ -61,7 +61,7 @@ static inline float dimensionWithMargin(
|
||||
|
||||
static inline bool styleDefinesDimension(
|
||||
const yoga::Node* const node,
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float ownerSize) {
|
||||
bool isUndefined =
|
||||
yoga::isUndefined(node->getResolvedDimension(dimension(axis)).value);
|
||||
@@ -78,7 +78,7 @@ static inline bool styleDefinesDimension(
|
||||
|
||||
static inline bool isLayoutDimensionDefined(
|
||||
const yoga::Node* const node,
|
||||
const YGFlexDirection axis) {
|
||||
const FlexDirection axis) {
|
||||
const float value = node->getLayout().measuredDimensions[dimension(axis)];
|
||||
return !yoga::isUndefined(value) && value >= 0.0f;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ static inline bool isLayoutDimensionDefined(
|
||||
static void setChildTrailingPosition(
|
||||
const yoga::Node* const node,
|
||||
yoga::Node* const child,
|
||||
const YGFlexDirection axis) {
|
||||
const FlexDirection axis) {
|
||||
const float size = child->getLayout().measuredDimensions[dimension(axis)];
|
||||
child->setLayoutPosition(
|
||||
node->getLayout().measuredDimensions[dimension(axis)] - size -
|
||||
@@ -96,7 +96,7 @@ static void setChildTrailingPosition(
|
||||
|
||||
static void constrainMaxSizeForMode(
|
||||
const yoga::Node* const node,
|
||||
const enum YGFlexDirection axis,
|
||||
const enum FlexDirection axis,
|
||||
const float ownerAxisSize,
|
||||
const float ownerWidth,
|
||||
MeasureMode* mode,
|
||||
@@ -134,7 +134,7 @@ static void computeFlexBasisForChild(
|
||||
LayoutData& layoutMarkerData,
|
||||
const uint32_t depth,
|
||||
const uint32_t generationCount) {
|
||||
const YGFlexDirection mainAxis =
|
||||
const FlexDirection mainAxis =
|
||||
resolveDirection(node->getStyle().flexDirection(), direction);
|
||||
const bool isMainAxisRow = isRow(mainAxis);
|
||||
const float mainAxisSize = isMainAxisRow ? width : height;
|
||||
@@ -148,9 +148,9 @@ static void computeFlexBasisForChild(
|
||||
const FloatOptional resolvedFlexBasis =
|
||||
yoga::resolveValue(child->resolveFlexBasisPtr(), mainAxisownerSize);
|
||||
const bool isRowStyleDimDefined =
|
||||
styleDefinesDimension(child, YGFlexDirectionRow, ownerWidth);
|
||||
styleDefinesDimension(child, FlexDirection::Row, ownerWidth);
|
||||
const bool isColumnStyleDimDefined =
|
||||
styleDefinesDimension(child, YGFlexDirectionColumn, ownerHeight);
|
||||
styleDefinesDimension(child, FlexDirection::Column, ownerHeight);
|
||||
|
||||
if (!resolvedFlexBasis.isUndefined() && !yoga::isUndefined(mainAxisSize)) {
|
||||
if (child->getLayout().computedFlexBasis.isUndefined() ||
|
||||
@@ -165,7 +165,7 @@ static void computeFlexBasisForChild(
|
||||
} else if (isMainAxisRow && isRowStyleDimDefined) {
|
||||
// The width is definite, so use that as the flex basis.
|
||||
const FloatOptional paddingAndBorder = FloatOptional(
|
||||
paddingAndBorderForAxis(child, YGFlexDirectionRow, ownerWidth));
|
||||
paddingAndBorderForAxis(child, FlexDirection::Row, ownerWidth));
|
||||
|
||||
child->setLayoutComputedFlexBasis(yoga::maxOrDefined(
|
||||
yoga::resolveValue(
|
||||
@@ -174,7 +174,7 @@ static void computeFlexBasisForChild(
|
||||
} else if (!isMainAxisRow && isColumnStyleDimDefined) {
|
||||
// The height is definite, so use that as the flex basis.
|
||||
const FloatOptional paddingAndBorder = FloatOptional(
|
||||
paddingAndBorderForAxis(child, YGFlexDirectionColumn, ownerWidth));
|
||||
paddingAndBorderForAxis(child, FlexDirection::Column, ownerWidth));
|
||||
child->setLayoutComputedFlexBasis(yoga::maxOrDefined(
|
||||
yoga::resolveValue(
|
||||
child->getResolvedDimensions()[YGDimensionHeight], ownerHeight),
|
||||
@@ -188,9 +188,9 @@ static void computeFlexBasisForChild(
|
||||
childHeightMeasureMode = MeasureMode::Undefined;
|
||||
|
||||
auto marginRow =
|
||||
child->getMarginForAxis(YGFlexDirectionRow, ownerWidth).unwrap();
|
||||
child->getMarginForAxis(FlexDirection::Row, ownerWidth).unwrap();
|
||||
auto marginColumn =
|
||||
child->getMarginForAxis(YGFlexDirectionColumn, ownerWidth).unwrap();
|
||||
child->getMarginForAxis(FlexDirection::Column, ownerWidth).unwrap();
|
||||
|
||||
if (isRowStyleDimDefined) {
|
||||
childWidth =
|
||||
@@ -279,14 +279,14 @@ static void computeFlexBasisForChild(
|
||||
|
||||
constrainMaxSizeForMode(
|
||||
child,
|
||||
YGFlexDirectionRow,
|
||||
FlexDirection::Row,
|
||||
ownerWidth,
|
||||
ownerWidth,
|
||||
&childWidthMeasureMode,
|
||||
&childWidth);
|
||||
constrainMaxSizeForMode(
|
||||
child,
|
||||
YGFlexDirectionColumn,
|
||||
FlexDirection::Column,
|
||||
ownerHeight,
|
||||
ownerWidth,
|
||||
&childHeightMeasureMode,
|
||||
@@ -325,9 +325,9 @@ static void layoutAbsoluteChild(
|
||||
LayoutData& layoutMarkerData,
|
||||
const uint32_t depth,
|
||||
const uint32_t generationCount) {
|
||||
const YGFlexDirection mainAxis =
|
||||
const FlexDirection mainAxis =
|
||||
resolveDirection(node->getStyle().flexDirection(), direction);
|
||||
const YGFlexDirection crossAxis = resolveCrossDirection(mainAxis, direction);
|
||||
const FlexDirection crossAxis = resolveCrossDirection(mainAxis, direction);
|
||||
const bool isMainAxisRow = isRow(mainAxis);
|
||||
|
||||
float childWidth = YGUndefined;
|
||||
@@ -335,11 +335,11 @@ static void layoutAbsoluteChild(
|
||||
MeasureMode childWidthMeasureMode = MeasureMode::Undefined;
|
||||
MeasureMode childHeightMeasureMode = MeasureMode::Undefined;
|
||||
|
||||
auto marginRow = child->getMarginForAxis(YGFlexDirectionRow, width).unwrap();
|
||||
auto marginRow = child->getMarginForAxis(FlexDirection::Row, width).unwrap();
|
||||
auto marginColumn =
|
||||
child->getMarginForAxis(YGFlexDirectionColumn, width).unwrap();
|
||||
child->getMarginForAxis(FlexDirection::Column, width).unwrap();
|
||||
|
||||
if (styleDefinesDimension(child, YGFlexDirectionRow, width)) {
|
||||
if (styleDefinesDimension(child, FlexDirection::Row, width)) {
|
||||
childWidth = yoga::resolveValue(
|
||||
child->getResolvedDimensions()[YGDimensionWidth], width)
|
||||
.unwrap() +
|
||||
@@ -347,20 +347,20 @@ static void layoutAbsoluteChild(
|
||||
} else {
|
||||
// If the child doesn't have a specified width, compute the width based on
|
||||
// the left/right offsets if they're defined.
|
||||
if (child->isLeadingPositionDefined(YGFlexDirectionRow) &&
|
||||
child->isTrailingPosDefined(YGFlexDirectionRow)) {
|
||||
if (child->isLeadingPositionDefined(FlexDirection::Row) &&
|
||||
child->isTrailingPosDefined(FlexDirection::Row)) {
|
||||
childWidth = node->getLayout().measuredDimensions[YGDimensionWidth] -
|
||||
(node->getLeadingBorder(YGFlexDirectionRow) +
|
||||
node->getTrailingBorder(YGFlexDirectionRow)) -
|
||||
(child->getLeadingPosition(YGFlexDirectionRow, width) +
|
||||
child->getTrailingPosition(YGFlexDirectionRow, width))
|
||||
(node->getLeadingBorder(FlexDirection::Row) +
|
||||
node->getTrailingBorder(FlexDirection::Row)) -
|
||||
(child->getLeadingPosition(FlexDirection::Row, width) +
|
||||
child->getTrailingPosition(FlexDirection::Row, width))
|
||||
.unwrap();
|
||||
childWidth =
|
||||
boundAxis(child, YGFlexDirectionRow, childWidth, width, width);
|
||||
boundAxis(child, FlexDirection::Row, childWidth, width, width);
|
||||
}
|
||||
}
|
||||
|
||||
if (styleDefinesDimension(child, YGFlexDirectionColumn, height)) {
|
||||
if (styleDefinesDimension(child, FlexDirection::Column, height)) {
|
||||
childHeight = yoga::resolveValue(
|
||||
child->getResolvedDimensions()[YGDimensionHeight], height)
|
||||
.unwrap() +
|
||||
@@ -368,16 +368,16 @@ static void layoutAbsoluteChild(
|
||||
} else {
|
||||
// If the child doesn't have a specified height, compute the height based on
|
||||
// the top/bottom offsets if they're defined.
|
||||
if (child->isLeadingPositionDefined(YGFlexDirectionColumn) &&
|
||||
child->isTrailingPosDefined(YGFlexDirectionColumn)) {
|
||||
if (child->isLeadingPositionDefined(FlexDirection::Column) &&
|
||||
child->isTrailingPosDefined(FlexDirection::Column)) {
|
||||
childHeight = node->getLayout().measuredDimensions[YGDimensionHeight] -
|
||||
(node->getLeadingBorder(YGFlexDirectionColumn) +
|
||||
node->getTrailingBorder(YGFlexDirectionColumn)) -
|
||||
(child->getLeadingPosition(YGFlexDirectionColumn, height) +
|
||||
child->getTrailingPosition(YGFlexDirectionColumn, height))
|
||||
(node->getLeadingBorder(FlexDirection::Column) +
|
||||
node->getTrailingBorder(FlexDirection::Column)) -
|
||||
(child->getLeadingPosition(FlexDirection::Column, height) +
|
||||
child->getTrailingPosition(FlexDirection::Column, height))
|
||||
.unwrap();
|
||||
childHeight =
|
||||
boundAxis(child, YGFlexDirectionColumn, childHeight, height, width);
|
||||
boundAxis(child, FlexDirection::Column, childHeight, height, width);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,9 +432,9 @@ static void layoutAbsoluteChild(
|
||||
depth,
|
||||
generationCount);
|
||||
childWidth = child->getLayout().measuredDimensions[YGDimensionWidth] +
|
||||
child->getMarginForAxis(YGFlexDirectionRow, width).unwrap();
|
||||
child->getMarginForAxis(FlexDirection::Row, width).unwrap();
|
||||
childHeight = child->getLayout().measuredDimensions[YGDimensionHeight] +
|
||||
child->getMarginForAxis(YGFlexDirectionColumn, width).unwrap();
|
||||
child->getMarginForAxis(FlexDirection::Column, width).unwrap();
|
||||
}
|
||||
|
||||
calculateLayoutInternal(
|
||||
@@ -586,12 +586,12 @@ static void measureNodeWithMeasureFunc(
|
||||
// Don't bother sizing the text if both dimensions are already defined.
|
||||
node->setLayoutMeasuredDimension(
|
||||
boundAxis(
|
||||
node, YGFlexDirectionRow, availableWidth, ownerWidth, ownerWidth),
|
||||
node, FlexDirection::Row, availableWidth, ownerWidth, ownerWidth),
|
||||
YGDimensionWidth);
|
||||
node->setLayoutMeasuredDimension(
|
||||
boundAxis(
|
||||
node,
|
||||
YGFlexDirectionColumn,
|
||||
FlexDirection::Column,
|
||||
availableHeight,
|
||||
ownerHeight,
|
||||
ownerWidth),
|
||||
@@ -620,7 +620,7 @@ static void measureNodeWithMeasureFunc(
|
||||
node->setLayoutMeasuredDimension(
|
||||
boundAxis(
|
||||
node,
|
||||
YGFlexDirectionRow,
|
||||
FlexDirection::Row,
|
||||
(widthMeasureMode == MeasureMode::Undefined ||
|
||||
widthMeasureMode == MeasureMode::AtMost)
|
||||
? measuredSize.width + paddingAndBorderAxisRow
|
||||
@@ -632,7 +632,7 @@ static void measureNodeWithMeasureFunc(
|
||||
node->setLayoutMeasuredDimension(
|
||||
boundAxis(
|
||||
node,
|
||||
YGFlexDirectionColumn,
|
||||
FlexDirection::Column,
|
||||
(heightMeasureMode == MeasureMode::Undefined ||
|
||||
heightMeasureMode == MeasureMode::AtMost)
|
||||
? measuredSize.height + paddingAndBorderAxisColumn
|
||||
@@ -663,7 +663,7 @@ static void measureNodeWithoutChildren(
|
||||
border[YGEdgeRight];
|
||||
}
|
||||
node->setLayoutMeasuredDimension(
|
||||
boundAxis(node, YGFlexDirectionRow, width, ownerWidth, ownerWidth),
|
||||
boundAxis(node, FlexDirection::Row, width, ownerWidth, ownerWidth),
|
||||
YGDimensionWidth);
|
||||
|
||||
float height = availableHeight;
|
||||
@@ -673,7 +673,7 @@ static void measureNodeWithoutChildren(
|
||||
border[YGEdgeBottom];
|
||||
}
|
||||
node->setLayoutMeasuredDimension(
|
||||
boundAxis(node, YGFlexDirectionColumn, height, ownerHeight, ownerWidth),
|
||||
boundAxis(node, FlexDirection::Column, height, ownerHeight, ownerWidth),
|
||||
YGDimensionHeight);
|
||||
}
|
||||
|
||||
@@ -694,7 +694,7 @@ static bool measureNodeWithFixedSize(
|
||||
node->setLayoutMeasuredDimension(
|
||||
boundAxis(
|
||||
node,
|
||||
YGFlexDirectionRow,
|
||||
FlexDirection::Row,
|
||||
yoga::isUndefined(availableWidth) ||
|
||||
(widthMeasureMode == MeasureMode::AtMost &&
|
||||
availableWidth < 0.0f)
|
||||
@@ -707,7 +707,7 @@ static bool measureNodeWithFixedSize(
|
||||
node->setLayoutMeasuredDimension(
|
||||
boundAxis(
|
||||
node,
|
||||
YGFlexDirectionColumn,
|
||||
FlexDirection::Column,
|
||||
yoga::isUndefined(availableHeight) ||
|
||||
(heightMeasureMode == MeasureMode::AtMost &&
|
||||
availableHeight < 0.0f)
|
||||
@@ -772,7 +772,7 @@ static float computeFlexBasisForChildren(
|
||||
MeasureMode widthMeasureMode,
|
||||
MeasureMode heightMeasureMode,
|
||||
Direction direction,
|
||||
YGFlexDirection mainAxis,
|
||||
FlexDirection mainAxis,
|
||||
bool performLayout,
|
||||
LayoutData& layoutMarkerData,
|
||||
const uint32_t depth,
|
||||
@@ -859,8 +859,8 @@ static float computeFlexBasisForChildren(
|
||||
static float distributeFreeSpaceSecondPass(
|
||||
FlexLine& flexLine,
|
||||
yoga::Node* const node,
|
||||
const YGFlexDirection mainAxis,
|
||||
const YGFlexDirection crossAxis,
|
||||
const FlexDirection mainAxis,
|
||||
const FlexDirection crossAxis,
|
||||
const float mainAxisownerSize,
|
||||
const float availableInnerMainDim,
|
||||
const float availableInnerCrossDim,
|
||||
@@ -1047,7 +1047,7 @@ static float distributeFreeSpaceSecondPass(
|
||||
// is removed from the remaingfreespace.
|
||||
static void distributeFreeSpaceFirstPass(
|
||||
FlexLine& flexLine,
|
||||
const YGFlexDirection mainAxis,
|
||||
const FlexDirection mainAxis,
|
||||
const float mainAxisownerSize,
|
||||
const float availableInnerMainDim,
|
||||
const float availableInnerWidth) {
|
||||
@@ -1153,8 +1153,8 @@ static void distributeFreeSpaceFirstPass(
|
||||
static void resolveFlexibleLength(
|
||||
yoga::Node* const node,
|
||||
FlexLine& flexLine,
|
||||
const YGFlexDirection mainAxis,
|
||||
const YGFlexDirection crossAxis,
|
||||
const FlexDirection mainAxis,
|
||||
const FlexDirection crossAxis,
|
||||
const float mainAxisownerSize,
|
||||
const float availableInnerMainDim,
|
||||
const float availableInnerCrossDim,
|
||||
@@ -1200,8 +1200,8 @@ static void YGJustifyMainAxis(
|
||||
yoga::Node* const node,
|
||||
FlexLine& flexLine,
|
||||
const size_t startOfLineIndex,
|
||||
const YGFlexDirection mainAxis,
|
||||
const YGFlexDirection crossAxis,
|
||||
const FlexDirection mainAxis,
|
||||
const FlexDirection crossAxis,
|
||||
const MeasureMode measureModeMainDim,
|
||||
const MeasureMode measureModeCrossDim,
|
||||
const float mainAxisownerSize,
|
||||
@@ -1370,13 +1370,13 @@ static void YGJustifyMainAxis(
|
||||
const float ascent = calculateBaseline(child) +
|
||||
child
|
||||
->getLeadingMargin(
|
||||
YGFlexDirectionColumn, availableInnerWidth)
|
||||
FlexDirection::Column, availableInnerWidth)
|
||||
.unwrap();
|
||||
const float descent =
|
||||
child->getLayout().measuredDimensions[YGDimensionHeight] +
|
||||
child
|
||||
->getMarginForAxis(
|
||||
YGFlexDirectionColumn, availableInnerWidth)
|
||||
FlexDirection::Column, availableInnerWidth)
|
||||
.unwrap() -
|
||||
ascent;
|
||||
|
||||
@@ -1509,10 +1509,10 @@ static void calculateLayoutImpl(
|
||||
const Direction direction = node->resolveDirection(ownerDirection);
|
||||
node->setLayoutDirection(direction);
|
||||
|
||||
const YGFlexDirection flexRowDirection =
|
||||
resolveDirection(YGFlexDirectionRow, direction);
|
||||
const YGFlexDirection flexColumnDirection =
|
||||
resolveDirection(YGFlexDirectionColumn, direction);
|
||||
const FlexDirection flexRowDirection =
|
||||
resolveDirection(FlexDirection::Row, direction);
|
||||
const FlexDirection flexColumnDirection =
|
||||
resolveDirection(FlexDirection::Column, direction);
|
||||
|
||||
const YGEdge startEdge =
|
||||
direction == Direction::LTR ? YGEdgeLeft : YGEdgeRight;
|
||||
@@ -1600,9 +1600,9 @@ static void calculateLayoutImpl(
|
||||
node->setLayoutHadOverflow(false);
|
||||
|
||||
// STEP 1: CALCULATE VALUES FOR REMAINDER OF ALGORITHM
|
||||
const YGFlexDirection mainAxis =
|
||||
const FlexDirection mainAxis =
|
||||
resolveDirection(node->getStyle().flexDirection(), direction);
|
||||
const YGFlexDirection crossAxis = resolveCrossDirection(mainAxis, direction);
|
||||
const FlexDirection crossAxis = resolveCrossDirection(mainAxis, direction);
|
||||
const bool isMainAxisRow = isRow(mainAxis);
|
||||
const bool isNodeFlexWrap = node->getStyle().flexWrap() != YGWrapNoWrap;
|
||||
|
||||
@@ -2087,13 +2087,13 @@ static void calculateLayoutImpl(
|
||||
const float ascent = calculateBaseline(child) +
|
||||
child
|
||||
->getLeadingMargin(
|
||||
YGFlexDirectionColumn, availableInnerWidth)
|
||||
FlexDirection::Column, availableInnerWidth)
|
||||
.unwrap();
|
||||
const float descent =
|
||||
child->getLayout().measuredDimensions[YGDimensionHeight] +
|
||||
child
|
||||
->getMarginForAxis(
|
||||
YGFlexDirectionColumn, availableInnerWidth)
|
||||
FlexDirection::Column, availableInnerWidth)
|
||||
.unwrap() -
|
||||
ascent;
|
||||
maxAscentForCurrentLine =
|
||||
@@ -2201,7 +2201,7 @@ static void calculateLayoutImpl(
|
||||
calculateBaseline(child) +
|
||||
child
|
||||
->getLeadingPosition(
|
||||
YGFlexDirectionColumn, availableInnerCrossDim)
|
||||
FlexDirection::Column, availableInnerCrossDim)
|
||||
.unwrap(),
|
||||
YGEdgeTop);
|
||||
|
||||
@@ -2224,7 +2224,7 @@ static void calculateLayoutImpl(
|
||||
node->setLayoutMeasuredDimension(
|
||||
boundAxis(
|
||||
node,
|
||||
YGFlexDirectionRow,
|
||||
FlexDirection::Row,
|
||||
availableWidth - marginAxisRow,
|
||||
ownerWidth,
|
||||
ownerWidth),
|
||||
@@ -2233,7 +2233,7 @@ static void calculateLayoutImpl(
|
||||
node->setLayoutMeasuredDimension(
|
||||
boundAxis(
|
||||
node,
|
||||
YGFlexDirectionColumn,
|
||||
FlexDirection::Column,
|
||||
availableHeight - marginAxisColumn,
|
||||
ownerHeight,
|
||||
ownerWidth),
|
||||
@@ -2343,10 +2343,10 @@ static void calculateLayoutImpl(
|
||||
}
|
||||
|
||||
// STEP 11: SETTING TRAILING POSITIONS FOR CHILDREN
|
||||
const bool needsMainTrailingPos = mainAxis == YGFlexDirectionRowReverse ||
|
||||
mainAxis == YGFlexDirectionColumnReverse;
|
||||
const bool needsCrossTrailingPos = crossAxis == YGFlexDirectionRowReverse ||
|
||||
crossAxis == YGFlexDirectionColumnReverse;
|
||||
const bool needsMainTrailingPos = mainAxis == FlexDirection::RowReverse ||
|
||||
mainAxis == FlexDirection::ColumnReverse;
|
||||
const bool needsCrossTrailingPos = crossAxis == FlexDirection::RowReverse ||
|
||||
crossAxis == FlexDirection::ColumnReverse;
|
||||
|
||||
// Set trailing position if necessary.
|
||||
if (needsMainTrailingPos || needsCrossTrailingPos) {
|
||||
@@ -2449,9 +2449,9 @@ bool calculateLayoutInternal(
|
||||
// measurements if at all possible.
|
||||
if (node->hasMeasureFunc()) {
|
||||
const float marginAxisRow =
|
||||
node->getMarginForAxis(YGFlexDirectionRow, ownerWidth).unwrap();
|
||||
node->getMarginForAxis(FlexDirection::Row, ownerWidth).unwrap();
|
||||
const float marginAxisColumn =
|
||||
node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth).unwrap();
|
||||
node->getMarginForAxis(FlexDirection::Column, ownerWidth).unwrap();
|
||||
|
||||
// First, try to use the layout cache.
|
||||
if (canUseCachedMeasurement(
|
||||
@@ -2680,11 +2680,11 @@ void calculateLayout(
|
||||
float width = YGUndefined;
|
||||
MeasureMode widthMeasureMode = MeasureMode::Undefined;
|
||||
const auto& maxDimensions = node->getStyle().maxDimensions();
|
||||
if (styleDefinesDimension(node, YGFlexDirectionRow, ownerWidth)) {
|
||||
if (styleDefinesDimension(node, FlexDirection::Row, ownerWidth)) {
|
||||
width = (yoga::resolveValue(
|
||||
node->getResolvedDimension(dimension(YGFlexDirectionRow)),
|
||||
node->getResolvedDimension(dimension(FlexDirection::Row)),
|
||||
ownerWidth) +
|
||||
node->getMarginForAxis(YGFlexDirectionRow, ownerWidth))
|
||||
node->getMarginForAxis(FlexDirection::Row, ownerWidth))
|
||||
.unwrap();
|
||||
widthMeasureMode = MeasureMode::Exactly;
|
||||
} else if (!yoga::resolveValue(maxDimensions[YGDimensionWidth], ownerWidth)
|
||||
@@ -2700,11 +2700,11 @@ void calculateLayout(
|
||||
|
||||
float height = YGUndefined;
|
||||
MeasureMode heightMeasureMode = MeasureMode::Undefined;
|
||||
if (styleDefinesDimension(node, YGFlexDirectionColumn, ownerHeight)) {
|
||||
if (styleDefinesDimension(node, FlexDirection::Column, ownerHeight)) {
|
||||
height = (yoga::resolveValue(
|
||||
node->getResolvedDimension(dimension(YGFlexDirectionColumn)),
|
||||
node->getResolvedDimension(dimension(FlexDirection::Column)),
|
||||
ownerHeight) +
|
||||
node->getMarginForAxis(YGFlexDirectionColumn, ownerWidth))
|
||||
node->getMarginForAxis(FlexDirection::Column, ownerWidth))
|
||||
.unwrap();
|
||||
heightMeasureMode = MeasureMode::Exactly;
|
||||
} else if (!yoga::resolveValue(maxDimensions[YGDimensionHeight], ownerHeight)
|
||||
|
@@ -10,84 +10,85 @@
|
||||
#include <yoga/Yoga.h>
|
||||
|
||||
#include <yoga/debug/AssertFatal.h>
|
||||
#include <yoga/enums/FlexDirection.h>
|
||||
|
||||
namespace facebook::yoga {
|
||||
|
||||
inline bool isRow(const YGFlexDirection flexDirection) {
|
||||
return flexDirection == YGFlexDirectionRow ||
|
||||
flexDirection == YGFlexDirectionRowReverse;
|
||||
inline bool isRow(const FlexDirection flexDirection) {
|
||||
return flexDirection == FlexDirection::Row ||
|
||||
flexDirection == FlexDirection::RowReverse;
|
||||
}
|
||||
|
||||
inline bool isColumn(const YGFlexDirection flexDirection) {
|
||||
return flexDirection == YGFlexDirectionColumn ||
|
||||
flexDirection == YGFlexDirectionColumnReverse;
|
||||
inline bool isColumn(const FlexDirection flexDirection) {
|
||||
return flexDirection == FlexDirection::Column ||
|
||||
flexDirection == FlexDirection::ColumnReverse;
|
||||
}
|
||||
|
||||
inline YGFlexDirection resolveDirection(
|
||||
const YGFlexDirection flexDirection,
|
||||
inline FlexDirection resolveDirection(
|
||||
const FlexDirection flexDirection,
|
||||
const Direction direction) {
|
||||
if (direction == Direction::RTL) {
|
||||
if (flexDirection == YGFlexDirectionRow) {
|
||||
return YGFlexDirectionRowReverse;
|
||||
} else if (flexDirection == YGFlexDirectionRowReverse) {
|
||||
return YGFlexDirectionRow;
|
||||
if (flexDirection == FlexDirection::Row) {
|
||||
return FlexDirection::RowReverse;
|
||||
} else if (flexDirection == FlexDirection::RowReverse) {
|
||||
return FlexDirection::Row;
|
||||
}
|
||||
}
|
||||
|
||||
return flexDirection;
|
||||
}
|
||||
|
||||
inline YGFlexDirection resolveCrossDirection(
|
||||
const YGFlexDirection flexDirection,
|
||||
inline FlexDirection resolveCrossDirection(
|
||||
const FlexDirection flexDirection,
|
||||
const Direction direction) {
|
||||
return isColumn(flexDirection)
|
||||
? resolveDirection(YGFlexDirectionRow, direction)
|
||||
: YGFlexDirectionColumn;
|
||||
? resolveDirection(FlexDirection::Row, direction)
|
||||
: FlexDirection::Column;
|
||||
}
|
||||
|
||||
inline YGEdge leadingEdge(const YGFlexDirection flexDirection) {
|
||||
inline YGEdge leadingEdge(const FlexDirection flexDirection) {
|
||||
switch (flexDirection) {
|
||||
case YGFlexDirectionColumn:
|
||||
case FlexDirection::Column:
|
||||
return YGEdgeTop;
|
||||
case YGFlexDirectionColumnReverse:
|
||||
case FlexDirection::ColumnReverse:
|
||||
return YGEdgeBottom;
|
||||
case YGFlexDirectionRow:
|
||||
case FlexDirection::Row:
|
||||
return YGEdgeLeft;
|
||||
case YGFlexDirectionRowReverse:
|
||||
case FlexDirection::RowReverse:
|
||||
return YGEdgeRight;
|
||||
}
|
||||
|
||||
fatalWithMessage("Invalid YGFlexDirection");
|
||||
fatalWithMessage("Invalid FlexDirection");
|
||||
}
|
||||
|
||||
inline YGEdge trailingEdge(const YGFlexDirection flexDirection) {
|
||||
inline YGEdge trailingEdge(const FlexDirection flexDirection) {
|
||||
switch (flexDirection) {
|
||||
case YGFlexDirectionColumn:
|
||||
case FlexDirection::Column:
|
||||
return YGEdgeBottom;
|
||||
case YGFlexDirectionColumnReverse:
|
||||
case FlexDirection::ColumnReverse:
|
||||
return YGEdgeTop;
|
||||
case YGFlexDirectionRow:
|
||||
case FlexDirection::Row:
|
||||
return YGEdgeRight;
|
||||
case YGFlexDirectionRowReverse:
|
||||
case FlexDirection::RowReverse:
|
||||
return YGEdgeLeft;
|
||||
}
|
||||
|
||||
fatalWithMessage("Invalid YGFlexDirection");
|
||||
fatalWithMessage("Invalid FlexDirection");
|
||||
}
|
||||
|
||||
inline YGDimension dimension(const YGFlexDirection flexDirection) {
|
||||
inline YGDimension dimension(const FlexDirection flexDirection) {
|
||||
switch (flexDirection) {
|
||||
case YGFlexDirectionColumn:
|
||||
case FlexDirection::Column:
|
||||
return YGDimensionHeight;
|
||||
case YGFlexDirectionColumnReverse:
|
||||
case FlexDirection::ColumnReverse:
|
||||
return YGDimensionHeight;
|
||||
case YGFlexDirectionRow:
|
||||
case FlexDirection::Row:
|
||||
return YGDimensionWidth;
|
||||
case YGFlexDirectionRowReverse:
|
||||
case FlexDirection::RowReverse:
|
||||
return YGDimensionWidth;
|
||||
}
|
||||
|
||||
fatalWithMessage("Invalid YGFlexDirection");
|
||||
fatalWithMessage("Invalid FlexDirection");
|
||||
}
|
||||
|
||||
} // namespace facebook::yoga
|
||||
|
@@ -30,7 +30,7 @@ FlexLine calculateFlexLine(
|
||||
size_t endOfLineIndex = startOfLineIndex;
|
||||
|
||||
float sizeConsumedIncludingMinConstraint = 0;
|
||||
const YGFlexDirection mainAxis = resolveDirection(
|
||||
const FlexDirection mainAxis = resolveDirection(
|
||||
node->getStyle().flexDirection(), node->resolveDirection(ownerDirection));
|
||||
const bool isNodeFlexWrap = node->getStyle().flexWrap() != YGWrapNoWrap;
|
||||
const float gap = node->getGapForAxis(mainAxis, availableInnerWidth).unwrap();
|
||||
|
@@ -142,9 +142,7 @@ void nodeToString(
|
||||
const auto& style = node->getStyle();
|
||||
if (style.flexDirection() != yoga::Node{}.getStyle().flexDirection()) {
|
||||
appendFormattedString(
|
||||
str,
|
||||
"flex-direction: %s; ",
|
||||
YGFlexDirectionToString(style.flexDirection()));
|
||||
str, "flex-direction: %s; ", toString(style.flexDirection()));
|
||||
}
|
||||
if (style.justifyContent() != yoga::Node{}.getStyle().justifyContent()) {
|
||||
appendFormattedString(
|
||||
|
@@ -114,7 +114,7 @@ CompactValue Node::computeColumnGap(
|
||||
}
|
||||
|
||||
FloatOptional Node::getLeadingPosition(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float axisSize) const {
|
||||
auto leadingPosition = isRow(axis)
|
||||
? computeEdgeValueForRow(
|
||||
@@ -128,7 +128,7 @@ FloatOptional Node::getLeadingPosition(
|
||||
}
|
||||
|
||||
FloatOptional Node::getTrailingPosition(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float axisSize) const {
|
||||
auto trailingPosition = isRow(axis)
|
||||
? computeEdgeValueForRow(
|
||||
@@ -141,7 +141,7 @@ FloatOptional Node::getTrailingPosition(
|
||||
return yoga::resolveValue(trailingPosition, axisSize);
|
||||
}
|
||||
|
||||
bool Node::isLeadingPositionDefined(const YGFlexDirection axis) const {
|
||||
bool Node::isLeadingPositionDefined(const FlexDirection axis) const {
|
||||
auto leadingPosition = isRow(axis)
|
||||
? computeEdgeValueForRow(
|
||||
style_.position(),
|
||||
@@ -153,7 +153,7 @@ bool Node::isLeadingPositionDefined(const YGFlexDirection axis) const {
|
||||
return !leadingPosition.isUndefined();
|
||||
}
|
||||
|
||||
bool Node::isTrailingPosDefined(const YGFlexDirection axis) const {
|
||||
bool Node::isTrailingPosDefined(const FlexDirection axis) const {
|
||||
auto trailingPosition = isRow(axis)
|
||||
? computeEdgeValueForRow(
|
||||
style_.position(),
|
||||
@@ -166,7 +166,7 @@ bool Node::isTrailingPosDefined(const YGFlexDirection axis) const {
|
||||
}
|
||||
|
||||
FloatOptional Node::getLeadingMargin(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const {
|
||||
auto leadingMargin = isRow(axis)
|
||||
? computeEdgeValueForRow(
|
||||
@@ -181,7 +181,7 @@ FloatOptional Node::getLeadingMargin(
|
||||
}
|
||||
|
||||
FloatOptional Node::getTrailingMargin(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const {
|
||||
auto trailingMargin = isRow(axis)
|
||||
? computeEdgeValueForRow(
|
||||
@@ -197,13 +197,13 @@ FloatOptional Node::getTrailingMargin(
|
||||
}
|
||||
|
||||
FloatOptional Node::getMarginForAxis(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const {
|
||||
return getLeadingMargin(axis, widthSize) + getTrailingMargin(axis, widthSize);
|
||||
}
|
||||
|
||||
FloatOptional Node::getGapForAxis(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const {
|
||||
auto gap = isRow(axis)
|
||||
? computeColumnGap(style_.gap(), CompactValue::ofZero())
|
||||
@@ -355,7 +355,7 @@ void Node::setLayoutDimension(float dimensionValue, YGDimension dimension) {
|
||||
// If both left and right are defined, then use left. Otherwise return +left or
|
||||
// -right depending on which is defined.
|
||||
FloatOptional Node::relativePosition(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float axisSize) const {
|
||||
if (isLeadingPositionDefined(axis)) {
|
||||
return getLeadingPosition(axis, axisSize);
|
||||
@@ -377,9 +377,9 @@ void Node::setPosition(
|
||||
* values. */
|
||||
const Direction directionRespectingRoot =
|
||||
owner_ != nullptr ? direction : Direction::LTR;
|
||||
const YGFlexDirection mainAxis =
|
||||
const FlexDirection mainAxis =
|
||||
yoga::resolveDirection(style_.flexDirection(), directionRespectingRoot);
|
||||
const YGFlexDirection crossAxis =
|
||||
const FlexDirection crossAxis =
|
||||
yoga::resolveCrossDirection(mainAxis, directionRespectingRoot);
|
||||
|
||||
// Here we should check for `YGPositionTypeStatic` and in this case zero inset
|
||||
@@ -406,7 +406,7 @@ void Node::setPosition(
|
||||
trailingEdge(crossAxis));
|
||||
}
|
||||
|
||||
YGValue Node::marginLeadingValue(const YGFlexDirection axis) const {
|
||||
YGValue Node::marginLeadingValue(const FlexDirection axis) const {
|
||||
if (isRow(axis) && !style_.margin()[YGEdgeStart].isUndefined()) {
|
||||
return style_.margin()[YGEdgeStart];
|
||||
} else {
|
||||
@@ -414,7 +414,7 @@ YGValue Node::marginLeadingValue(const YGFlexDirection axis) const {
|
||||
}
|
||||
}
|
||||
|
||||
YGValue Node::marginTrailingValue(const YGFlexDirection axis) const {
|
||||
YGValue Node::marginTrailingValue(const FlexDirection axis) const {
|
||||
if (isRow(axis) && !style_.margin()[YGEdgeEnd].isUndefined()) {
|
||||
return style_.margin()[YGEdgeEnd];
|
||||
} else {
|
||||
@@ -526,7 +526,7 @@ bool Node::isNodeFlexible() {
|
||||
(resolveFlexGrow() != 0 || resolveFlexShrink() != 0));
|
||||
}
|
||||
|
||||
float Node::getLeadingBorder(const YGFlexDirection axis) const {
|
||||
float Node::getLeadingBorder(const FlexDirection axis) const {
|
||||
YGValue leadingBorder = isRow(axis)
|
||||
? computeEdgeValueForRow(
|
||||
style_.border(),
|
||||
@@ -538,7 +538,7 @@ float Node::getLeadingBorder(const YGFlexDirection axis) const {
|
||||
return fmaxf(leadingBorder.value, 0.0f);
|
||||
}
|
||||
|
||||
float Node::getTrailingBorder(const YGFlexDirection axis) const {
|
||||
float Node::getTrailingBorder(const FlexDirection axis) const {
|
||||
YGValue trailingBorder = isRow(axis)
|
||||
? computeEdgeValueForRow(
|
||||
style_.border(),
|
||||
@@ -551,7 +551,7 @@ float Node::getTrailingBorder(const YGFlexDirection axis) const {
|
||||
}
|
||||
|
||||
FloatOptional Node::getLeadingPadding(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const {
|
||||
auto leadingPadding = isRow(axis)
|
||||
? computeEdgeValueForRow(
|
||||
@@ -566,7 +566,7 @@ FloatOptional Node::getLeadingPadding(
|
||||
}
|
||||
|
||||
FloatOptional Node::getTrailingPadding(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const {
|
||||
auto trailingPadding = isRow(axis)
|
||||
? computeEdgeValueForRow(
|
||||
@@ -581,14 +581,14 @@ FloatOptional Node::getTrailingPadding(
|
||||
}
|
||||
|
||||
FloatOptional Node::getLeadingPaddingAndBorder(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const {
|
||||
return getLeadingPadding(axis, widthSize) +
|
||||
FloatOptional(getLeadingBorder(axis));
|
||||
}
|
||||
|
||||
FloatOptional Node::getTrailingPaddingAndBorder(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const {
|
||||
return getTrailingPadding(axis, widthSize) +
|
||||
FloatOptional(getTrailingBorder(axis));
|
||||
|
@@ -47,12 +47,11 @@ class YG_EXPORT Node : public ::YGNode {
|
||||
std::array<YGValue, 2> resolvedDimensions_ = {
|
||||
{YGValueUndefined, YGValueUndefined}};
|
||||
|
||||
FloatOptional relativePosition(
|
||||
const YGFlexDirection axis,
|
||||
const float axisSize) const;
|
||||
FloatOptional relativePosition(const FlexDirection axis, const float axisSize)
|
||||
const;
|
||||
|
||||
void useWebDefaults() {
|
||||
style_.flexDirection() = YGFlexDirectionRow;
|
||||
style_.flexDirection() = FlexDirection::Row;
|
||||
style_.alignContent() = YGAlignStretch;
|
||||
}
|
||||
|
||||
@@ -201,37 +200,37 @@ class YG_EXPORT Node : public ::YGNode {
|
||||
|
||||
// Methods related to positions, margin, padding and border
|
||||
FloatOptional getLeadingPosition(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float axisSize) const;
|
||||
bool isLeadingPositionDefined(const YGFlexDirection axis) const;
|
||||
bool isTrailingPosDefined(const YGFlexDirection axis) const;
|
||||
bool isLeadingPositionDefined(const FlexDirection axis) const;
|
||||
bool isTrailingPosDefined(const FlexDirection axis) const;
|
||||
FloatOptional getTrailingPosition(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float axisSize) const;
|
||||
FloatOptional getLeadingMargin(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const;
|
||||
FloatOptional getTrailingMargin(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const;
|
||||
float getLeadingBorder(const YGFlexDirection flexDirection) const;
|
||||
float getTrailingBorder(const YGFlexDirection flexDirection) const;
|
||||
float getLeadingBorder(const FlexDirection flexDirection) const;
|
||||
float getTrailingBorder(const FlexDirection flexDirection) const;
|
||||
FloatOptional getLeadingPadding(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const;
|
||||
FloatOptional getTrailingPadding(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const;
|
||||
FloatOptional getLeadingPaddingAndBorder(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const;
|
||||
FloatOptional getTrailingPaddingAndBorder(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const;
|
||||
FloatOptional getMarginForAxis(
|
||||
const YGFlexDirection axis,
|
||||
const FlexDirection axis,
|
||||
const float widthSize) const;
|
||||
FloatOptional getGapForAxis(const YGFlexDirection axis, const float widthSize)
|
||||
FloatOptional getGapForAxis(const FlexDirection axis, const float widthSize)
|
||||
const;
|
||||
// Setters
|
||||
|
||||
@@ -312,8 +311,8 @@ class YG_EXPORT Node : public ::YGNode {
|
||||
void markDirtyAndPropagateDownwards();
|
||||
|
||||
// Other methods
|
||||
YGValue marginLeadingValue(const YGFlexDirection axis) const;
|
||||
YGValue marginTrailingValue(const YGFlexDirection axis) const;
|
||||
YGValue marginLeadingValue(const FlexDirection axis) const;
|
||||
YGValue marginTrailingValue(const FlexDirection axis) const;
|
||||
YGValue resolveFlexBasisPtr() const;
|
||||
void resolveDimension();
|
||||
Direction resolveDirection(const Direction ownerDirection);
|
||||
|
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <yoga/bits/NumericBitfield.h>
|
||||
#include <yoga/enums/Direction.h>
|
||||
#include <yoga/enums/FlexDirection.h>
|
||||
#include <yoga/numeric/FloatOptional.h>
|
||||
#include <yoga/style/CompactValue.h>
|
||||
|
||||
@@ -103,7 +104,7 @@ class YG_EXPORT Style {
|
||||
static constexpr uint8_t flexdirectionOffset =
|
||||
directionOffset + minimumBitCount<Direction>();
|
||||
static constexpr uint8_t justifyContentOffset =
|
||||
flexdirectionOffset + minimumBitCount<YGFlexDirection>();
|
||||
flexdirectionOffset + minimumBitCount<FlexDirection>();
|
||||
static constexpr uint8_t alignContentOffset =
|
||||
justifyContentOffset + minimumBitCount<YGJustify>();
|
||||
static constexpr uint8_t alignItemsOffset =
|
||||
@@ -147,10 +148,10 @@ class YG_EXPORT Style {
|
||||
return {*this, directionOffset};
|
||||
}
|
||||
|
||||
YGFlexDirection flexDirection() const {
|
||||
return getEnumData<YGFlexDirection>(flags, flexdirectionOffset);
|
||||
FlexDirection flexDirection() const {
|
||||
return getEnumData<FlexDirection>(flags, flexdirectionOffset);
|
||||
}
|
||||
BitfieldRef<YGFlexDirection> flexDirection() {
|
||||
BitfieldRef<FlexDirection> flexDirection() {
|
||||
return {*this, flexdirectionOffset};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user