2016-12-03 04:40:18 -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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
#ifndef __cplusplus
|
|
|
|
#include <stdbool.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Not defined in MSVC++
|
|
|
|
#ifndef NAN
|
|
|
|
static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
|
|
|
|
#define NAN (*(const float *) __nan)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define YGUndefined NAN
|
|
|
|
|
|
|
|
#include "YGEnums.h"
|
|
|
|
#include "YGMacros.h"
|
|
|
|
|
|
|
|
YG_EXTERN_C_BEGIN
|
|
|
|
|
|
|
|
typedef struct YGSize {
|
|
|
|
float width;
|
|
|
|
float height;
|
|
|
|
} YGSize;
|
|
|
|
|
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
|
|
|
typedef struct YGValue {
|
|
|
|
float value;
|
|
|
|
YGUnit unit;
|
|
|
|
} YGValue;
|
|
|
|
|
2017-01-26 13:36:39 -08:00
|
|
|
static const YGValue YGValueUndefined = {YGUndefined, YGUnitUndefined};
|
2017-02-16 06:47:28 -08:00
|
|
|
static const YGValue YGValueAuto = {YGUndefined, YGUnitAuto};
|
2017-01-11 03:58:03 -08:00
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
typedef struct YGConfig *YGConfigRef;
|
2016-12-03 04:40:18 -08:00
|
|
|
typedef struct YGNode *YGNodeRef;
|
|
|
|
typedef YGSize (*YGMeasureFunc)(YGNodeRef node,
|
|
|
|
float width,
|
|
|
|
YGMeasureMode widthMode,
|
|
|
|
float height,
|
|
|
|
YGMeasureMode heightMode);
|
2017-01-06 06:51:56 -08:00
|
|
|
typedef float (*YGBaselineFunc)(YGNodeRef node, const float width, const float height);
|
2016-12-03 04:40:18 -08:00
|
|
|
typedef void (*YGPrintFunc)(YGNodeRef node);
|
|
|
|
typedef int (*YGLogger)(YGLogLevel level, const char *format, va_list args);
|
|
|
|
|
|
|
|
typedef void *(*YGMalloc)(size_t size);
|
|
|
|
typedef void *(*YGCalloc)(size_t count, size_t size);
|
|
|
|
typedef void *(*YGRealloc)(void *ptr, size_t size);
|
|
|
|
typedef void (*YGFree)(void *ptr);
|
|
|
|
|
|
|
|
// YGNode
|
|
|
|
WIN_EXPORT YGNodeRef YGNodeNew(void);
|
2017-03-01 09:19:55 -08:00
|
|
|
WIN_EXPORT YGNodeRef YGNodeNewWithConfig(const YGConfigRef config);
|
2016-12-03 04:40:18 -08:00
|
|
|
WIN_EXPORT void YGNodeFree(const YGNodeRef node);
|
|
|
|
WIN_EXPORT void YGNodeFreeRecursive(const YGNodeRef node);
|
|
|
|
WIN_EXPORT void YGNodeReset(const YGNodeRef node);
|
|
|
|
WIN_EXPORT int32_t YGNodeGetInstanceCount(void);
|
|
|
|
|
|
|
|
WIN_EXPORT void YGNodeInsertChild(const YGNodeRef node,
|
|
|
|
const YGNodeRef child,
|
|
|
|
const uint32_t index);
|
|
|
|
WIN_EXPORT void YGNodeRemoveChild(const YGNodeRef node, const YGNodeRef child);
|
|
|
|
WIN_EXPORT YGNodeRef YGNodeGetChild(const YGNodeRef node, const uint32_t index);
|
2016-12-15 08:49:51 -08:00
|
|
|
WIN_EXPORT YGNodeRef YGNodeGetParent(const YGNodeRef node);
|
2016-12-16 04:39:13 -08:00
|
|
|
WIN_EXPORT uint32_t YGNodeGetChildCount(const YGNodeRef node);
|
2016-12-03 04:40:18 -08:00
|
|
|
|
|
|
|
WIN_EXPORT void YGNodeCalculateLayout(const YGNodeRef node,
|
|
|
|
const float availableWidth,
|
|
|
|
const float availableHeight,
|
|
|
|
const YGDirection parentDirection);
|
|
|
|
|
|
|
|
// Mark a node as dirty. Only valid for nodes with a custom measure function
|
|
|
|
// set.
|
|
|
|
// YG knows when to mark all other nodes as dirty but because nodes with
|
|
|
|
// measure functions
|
|
|
|
// depends on information not known to YG they must perform this dirty
|
|
|
|
// marking manually.
|
|
|
|
WIN_EXPORT void YGNodeMarkDirty(const YGNodeRef node);
|
|
|
|
WIN_EXPORT bool YGNodeIsDirty(const YGNodeRef node);
|
|
|
|
|
|
|
|
WIN_EXPORT void YGNodePrint(const YGNodeRef node, const YGPrintOptions options);
|
|
|
|
|
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
|
|
|
WIN_EXPORT bool YGFloatIsUndefined(const float value);
|
2016-12-03 04:40:18 -08:00
|
|
|
|
|
|
|
WIN_EXPORT bool YGNodeCanUseCachedMeasurement(const YGMeasureMode widthMode,
|
|
|
|
const float width,
|
|
|
|
const YGMeasureMode heightMode,
|
|
|
|
const float height,
|
|
|
|
const YGMeasureMode lastWidthMode,
|
|
|
|
const float lastWidth,
|
|
|
|
const YGMeasureMode lastHeightMode,
|
|
|
|
const float lastHeight,
|
|
|
|
const float lastComputedWidth,
|
|
|
|
const float lastComputedHeight,
|
|
|
|
const float marginRow,
|
|
|
|
const float marginColumn);
|
|
|
|
|
|
|
|
WIN_EXPORT void YGNodeCopyStyle(const YGNodeRef dstNode, const YGNodeRef srcNode);
|
|
|
|
|
|
|
|
#define YG_NODE_PROPERTY(type, name, paramName) \
|
|
|
|
WIN_EXPORT void YGNodeSet##name(const YGNodeRef node, type paramName); \
|
|
|
|
WIN_EXPORT type YGNodeGet##name(const YGNodeRef node);
|
|
|
|
|
|
|
|
#define YG_NODE_STYLE_PROPERTY(type, name, paramName) \
|
|
|
|
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, const type paramName); \
|
|
|
|
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node);
|
|
|
|
|
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
|
|
|
#define YG_NODE_STYLE_PROPERTY_UNIT(type, name, paramName) \
|
|
|
|
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, const float paramName); \
|
|
|
|
WIN_EXPORT void YGNodeStyleSet##name##Percent(const YGNodeRef node, const float paramName); \
|
|
|
|
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node);
|
|
|
|
|
2017-02-14 14:26:09 -08:00
|
|
|
#define YG_NODE_STYLE_PROPERTY_UNIT_AUTO(type, name, paramName) \
|
|
|
|
YG_NODE_STYLE_PROPERTY_UNIT(type, name, paramName) \
|
|
|
|
WIN_EXPORT void YGNodeStyleSet##name##Auto(const YGNodeRef node);
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
#define YG_NODE_STYLE_EDGE_PROPERTY(type, name, paramName) \
|
|
|
|
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, \
|
|
|
|
const YGEdge edge, \
|
|
|
|
const type paramName); \
|
|
|
|
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge);
|
|
|
|
|
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
|
|
|
#define YG_NODE_STYLE_EDGE_PROPERTY_UNIT(type, name, paramName) \
|
|
|
|
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, \
|
|
|
|
const YGEdge edge, \
|
|
|
|
const float paramName); \
|
|
|
|
WIN_EXPORT void YGNodeStyleSet##name##Percent(const YGNodeRef node, \
|
|
|
|
const YGEdge edge, \
|
|
|
|
const float paramName); \
|
|
|
|
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge);
|
|
|
|
|
2017-02-14 14:26:09 -08:00
|
|
|
#define YG_NODE_STYLE_EDGE_PROPERTY_UNIT_AUTO(type, name) \
|
|
|
|
WIN_EXPORT void YGNodeStyleSet##name##Auto(const YGNodeRef node, const YGEdge edge);
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
#define YG_NODE_LAYOUT_PROPERTY(type, name) \
|
|
|
|
WIN_EXPORT type YGNodeLayoutGet##name(const YGNodeRef node);
|
|
|
|
|
2017-01-26 13:36:38 -08:00
|
|
|
#define YG_NODE_LAYOUT_EDGE_PROPERTY(type, name) \
|
|
|
|
WIN_EXPORT type YGNodeLayoutGet##name(const YGNodeRef node, const YGEdge edge);
|
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
YG_NODE_PROPERTY(void *, Context, context);
|
|
|
|
YG_NODE_PROPERTY(YGMeasureFunc, MeasureFunc, measureFunc);
|
2017-01-06 06:51:56 -08:00
|
|
|
YG_NODE_PROPERTY(YGBaselineFunc, BaselineFunc, baselineFunc)
|
2016-12-03 04:40:18 -08:00
|
|
|
YG_NODE_PROPERTY(YGPrintFunc, PrintFunc, printFunc);
|
|
|
|
YG_NODE_PROPERTY(bool, HasNewLayout, hasNewLayout);
|
|
|
|
|
|
|
|
YG_NODE_STYLE_PROPERTY(YGDirection, Direction, direction);
|
|
|
|
YG_NODE_STYLE_PROPERTY(YGFlexDirection, FlexDirection, flexDirection);
|
|
|
|
YG_NODE_STYLE_PROPERTY(YGJustify, JustifyContent, justifyContent);
|
|
|
|
YG_NODE_STYLE_PROPERTY(YGAlign, AlignContent, alignContent);
|
|
|
|
YG_NODE_STYLE_PROPERTY(YGAlign, AlignItems, alignItems);
|
|
|
|
YG_NODE_STYLE_PROPERTY(YGAlign, AlignSelf, alignSelf);
|
|
|
|
YG_NODE_STYLE_PROPERTY(YGPositionType, PositionType, positionType);
|
|
|
|
YG_NODE_STYLE_PROPERTY(YGWrap, FlexWrap, flexWrap);
|
|
|
|
YG_NODE_STYLE_PROPERTY(YGOverflow, Overflow, overflow);
|
2017-02-06 09:31:22 -08:00
|
|
|
YG_NODE_STYLE_PROPERTY(YGDisplay, Display, display);
|
2016-12-03 04:40:18 -08:00
|
|
|
|
2017-02-28 09:17:17 -08:00
|
|
|
YG_NODE_STYLE_PROPERTY(float, Flex, flex);
|
2016-12-03 04:40:18 -08:00
|
|
|
YG_NODE_STYLE_PROPERTY(float, FlexGrow, flexGrow);
|
|
|
|
YG_NODE_STYLE_PROPERTY(float, FlexShrink, flexShrink);
|
2017-02-14 14:26:09 -08:00
|
|
|
YG_NODE_STYLE_PROPERTY_UNIT_AUTO(YGValue, FlexBasis, flexBasis);
|
2016-12-03 04:40:18 -08:00
|
|
|
|
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
|
|
|
YG_NODE_STYLE_EDGE_PROPERTY_UNIT(YGValue, Position, position);
|
|
|
|
YG_NODE_STYLE_EDGE_PROPERTY_UNIT(YGValue, Margin, margin);
|
2017-02-14 14:26:09 -08:00
|
|
|
YG_NODE_STYLE_EDGE_PROPERTY_UNIT_AUTO(YGValue, Margin);
|
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
|
|
|
YG_NODE_STYLE_EDGE_PROPERTY_UNIT(YGValue, Padding, padding);
|
2016-12-03 04:40:18 -08:00
|
|
|
YG_NODE_STYLE_EDGE_PROPERTY(float, Border, border);
|
|
|
|
|
2017-02-14 14:26:09 -08:00
|
|
|
YG_NODE_STYLE_PROPERTY_UNIT_AUTO(YGValue, Width, width);
|
|
|
|
YG_NODE_STYLE_PROPERTY_UNIT_AUTO(YGValue, Height, height);
|
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
|
|
|
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, MinWidth, minWidth);
|
|
|
|
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, MinHeight, minHeight);
|
|
|
|
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, MaxWidth, maxWidth);
|
|
|
|
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, MaxHeight, maxHeight);
|
2016-12-03 04:40:18 -08:00
|
|
|
|
|
|
|
// Yoga specific properties, not compatible with flexbox specification
|
|
|
|
// Aspect ratio control the size of the undefined dimension of a node.
|
2016-12-22 02:57:15 -08:00
|
|
|
// Aspect ratio is encoded as a floating point value width/height. e.g. A value of 2 leads to a node
|
|
|
|
// with a width twice the size of its height while a value of 0.5 gives the opposite effect.
|
|
|
|
//
|
2016-12-03 04:40:18 -08:00
|
|
|
// - On a node with a set width/height aspect ratio control the size of the unset dimension
|
|
|
|
// - On a node with a set flex basis aspect ratio controls the size of the node in the cross axis if
|
|
|
|
// unset
|
|
|
|
// - On a node with a measure function aspect ratio works as though the measure function measures
|
|
|
|
// the flex basis
|
|
|
|
// - On a node with flex grow/shrink aspect ratio controls the size of the node in the cross axis if
|
|
|
|
// unset
|
|
|
|
// - Aspect ratio takes min/max dimensions into account
|
|
|
|
YG_NODE_STYLE_PROPERTY(float, AspectRatio, aspectRatio);
|
|
|
|
|
|
|
|
YG_NODE_LAYOUT_PROPERTY(float, Left);
|
|
|
|
YG_NODE_LAYOUT_PROPERTY(float, Top);
|
|
|
|
YG_NODE_LAYOUT_PROPERTY(float, Right);
|
|
|
|
YG_NODE_LAYOUT_PROPERTY(float, Bottom);
|
|
|
|
YG_NODE_LAYOUT_PROPERTY(float, Width);
|
|
|
|
YG_NODE_LAYOUT_PROPERTY(float, Height);
|
|
|
|
YG_NODE_LAYOUT_PROPERTY(YGDirection, Direction);
|
|
|
|
|
2017-01-26 13:36:38 -08:00
|
|
|
// Get the computed values for these nodes after performing layout. If they were set using
|
2017-02-14 14:26:13 -08:00
|
|
|
// point values then the returned value will be the same as YGNodeStyleGetXXX. However if
|
2017-01-26 13:36:38 -08:00
|
|
|
// they were set using a percentage value then the returned value is the computed value used
|
2017-01-05 12:48:07 -08:00
|
|
|
// during layout.
|
2017-01-26 13:36:38 -08:00
|
|
|
YG_NODE_LAYOUT_EDGE_PROPERTY(float, Margin);
|
|
|
|
YG_NODE_LAYOUT_EDGE_PROPERTY(float, Border);
|
|
|
|
YG_NODE_LAYOUT_EDGE_PROPERTY(float, Padding);
|
2017-01-05 12:48:07 -08:00
|
|
|
|
2016-12-03 04:40:18 -08:00
|
|
|
WIN_EXPORT void YGSetLogger(YGLogger logger);
|
|
|
|
WIN_EXPORT void YGLog(YGLogLevel level, const char *message, ...);
|
|
|
|
|
2017-02-24 09:45:31 -08:00
|
|
|
// Set this to number of pixels in 1 point to round calculation results
|
|
|
|
// If you want to avoid rounding - set PointScaleFactor to 0
|
|
|
|
WIN_EXPORT void YGSetPointScaleFactor(float pixelsInPoint);
|
|
|
|
|
2017-03-01 09:19:55 -08:00
|
|
|
// YGConfig
|
|
|
|
WIN_EXPORT YGConfigRef YGConfigNew(void);
|
|
|
|
WIN_EXPORT void YGConfigFree(const YGConfigRef config);
|
|
|
|
|
|
|
|
WIN_EXPORT void YGConfigSetExperimentalFeatureEnabled(const YGConfigRef config,
|
|
|
|
const YGExperimentalFeature feature,
|
|
|
|
const bool enabled);
|
|
|
|
WIN_EXPORT bool YGConfigIsExperimentalFeatureEnabled(const YGConfigRef config,
|
|
|
|
const YGExperimentalFeature feature);
|
2016-12-03 04:40:18 -08:00
|
|
|
|
|
|
|
WIN_EXPORT void
|
2016-12-07 05:12:11 -08:00
|
|
|
YGSetMemoryFuncs(YGMalloc ygmalloc, YGCalloc yccalloc, YGRealloc ygrealloc, YGFree ygfree);
|
2016-12-03 04:40:18 -08:00
|
|
|
|
|
|
|
YG_EXTERN_C_END
|