2016-11-15 08:42:33 -08:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
|
|
|
|
2016-12-05 04:58:55 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "YGMacros.h"
|
|
|
|
|
|
|
|
YG_EXTERN_C_BEGIN
|
|
|
|
|
2017-02-11 08:32:48 -08:00
|
|
|
#define YGAlignCount 8
|
2017-02-03 04:21:50 -08:00
|
|
|
typedef YG_ENUM_BEGIN(YGAlign) {
|
2017-02-11 05:26:55 -08:00
|
|
|
YGAlignAuto,
|
|
|
|
YGAlignFlexStart,
|
|
|
|
YGAlignCenter,
|
|
|
|
YGAlignFlexEnd,
|
|
|
|
YGAlignStretch,
|
|
|
|
YGAlignBaseline,
|
2017-02-11 08:32:48 -08:00
|
|
|
YGAlignSpaceBetween,
|
|
|
|
YGAlignSpaceAround,
|
2017-02-11 05:26:55 -08:00
|
|
|
} YG_ENUM_END(YGAlign);
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2017-02-03 04:21:50 -08:00
|
|
|
#define YGDimensionCount 2
|
|
|
|
typedef YG_ENUM_BEGIN(YGDimension) {
|
2017-02-11 05:26:55 -08:00
|
|
|
YGDimensionWidth,
|
|
|
|
YGDimensionHeight,
|
|
|
|
} YG_ENUM_END(YGDimension);
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2017-02-03 04:21:50 -08:00
|
|
|
#define YGDirectionCount 3
|
|
|
|
typedef YG_ENUM_BEGIN(YGDirection) {
|
2017-02-11 05:26:55 -08:00
|
|
|
YGDirectionInherit,
|
|
|
|
YGDirectionLTR,
|
|
|
|
YGDirectionRTL,
|
|
|
|
} YG_ENUM_END(YGDirection);
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2017-02-06 09:31:22 -08:00
|
|
|
#define YGDisplayCount 2
|
|
|
|
typedef YG_ENUM_BEGIN(YGDisplay) {
|
|
|
|
YGDisplayFlex,
|
|
|
|
YGDisplayNone,
|
|
|
|
} YG_ENUM_END(YGDisplay);
|
|
|
|
|
2016-12-22 02:57:19 -08:00
|
|
|
#define YGEdgeCount 9
|
2017-01-08 11:42:43 -08:00
|
|
|
typedef YG_ENUM_BEGIN(YGEdge) {
|
2017-02-11 05:26:55 -08:00
|
|
|
YGEdgeLeft,
|
|
|
|
YGEdgeTop,
|
|
|
|
YGEdgeRight,
|
|
|
|
YGEdgeBottom,
|
|
|
|
YGEdgeStart,
|
|
|
|
YGEdgeEnd,
|
|
|
|
YGEdgeHorizontal,
|
|
|
|
YGEdgeVertical,
|
|
|
|
YGEdgeAll,
|
|
|
|
} YG_ENUM_END(YGEdge);
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2017-02-03 04:21:50 -08:00
|
|
|
#define YGExperimentalFeatureCount 2
|
|
|
|
typedef YG_ENUM_BEGIN(YGExperimentalFeature) {
|
2017-02-11 05:26:55 -08:00
|
|
|
YGExperimentalFeatureRounding,
|
|
|
|
YGExperimentalFeatureWebFlexBasis,
|
|
|
|
} YG_ENUM_END(YGExperimentalFeature);
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2017-02-03 04:21:50 -08:00
|
|
|
#define YGFlexDirectionCount 4
|
|
|
|
typedef YG_ENUM_BEGIN(YGFlexDirection) {
|
2017-02-11 05:26:55 -08:00
|
|
|
YGFlexDirectionColumn,
|
|
|
|
YGFlexDirectionColumnReverse,
|
|
|
|
YGFlexDirectionRow,
|
|
|
|
YGFlexDirectionRowReverse,
|
|
|
|
} YG_ENUM_END(YGFlexDirection);
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2016-12-22 02:57:19 -08:00
|
|
|
#define YGJustifyCount 5
|
2017-01-08 11:42:43 -08:00
|
|
|
typedef YG_ENUM_BEGIN(YGJustify) {
|
2017-02-11 05:26:55 -08:00
|
|
|
YGJustifyFlexStart,
|
|
|
|
YGJustifyCenter,
|
|
|
|
YGJustifyFlexEnd,
|
|
|
|
YGJustifySpaceBetween,
|
|
|
|
YGJustifySpaceAround,
|
|
|
|
} YG_ENUM_END(YGJustify);
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2016-12-22 02:57:19 -08:00
|
|
|
#define YGLogLevelCount 5
|
2017-01-08 11:42:43 -08:00
|
|
|
typedef YG_ENUM_BEGIN(YGLogLevel) {
|
2017-02-11 05:26:55 -08:00
|
|
|
YGLogLevelError,
|
|
|
|
YGLogLevelWarn,
|
|
|
|
YGLogLevelInfo,
|
|
|
|
YGLogLevelDebug,
|
|
|
|
YGLogLevelVerbose,
|
|
|
|
} YG_ENUM_END(YGLogLevel);
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2017-02-03 04:21:50 -08:00
|
|
|
#define YGMeasureModeCount 3
|
|
|
|
typedef YG_ENUM_BEGIN(YGMeasureMode) {
|
2017-02-11 05:26:55 -08:00
|
|
|
YGMeasureModeUndefined,
|
|
|
|
YGMeasureModeExactly,
|
|
|
|
YGMeasureModeAtMost,
|
|
|
|
} YG_ENUM_END(YGMeasureMode);
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2016-12-22 02:57:19 -08:00
|
|
|
#define YGOverflowCount 3
|
2017-01-08 11:42:43 -08:00
|
|
|
typedef YG_ENUM_BEGIN(YGOverflow) {
|
2017-02-11 05:26:55 -08:00
|
|
|
YGOverflowVisible,
|
|
|
|
YGOverflowHidden,
|
|
|
|
YGOverflowScroll,
|
|
|
|
} YG_ENUM_END(YGOverflow);
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2017-02-03 04:21:50 -08:00
|
|
|
#define YGPositionTypeCount 2
|
|
|
|
typedef YG_ENUM_BEGIN(YGPositionType) {
|
2017-02-11 05:26:55 -08:00
|
|
|
YGPositionTypeRelative,
|
|
|
|
YGPositionTypeAbsolute,
|
|
|
|
} YG_ENUM_END(YGPositionType);
|
2016-11-15 08:42:33 -08:00
|
|
|
|
2017-02-03 04:21:50 -08:00
|
|
|
#define YGPrintOptionsCount 3
|
|
|
|
typedef YG_ENUM_BEGIN(YGPrintOptions) {
|
2017-02-11 05:26:55 -08:00
|
|
|
YGPrintOptionsLayout = 1,
|
|
|
|
YGPrintOptionsStyle = 2,
|
|
|
|
YGPrintOptionsChildren = 4,
|
|
|
|
} YG_ENUM_END(YGPrintOptions);
|
2016-12-05 04:58:55 -08:00
|
|
|
|
2017-02-14 14:26:09 -08:00
|
|
|
#define YGUnitCount 4
|
2017-01-08 11:42:43 -08:00
|
|
|
typedef YG_ENUM_BEGIN(YGUnit) {
|
2017-02-11 05:26:55 -08:00
|
|
|
YGUnitUndefined,
|
2017-02-14 14:26:13 -08:00
|
|
|
YGUnitPoint,
|
2017-02-11 05:26:55 -08:00
|
|
|
YGUnitPercent,
|
2017-02-14 14:26:09 -08:00
|
|
|
YGUnitAuto,
|
2017-02-11 05:26:55 -08:00
|
|
|
} YG_ENUM_END(YGUnit);
|
2017-02-03 04:21:50 -08:00
|
|
|
|
|
|
|
#define YGWrapCount 2
|
|
|
|
typedef YG_ENUM_BEGIN(YGWrap) {
|
2017-02-11 05:26:55 -08:00
|
|
|
YGWrapNoWrap,
|
|
|
|
YGWrapWrap,
|
|
|
|
} YG_ENUM_END(YGWrap);
|
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
|