2016-11-15 08:42:33 -08:00
|
|
|
/**
|
2018-09-11 15:27:47 -07:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2016-11-15 08:42:33 -08:00
|
|
|
*
|
2018-11-29 11:35:34 -08:00
|
|
|
* This source code is licensed under the MIT license found in the LICENSE
|
|
|
|
* file in the root directory of this source tree.
|
2016-11-15 08:42:33 -08:00
|
|
|
*/
|
2016-12-05 04:58:55 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "YGMacros.h"
|
|
|
|
|
2019-01-08 12:47:54 -08:00
|
|
|
#define YG_ENUM_DECL(NAME, ...) \
|
|
|
|
typedef YG_ENUM_BEGIN(NAME){__VA_ARGS__} YG_ENUM_END(NAME); \
|
|
|
|
WIN_EXPORT const char* NAME##ToString(NAME);
|
|
|
|
|
2016-12-05 04:58:55 -08:00
|
|
|
YG_EXTERN_C_BEGIN
|
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGAlignCount 8
|
|
|
|
YG_ENUM_DECL(
|
2019-01-08 12:47:54 -08:00
|
|
|
YGAlign,
|
2019-01-08 12:47:53 -08:00
|
|
|
YGAlignAuto,
|
|
|
|
YGAlignFlexStart,
|
|
|
|
YGAlignCenter,
|
|
|
|
YGAlignFlexEnd,
|
|
|
|
YGAlignStretch,
|
|
|
|
YGAlignBaseline,
|
|
|
|
YGAlignSpaceBetween,
|
2019-01-08 12:47:54 -08:00
|
|
|
YGAlignSpaceAround);
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGDimensionCount 2
|
|
|
|
YG_ENUM_DECL(YGDimension, YGDimensionWidth, YGDimensionHeight)
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGDirectionCount 3
|
|
|
|
YG_ENUM_DECL(YGDirection, YGDirectionInherit, YGDirectionLTR, YGDirectionRTL)
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGDisplayCount 2
|
|
|
|
YG_ENUM_DECL(YGDisplay, YGDisplayFlex, YGDisplayNone)
|
2017-02-06 09:31:22 -08:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGEdgeCount 9
|
|
|
|
YG_ENUM_DECL(
|
2019-01-08 12:47:54 -08:00
|
|
|
YGEdge,
|
2019-01-08 12:47:53 -08:00
|
|
|
YGEdgeLeft,
|
|
|
|
YGEdgeTop,
|
|
|
|
YGEdgeRight,
|
|
|
|
YGEdgeBottom,
|
|
|
|
YGEdgeStart,
|
|
|
|
YGEdgeEnd,
|
|
|
|
YGEdgeHorizontal,
|
|
|
|
YGEdgeVertical,
|
2019-01-08 12:47:54 -08:00
|
|
|
YGEdgeAll)
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGExperimentalFeatureCount 1
|
|
|
|
YG_ENUM_DECL(YGExperimentalFeature, YGExperimentalFeatureWebFlexBasis)
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGFlexDirectionCount 4
|
|
|
|
YG_ENUM_DECL(
|
2019-01-08 12:47:54 -08:00
|
|
|
YGFlexDirection,
|
2019-01-08 12:47:53 -08:00
|
|
|
YGFlexDirectionColumn,
|
|
|
|
YGFlexDirectionColumnReverse,
|
|
|
|
YGFlexDirectionRow,
|
2019-01-08 12:47:54 -08:00
|
|
|
YGFlexDirectionRowReverse)
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGJustifyCount 6
|
|
|
|
YG_ENUM_DECL(
|
2019-01-08 12:47:54 -08:00
|
|
|
YGJustify,
|
2017-11-27 03:40:01 -08:00
|
|
|
YGJustifyFlexStart,
|
|
|
|
YGJustifyCenter,
|
|
|
|
YGJustifyFlexEnd,
|
|
|
|
YGJustifySpaceBetween,
|
|
|
|
YGJustifySpaceAround,
|
2019-01-08 12:47:54 -08:00
|
|
|
YGJustifySpaceEvenly)
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGLogLevelCount 6
|
|
|
|
YG_ENUM_DECL(
|
2019-01-08 12:47:54 -08:00
|
|
|
YGLogLevel,
|
2019-01-08 12:47:53 -08:00
|
|
|
YGLogLevelError,
|
|
|
|
YGLogLevelWarn,
|
|
|
|
YGLogLevelInfo,
|
|
|
|
YGLogLevelDebug,
|
|
|
|
YGLogLevelVerbose,
|
2019-01-08 12:47:54 -08:00
|
|
|
YGLogLevelFatal)
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGMeasureModeCount 3
|
|
|
|
YG_ENUM_DECL(
|
2019-01-08 12:47:54 -08:00
|
|
|
YGMeasureMode,
|
2019-01-08 12:47:53 -08:00
|
|
|
YGMeasureModeUndefined,
|
|
|
|
YGMeasureModeExactly,
|
2019-01-08 12:47:54 -08:00
|
|
|
YGMeasureModeAtMost)
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGNodeTypeCount 2
|
|
|
|
YG_ENUM_DECL(YGNodeType, YGNodeTypeDefault, YGNodeTypeText)
|
2017-05-11 08:09:30 -07:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGOverflowCount 3
|
|
|
|
YG_ENUM_DECL(YGOverflow, YGOverflowVisible, YGOverflowHidden, YGOverflowScroll)
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGPositionTypeCount 2
|
|
|
|
YG_ENUM_DECL(YGPositionType, YGPositionTypeRelative, YGPositionTypeAbsolute)
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGPrintOptionsCount 3
|
2019-01-08 12:47:54 -08:00
|
|
|
YG_ENUM_DECL(
|
|
|
|
YGPrintOptions,
|
2019-01-08 12:47:53 -08:00
|
|
|
YGPrintOptionsLayout = 1,
|
|
|
|
YGPrintOptionsStyle = 2,
|
2019-01-08 12:47:54 -08:00
|
|
|
YGPrintOptionsChildren = 4)
|
2016-12-05 04:58:55 -08:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGUnitCount 4
|
|
|
|
YG_ENUM_DECL(YGUnit, YGUnitUndefined, YGUnitPoint, YGUnitPercent, YGUnitAuto)
|
2017-02-03 04:21:50 -08:00
|
|
|
|
2019-01-10 23:48:36 -08:00
|
|
|
#define YGWrapCount 3
|
|
|
|
YG_ENUM_DECL(YGWrap, YGWrapNoWrap, YGWrapWrap, YGWrapWrapReverse)
|
Add feature to use percentage as value unit
Summary:
Adds the feature to use percentage as a value unit.
You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience.
I did some benchmarks:
```
Without Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.490101 ms
Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms
Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms
Nested flex: median: 0.000000 ms, stddev: 0.477791 ms
Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms
With Percentage Feature - Release x86:
Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms
Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms
Nested flex: median: 0.000000 ms, stddev: 0.489570 ms
Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms
Closes https://github.com/facebook/yoga/pull/258
Reviewed By: dshahidehpour
Differential Revision: D4361945
Pulled By: emilsjolander
fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
2017-01-02 05:20:37 -08:00
|
|
|
|
2016-12-05 04:58:55 -08:00
|
|
|
YG_EXTERN_C_END
|
2019-01-08 12:47:54 -08:00
|
|
|
|
|
|
|
#undef YG_ENUM_DECL
|