Format and run codegen
Reviewed By: dshahidehpour Differential Revision: D4459455 fbshipit-source-id: fc1eca58fe897c8f4a2571638b4f7035d023b479
This commit is contained in:
parent
3a476a8321
commit
3d1c8694d0
|
@ -75,7 +75,8 @@ static void YGPrint(YGNodeRef node) {
|
|||
|
||||
static float YGJNIBaselineFunc(YGNodeRef node, float width, float height) {
|
||||
if (auto obj = YGNodeJobject(node)->lockLocal()) {
|
||||
static auto baselineFunc = findClassStatic("com/facebook/yoga/YogaNode")->getMethod<jfloat(jfloat, jfloat)>("baseline");
|
||||
static auto baselineFunc = findClassStatic("com/facebook/yoga/YogaNode")
|
||||
->getMethod<jfloat(jfloat, jfloat)>("baseline");
|
||||
return baselineFunc(obj, width, height);
|
||||
} else {
|
||||
return height;
|
||||
|
@ -222,8 +223,11 @@ void jni_YGNodeSetHasMeasureFunc(alias_ref<jobject>, jlong nativePointer, jboole
|
|||
YGNodeSetMeasureFunc(_jlong2YGNodeRef(nativePointer), hasMeasureFunc ? YGJNIMeasureFunc : NULL);
|
||||
}
|
||||
|
||||
void jni_YGNodeSetHasBaselineFunc(alias_ref<jobject>, jlong nativePointer, jboolean hasBaselineFunc) {
|
||||
YGNodeSetBaselineFunc(_jlong2YGNodeRef(nativePointer), hasBaselineFunc ? YGJNIBaselineFunc : NULL);
|
||||
void jni_YGNodeSetHasBaselineFunc(alias_ref<jobject>,
|
||||
jlong nativePointer,
|
||||
jboolean hasBaselineFunc) {
|
||||
YGNodeSetBaselineFunc(_jlong2YGNodeRef(nativePointer),
|
||||
hasBaselineFunc ? YGJNIBaselineFunc : NULL);
|
||||
}
|
||||
|
||||
jboolean jni_YGNodeHasNewLayout(alias_ref<jobject>, jlong nativePointer) {
|
||||
|
|
|
@ -15,110 +15,89 @@ YG_EXTERN_C_BEGIN
|
|||
|
||||
#define YGFlexDirectionCount 4
|
||||
typedef YG_ENUM_BEGIN(YGFlexDirection) {
|
||||
YGFlexDirectionColumn,
|
||||
YGFlexDirectionColumnReverse,
|
||||
YGFlexDirectionRow,
|
||||
YGFlexDirectionColumn, YGFlexDirectionColumnReverse, YGFlexDirectionRow,
|
||||
YGFlexDirectionRowReverse,
|
||||
} YG_ENUM_END(YGFlexDirection);
|
||||
}
|
||||
YG_ENUM_END(YGFlexDirection);
|
||||
|
||||
#define YGMeasureModeCount 3
|
||||
typedef YG_ENUM_BEGIN(YGMeasureMode) {
|
||||
YGMeasureModeUndefined,
|
||||
YGMeasureModeExactly,
|
||||
YGMeasureModeAtMost,
|
||||
} YG_ENUM_END(YGMeasureMode);
|
||||
YGMeasureModeUndefined, YGMeasureModeExactly, YGMeasureModeAtMost,
|
||||
}
|
||||
YG_ENUM_END(YGMeasureMode);
|
||||
|
||||
#define YGPrintOptionsCount 3
|
||||
typedef YG_ENUM_BEGIN(YGPrintOptions) {
|
||||
YGPrintOptionsLayout = 1,
|
||||
YGPrintOptionsStyle = 2,
|
||||
YGPrintOptionsChildren = 4,
|
||||
} YG_ENUM_END(YGPrintOptions);
|
||||
YGPrintOptionsLayout = 1, YGPrintOptionsStyle = 2, YGPrintOptionsChildren = 4,
|
||||
}
|
||||
YG_ENUM_END(YGPrintOptions);
|
||||
|
||||
#define YGEdgeCount 9
|
||||
typedef YG_ENUM_BEGIN(YGEdge) {
|
||||
YGEdgeLeft,
|
||||
YGEdgeTop,
|
||||
YGEdgeRight,
|
||||
YGEdgeBottom,
|
||||
YGEdgeStart,
|
||||
YGEdgeEnd,
|
||||
YGEdgeHorizontal,
|
||||
YGEdgeVertical,
|
||||
YGEdgeAll,
|
||||
} YG_ENUM_END(YGEdge);
|
||||
YGEdgeLeft, YGEdgeTop, YGEdgeRight, YGEdgeBottom, YGEdgeStart, YGEdgeEnd, YGEdgeHorizontal,
|
||||
YGEdgeVertical, YGEdgeAll,
|
||||
}
|
||||
YG_ENUM_END(YGEdge);
|
||||
|
||||
#define YGPositionTypeCount 2
|
||||
typedef YG_ENUM_BEGIN(YGPositionType) {
|
||||
YGPositionTypeRelative,
|
||||
YGPositionTypeAbsolute,
|
||||
} YG_ENUM_END(YGPositionType);
|
||||
YGPositionTypeRelative, YGPositionTypeAbsolute,
|
||||
}
|
||||
YG_ENUM_END(YGPositionType);
|
||||
|
||||
#define YGDimensionCount 2
|
||||
typedef YG_ENUM_BEGIN(YGDimension) {
|
||||
YGDimensionWidth,
|
||||
YGDimensionHeight,
|
||||
} YG_ENUM_END(YGDimension);
|
||||
YGDimensionWidth, YGDimensionHeight,
|
||||
}
|
||||
YG_ENUM_END(YGDimension);
|
||||
|
||||
#define YGJustifyCount 5
|
||||
typedef YG_ENUM_BEGIN(YGJustify) {
|
||||
YGJustifyFlexStart,
|
||||
YGJustifyCenter,
|
||||
YGJustifyFlexEnd,
|
||||
YGJustifySpaceBetween,
|
||||
YGJustifyFlexStart, YGJustifyCenter, YGJustifyFlexEnd, YGJustifySpaceBetween,
|
||||
YGJustifySpaceAround,
|
||||
} YG_ENUM_END(YGJustify);
|
||||
}
|
||||
YG_ENUM_END(YGJustify);
|
||||
|
||||
#define YGDirectionCount 3
|
||||
typedef YG_ENUM_BEGIN(YGDirection) {
|
||||
YGDirectionInherit,
|
||||
YGDirectionLTR,
|
||||
YGDirectionRTL,
|
||||
} YG_ENUM_END(YGDirection);
|
||||
YGDirectionInherit, YGDirectionLTR, YGDirectionRTL,
|
||||
}
|
||||
YG_ENUM_END(YGDirection);
|
||||
|
||||
#define YGLogLevelCount 5
|
||||
typedef YG_ENUM_BEGIN(YGLogLevel) {
|
||||
YGLogLevelError,
|
||||
YGLogLevelWarn,
|
||||
YGLogLevelInfo,
|
||||
YGLogLevelDebug,
|
||||
YGLogLevelVerbose,
|
||||
} YG_ENUM_END(YGLogLevel);
|
||||
YGLogLevelError, YGLogLevelWarn, YGLogLevelInfo, YGLogLevelDebug, YGLogLevelVerbose,
|
||||
}
|
||||
YG_ENUM_END(YGLogLevel);
|
||||
|
||||
#define YGWrapCount 2
|
||||
typedef YG_ENUM_BEGIN(YGWrap) {
|
||||
YGWrapNoWrap,
|
||||
YGWrapWrap,
|
||||
} YG_ENUM_END(YGWrap);
|
||||
YGWrapNoWrap, YGWrapWrap,
|
||||
}
|
||||
YG_ENUM_END(YGWrap);
|
||||
|
||||
#define YGOverflowCount 3
|
||||
typedef YG_ENUM_BEGIN(YGOverflow) {
|
||||
YGOverflowVisible,
|
||||
YGOverflowHidden,
|
||||
YGOverflowScroll,
|
||||
} YG_ENUM_END(YGOverflow);
|
||||
YGOverflowVisible, YGOverflowHidden, YGOverflowScroll,
|
||||
}
|
||||
YG_ENUM_END(YGOverflow);
|
||||
|
||||
#define YGExperimentalFeatureCount 2
|
||||
typedef YG_ENUM_BEGIN(YGExperimentalFeature) {
|
||||
YGExperimentalFeatureRounding,
|
||||
YGExperimentalFeatureWebFlexBasis,
|
||||
} YG_ENUM_END(YGExperimentalFeature);
|
||||
YGExperimentalFeatureRounding, YGExperimentalFeatureWebFlexBasis,
|
||||
}
|
||||
YG_ENUM_END(YGExperimentalFeature);
|
||||
|
||||
#define YGAlignCount 6
|
||||
typedef YG_ENUM_BEGIN(YGAlign) {
|
||||
YGAlignAuto,
|
||||
YGAlignFlexStart,
|
||||
YGAlignCenter,
|
||||
YGAlignFlexEnd,
|
||||
YGAlignStretch,
|
||||
YGAlignBaseline,
|
||||
} YG_ENUM_END(YGAlign);
|
||||
YGAlignAuto, YGAlignFlexStart, YGAlignCenter, YGAlignFlexEnd, YGAlignStretch, YGAlignBaseline,
|
||||
}
|
||||
YG_ENUM_END(YGAlign);
|
||||
|
||||
#define YGUnitCount 3
|
||||
typedef YG_ENUM_BEGIN(YGUnit) {
|
||||
YGUnitUndefined,
|
||||
YGUnitPixel,
|
||||
YGUnitPercent,
|
||||
} YG_ENUM_END(YGUnit);
|
||||
YGUnitUndefined, YGUnitPixel, YGUnitPercent,
|
||||
}
|
||||
YG_ENUM_END(YGUnit);
|
||||
|
||||
YG_EXTERN_C_END
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
#endif
|
||||
|
||||
#ifdef NS_ENUM
|
||||
// Cannot use NSInteger as NSInteger has a different size than int (which is the default type of a enum).
|
||||
// Cannot use NSInteger as NSInteger has a different size than int (which is the default type of a
|
||||
// enum).
|
||||
// Therefor when linking the Yoga C library into obj-c the header is a missmatch for the Yoga ABI.
|
||||
#define YG_ENUM_BEGIN(name) NS_ENUM(int, name)
|
||||
#define YG_ENUM_END(name)
|
||||
|
|
|
@ -1436,7 +1436,8 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
|
|||
// If the size of the parent is defined then try to constrain the absolute child to that size
|
||||
// as well. This allows text within the absolute child to wrap to the size of its parent.
|
||||
// This is the same behavior as many browsers implement.
|
||||
if (!isMainAxisRow && YGFloatIsUndefined(childWidth) && widthMode != YGMeasureModeUndefined && width > 0) {
|
||||
if (!isMainAxisRow && YGFloatIsUndefined(childWidth) && widthMode != YGMeasureModeUndefined &&
|
||||
width > 0) {
|
||||
childWidth = width;
|
||||
childWidthMeasureMode = YGMeasureModeAtMost;
|
||||
}
|
||||
|
@ -1476,7 +1477,8 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
|
|||
} else if (!YGNodeIsLeadingPosDefined(child, mainAxis) &&
|
||||
node->style.justifyContent == YGJustifyCenter) {
|
||||
child->layout.position[leading[mainAxis]] = (node->layout.measuredDimensions[dim[mainAxis]] -
|
||||
child->layout.measuredDimensions[dim[mainAxis]]) / 2.0f;
|
||||
child->layout.measuredDimensions[dim[mainAxis]]) /
|
||||
2.0f;
|
||||
} else if (!YGNodeIsLeadingPosDefined(child, mainAxis) &&
|
||||
node->style.justifyContent == YGJustifyFlexEnd) {
|
||||
child->layout.position[leading[mainAxis]] = (node->layout.measuredDimensions[dim[mainAxis]] -
|
||||
|
@ -1491,8 +1493,10 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
|
|||
YGNodeTrailingPosition(child, crossAxis, width);
|
||||
} else if (!YGNodeIsLeadingPosDefined(child, crossAxis) &&
|
||||
YGNodeAlignItem(node, child) == YGAlignCenter) {
|
||||
child->layout.position[leading[crossAxis]] = (node->layout.measuredDimensions[dim[crossAxis]] -
|
||||
child->layout.measuredDimensions[dim[crossAxis]]) / 2.0f;
|
||||
child->layout.position[leading[crossAxis]] =
|
||||
(node->layout.measuredDimensions[dim[crossAxis]] -
|
||||
child->layout.measuredDimensions[dim[crossAxis]]) /
|
||||
2.0f;
|
||||
} else if (!YGNodeIsLeadingPosDefined(child, crossAxis) &&
|
||||
YGNodeAlignItem(node, child) == YGAlignFlexEnd) {
|
||||
child->layout.position[leading[crossAxis]] = (node->layout.measuredDimensions[dim[crossAxis]] -
|
||||
|
@ -1767,32 +1771,22 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||
node->layout.direction = direction;
|
||||
|
||||
const YGFlexDirection flexRowDirection = YGFlexDirectionResolve(YGFlexDirectionRow, direction);
|
||||
const YGFlexDirection flexColumnDirection = YGFlexDirectionResolve(YGFlexDirectionColumn, direction);
|
||||
const YGFlexDirection flexColumnDirection =
|
||||
YGFlexDirectionResolve(YGFlexDirectionColumn, direction);
|
||||
|
||||
node->layout.margin[YGEdgeStart] =
|
||||
YGNodeLeadingMargin(node, flexRowDirection, parentWidth);
|
||||
node->layout.margin[YGEdgeEnd] =
|
||||
YGNodeTrailingMargin(node, flexRowDirection, parentWidth);
|
||||
node->layout.margin[YGEdgeTop] =
|
||||
YGNodeLeadingMargin(node, flexColumnDirection, parentWidth);
|
||||
node->layout.margin[YGEdgeBottom] =
|
||||
YGNodeTrailingMargin(node, flexColumnDirection, parentWidth);
|
||||
node->layout.margin[YGEdgeStart] = YGNodeLeadingMargin(node, flexRowDirection, parentWidth);
|
||||
node->layout.margin[YGEdgeEnd] = YGNodeTrailingMargin(node, flexRowDirection, parentWidth);
|
||||
node->layout.margin[YGEdgeTop] = YGNodeLeadingMargin(node, flexColumnDirection, parentWidth);
|
||||
node->layout.margin[YGEdgeBottom] = YGNodeTrailingMargin(node, flexColumnDirection, parentWidth);
|
||||
|
||||
node->layout.border[YGEdgeStart] =
|
||||
YGNodeLeadingBorder(node, flexRowDirection);
|
||||
node->layout.border[YGEdgeEnd] =
|
||||
YGNodeTrailingBorder(node, flexRowDirection);
|
||||
node->layout.border[YGEdgeTop] =
|
||||
YGNodeLeadingBorder(node, flexColumnDirection);
|
||||
node->layout.border[YGEdgeBottom] =
|
||||
YGNodeTrailingBorder(node, flexColumnDirection);
|
||||
node->layout.border[YGEdgeStart] = YGNodeLeadingBorder(node, flexRowDirection);
|
||||
node->layout.border[YGEdgeEnd] = YGNodeTrailingBorder(node, flexRowDirection);
|
||||
node->layout.border[YGEdgeTop] = YGNodeLeadingBorder(node, flexColumnDirection);
|
||||
node->layout.border[YGEdgeBottom] = YGNodeTrailingBorder(node, flexColumnDirection);
|
||||
|
||||
node->layout.padding[YGEdgeStart] =
|
||||
YGNodeLeadingPadding(node, flexRowDirection, parentWidth);
|
||||
node->layout.padding[YGEdgeEnd] =
|
||||
YGNodeTrailingPadding(node, flexRowDirection, parentWidth);
|
||||
node->layout.padding[YGEdgeTop] =
|
||||
YGNodeLeadingPadding(node, flexColumnDirection, parentWidth);
|
||||
node->layout.padding[YGEdgeStart] = YGNodeLeadingPadding(node, flexRowDirection, parentWidth);
|
||||
node->layout.padding[YGEdgeEnd] = YGNodeTrailingPadding(node, flexRowDirection, parentWidth);
|
||||
node->layout.padding[YGEdgeTop] = YGNodeLeadingPadding(node, flexColumnDirection, parentWidth);
|
||||
node->layout.padding[YGEdgeBottom] =
|
||||
YGNodeTrailingPadding(node, flexColumnDirection, parentWidth);
|
||||
|
||||
|
@ -1998,7 +1992,8 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||
|
||||
if (child->style.positionType != YGPositionTypeAbsolute) {
|
||||
const float outerFlexBasis =
|
||||
fmaxf(YGValueResolve(&child->style.minDimensions[dim[mainAxis]], mainAxisParentSize), child->layout.computedFlexBasis) +
|
||||
fmaxf(YGValueResolve(&child->style.minDimensions[dim[mainAxis]], mainAxisParentSize),
|
||||
child->layout.computedFlexBasis) +
|
||||
YGNodeMarginForAxis(child, mainAxis, availableInnerWidth);
|
||||
|
||||
// If this is a multi-line flow and this item pushes us over the
|
||||
|
|
Loading…
Reference in New Issue