Cleanup visibility macros (#1372)
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1372 X-link: https://github.com/facebook/react-native/pull/39375 D18029030 added `-fvisibility-hidden`, and a corresponding `YOGA_EXPORT` macro for defining shared library visibility. This is used inline next to function and class definitions that should be exported out of the binary. There was already a `WIN_EXPORT` macro doing the same thing when building a DLL, defined in the headers instead of CPP files, and it seems like sometimes folks forgot to add it to new public APIs after? This reconciles the redundant macros into a single visibility macro, that we always place with declaration instead of definition. We also rename `YOGA_EXPORT` to `YG_EXPORT` to match the naming convention of other Yoga macros. Reviewed By: rshest Differential Revision: D49132643 fbshipit-source-id: cafa6de0c300788a72d9a446ce07c5ac89a20a8e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0720e0b22a
commit
241c5e4baf
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace facebook::yoga::test {
|
||||
|
||||
struct YOGA_EXPORT TestUtil {
|
||||
struct TestUtil {
|
||||
static void startCountingNodes();
|
||||
static int nodeCount();
|
||||
static int stopCountingNodes();
|
||||
|
@@ -28,17 +28,11 @@
|
||||
#endif
|
||||
|
||||
#ifdef _WINDLL
|
||||
#define WIN_EXPORT __declspec(dllexport)
|
||||
#define YG_EXPORT __declspec(dllexport)
|
||||
#elif !defined(_MSC_VER)
|
||||
#define YG_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
#define WIN_EXPORT
|
||||
#endif
|
||||
|
||||
#ifndef YOGA_EXPORT
|
||||
#ifdef _MSC_VER
|
||||
#define YOGA_EXPORT
|
||||
#else
|
||||
#define YOGA_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
#define YG_EXPORT
|
||||
#endif
|
||||
|
||||
#ifdef NS_ENUM
|
||||
@@ -113,7 +107,7 @@ constexpr int n() {
|
||||
|
||||
#define YG_ENUM_DECL(NAME, ...) \
|
||||
typedef YG_ENUM_BEGIN(NAME){__VA_ARGS__} YG_ENUM_END(NAME); \
|
||||
WIN_EXPORT const char* NAME##ToString(NAME);
|
||||
YG_EXPORT const char* NAME##ToString(NAME);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define YG_ENUM_SEQ_DECL(NAME, ...) \
|
||||
|
@@ -17,9 +17,9 @@ typedef struct YGValue {
|
||||
YGUnit unit;
|
||||
} YGValue;
|
||||
|
||||
YOGA_EXPORT extern const YGValue YGValueAuto;
|
||||
YOGA_EXPORT extern const YGValue YGValueUndefined;
|
||||
YOGA_EXPORT extern const YGValue YGValueZero;
|
||||
YG_EXPORT extern const YGValue YGValueAuto;
|
||||
YG_EXPORT extern const YGValue YGValueUndefined;
|
||||
YG_EXPORT extern const YGValue YGValueZero;
|
||||
|
||||
YG_EXTERN_C_END
|
||||
|
||||
|
@@ -15,7 +15,7 @@
|
||||
|
||||
YG_EXTERN_C_BEGIN
|
||||
|
||||
void YGNodeCalculateLayoutWithContext(
|
||||
YG_EXPORT void YGNodeCalculateLayoutWithContext(
|
||||
YGNodeRef node,
|
||||
float availableWidth,
|
||||
float availableHeight,
|
||||
@@ -24,6 +24,6 @@ void YGNodeCalculateLayoutWithContext(
|
||||
|
||||
// Deallocates a Yoga Node. Unlike YGNodeFree, does not remove the node from
|
||||
// its parent or children.
|
||||
void YGNodeDeallocate(YGNodeRef node);
|
||||
YG_EXPORT void YGNodeDeallocate(YGNodeRef node);
|
||||
|
||||
YG_EXTERN_C_END
|
||||
|
329
yoga/Yoga.cpp
329
yoga/Yoga.cpp
@@ -20,91 +20,83 @@
|
||||
using namespace facebook;
|
||||
using namespace facebook::yoga;
|
||||
|
||||
YOGA_EXPORT bool YGFloatIsUndefined(const float value) {
|
||||
bool YGFloatIsUndefined(const float value) {
|
||||
return yoga::isUndefined(value);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void* YGNodeGetContext(YGNodeConstRef node) {
|
||||
void* YGNodeGetContext(YGNodeConstRef node) {
|
||||
return resolveRef(node)->getContext();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeSetContext(YGNodeRef node, void* context) {
|
||||
void YGNodeSetContext(YGNodeRef node, void* context) {
|
||||
return resolveRef(node)->setContext(context);
|
||||
}
|
||||
|
||||
YOGA_EXPORT YGConfigConstRef YGNodeGetConfig(YGNodeRef node) {
|
||||
YGConfigConstRef YGNodeGetConfig(YGNodeRef node) {
|
||||
return resolveRef(node)->getConfig();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeSetConfig(YGNodeRef node, YGConfigRef config) {
|
||||
void YGNodeSetConfig(YGNodeRef node, YGConfigRef config) {
|
||||
resolveRef(node)->setConfig(resolveRef(config));
|
||||
}
|
||||
|
||||
YOGA_EXPORT bool YGNodeHasMeasureFunc(YGNodeConstRef node) {
|
||||
bool YGNodeHasMeasureFunc(YGNodeConstRef node) {
|
||||
return resolveRef(node)->hasMeasureFunc();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeSetMeasureFunc(
|
||||
YGNodeRef node,
|
||||
YGMeasureFunc measureFunc) {
|
||||
void YGNodeSetMeasureFunc(YGNodeRef node, YGMeasureFunc measureFunc) {
|
||||
resolveRef(node)->setMeasureFunc(measureFunc);
|
||||
}
|
||||
|
||||
YOGA_EXPORT bool YGNodeHasBaselineFunc(YGNodeConstRef node) {
|
||||
bool YGNodeHasBaselineFunc(YGNodeConstRef node) {
|
||||
return resolveRef(node)->hasBaselineFunc();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeSetBaselineFunc(
|
||||
YGNodeRef node,
|
||||
YGBaselineFunc baselineFunc) {
|
||||
void YGNodeSetBaselineFunc(YGNodeRef node, YGBaselineFunc baselineFunc) {
|
||||
resolveRef(node)->setBaselineFunc(baselineFunc);
|
||||
}
|
||||
|
||||
YOGA_EXPORT YGDirtiedFunc YGNodeGetDirtiedFunc(YGNodeConstRef node) {
|
||||
YGDirtiedFunc YGNodeGetDirtiedFunc(YGNodeConstRef node) {
|
||||
return resolveRef(node)->getDirtied();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeSetDirtiedFunc(
|
||||
YGNodeRef node,
|
||||
YGDirtiedFunc dirtiedFunc) {
|
||||
void YGNodeSetDirtiedFunc(YGNodeRef node, YGDirtiedFunc dirtiedFunc) {
|
||||
resolveRef(node)->setDirtiedFunc(dirtiedFunc);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeSetPrintFunc(YGNodeRef node, YGPrintFunc printFunc) {
|
||||
void YGNodeSetPrintFunc(YGNodeRef node, YGPrintFunc printFunc) {
|
||||
resolveRef(node)->setPrintFunc(printFunc);
|
||||
}
|
||||
|
||||
YOGA_EXPORT bool YGNodeGetHasNewLayout(YGNodeConstRef node) {
|
||||
bool YGNodeGetHasNewLayout(YGNodeConstRef node) {
|
||||
return resolveRef(node)->getHasNewLayout();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGConfigSetPrintTreeFlag(YGConfigRef config, bool enabled) {
|
||||
void YGConfigSetPrintTreeFlag(YGConfigRef config, bool enabled) {
|
||||
resolveRef(config)->setShouldPrintTree(enabled);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout) {
|
||||
void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout) {
|
||||
resolveRef(node)->setHasNewLayout(hasNewLayout);
|
||||
}
|
||||
|
||||
YOGA_EXPORT YGNodeType YGNodeGetNodeType(YGNodeConstRef node) {
|
||||
YGNodeType YGNodeGetNodeType(YGNodeConstRef node) {
|
||||
return resolveRef(node)->getNodeType();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeSetNodeType(YGNodeRef node, YGNodeType nodeType) {
|
||||
void YGNodeSetNodeType(YGNodeRef node, YGNodeType nodeType) {
|
||||
return resolveRef(node)->setNodeType(nodeType);
|
||||
}
|
||||
|
||||
YOGA_EXPORT bool YGNodeIsDirty(YGNodeConstRef node) {
|
||||
bool YGNodeIsDirty(YGNodeConstRef node) {
|
||||
return resolveRef(node)->isDirty();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeMarkDirtyAndPropagateToDescendants(
|
||||
const YGNodeRef node) {
|
||||
void YGNodeMarkDirtyAndPropagateToDescendants(const YGNodeRef node) {
|
||||
return resolveRef(node)->markDirtyAndPropagateDownwards();
|
||||
}
|
||||
|
||||
YOGA_EXPORT WIN_EXPORT YGNodeRef
|
||||
YGNodeNewWithConfig(const YGConfigConstRef config) {
|
||||
YGNodeRef YGNodeNewWithConfig(const YGConfigConstRef config) {
|
||||
auto* node = new yoga::Node{resolveRef(config)};
|
||||
yoga::assertFatal(
|
||||
config != nullptr, "Tried to construct YGNode with null config");
|
||||
@@ -113,15 +105,15 @@ YGNodeNewWithConfig(const YGConfigConstRef config) {
|
||||
return node;
|
||||
}
|
||||
|
||||
YOGA_EXPORT YGConfigConstRef YGConfigGetDefault() {
|
||||
YGConfigConstRef YGConfigGetDefault() {
|
||||
return &yoga::Config::getDefault();
|
||||
}
|
||||
|
||||
YOGA_EXPORT YGNodeRef YGNodeNew(void) {
|
||||
YGNodeRef YGNodeNew(void) {
|
||||
return YGNodeNewWithConfig(YGConfigGetDefault());
|
||||
}
|
||||
|
||||
YOGA_EXPORT YGNodeRef YGNodeClone(YGNodeConstRef oldNodeRef) {
|
||||
YGNodeRef YGNodeClone(YGNodeConstRef oldNodeRef) {
|
||||
auto oldNode = resolveRef(oldNodeRef);
|
||||
const auto node = new yoga::Node(*oldNode);
|
||||
yoga::assertFatalWithConfig(
|
||||
@@ -133,7 +125,7 @@ YOGA_EXPORT YGNodeRef YGNodeClone(YGNodeConstRef oldNodeRef) {
|
||||
return node;
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeFree(const YGNodeRef nodeRef) {
|
||||
void YGNodeFree(const YGNodeRef nodeRef) {
|
||||
const auto node = resolveRef(nodeRef);
|
||||
|
||||
if (auto owner = node->getOwner()) {
|
||||
@@ -151,12 +143,12 @@ YOGA_EXPORT void YGNodeFree(const YGNodeRef nodeRef) {
|
||||
YGNodeDeallocate(node);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeDeallocate(const YGNodeRef node) {
|
||||
void YGNodeDeallocate(const YGNodeRef node) {
|
||||
Event::publish<Event::NodeDeallocation>(node, {YGNodeGetConfig(node)});
|
||||
delete resolveRef(node);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeFreeRecursiveWithCleanupFunc(
|
||||
void YGNodeFreeRecursiveWithCleanupFunc(
|
||||
const YGNodeRef rootRef,
|
||||
YGNodeCleanupFunc cleanup) {
|
||||
const auto root = resolveRef(rootRef);
|
||||
@@ -178,25 +170,23 @@ YOGA_EXPORT void YGNodeFreeRecursiveWithCleanupFunc(
|
||||
YGNodeFree(root);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeFreeRecursive(const YGNodeRef root) {
|
||||
void YGNodeFreeRecursive(const YGNodeRef root) {
|
||||
return YGNodeFreeRecursiveWithCleanupFunc(root, nullptr);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeReset(YGNodeRef node) {
|
||||
void YGNodeReset(YGNodeRef node) {
|
||||
resolveRef(node)->reset();
|
||||
}
|
||||
|
||||
YOGA_EXPORT YGConfigRef YGConfigNew(void) {
|
||||
YGConfigRef YGConfigNew(void) {
|
||||
return new yoga::Config(getDefaultLogger());
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGConfigFree(const YGConfigRef config) {
|
||||
void YGConfigFree(const YGConfigRef config) {
|
||||
delete resolveRef(config);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeSetIsReferenceBaseline(
|
||||
YGNodeRef nodeRef,
|
||||
bool isReferenceBaseline) {
|
||||
void YGNodeSetIsReferenceBaseline(YGNodeRef nodeRef, bool isReferenceBaseline) {
|
||||
const auto node = resolveRef(nodeRef);
|
||||
if (node->isReferenceBaseline() != isReferenceBaseline) {
|
||||
node->setIsReferenceBaseline(isReferenceBaseline);
|
||||
@@ -204,11 +194,11 @@ YOGA_EXPORT void YGNodeSetIsReferenceBaseline(
|
||||
}
|
||||
}
|
||||
|
||||
YOGA_EXPORT bool YGNodeIsReferenceBaseline(YGNodeConstRef node) {
|
||||
bool YGNodeIsReferenceBaseline(YGNodeConstRef node) {
|
||||
return resolveRef(node)->isReferenceBaseline();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeInsertChild(
|
||||
void YGNodeInsertChild(
|
||||
const YGNodeRef ownerRef,
|
||||
const YGNodeRef childRef,
|
||||
const size_t index) {
|
||||
@@ -230,7 +220,7 @@ YOGA_EXPORT void YGNodeInsertChild(
|
||||
owner->markDirtyAndPropagate();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeSwapChild(
|
||||
void YGNodeSwapChild(
|
||||
const YGNodeRef ownerRef,
|
||||
const YGNodeRef childRef,
|
||||
const size_t index) {
|
||||
@@ -241,7 +231,7 @@ YOGA_EXPORT void YGNodeSwapChild(
|
||||
child->setOwner(owner);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeRemoveChild(
|
||||
void YGNodeRemoveChild(
|
||||
const YGNodeRef ownerRef,
|
||||
const YGNodeRef excludedChildRef) {
|
||||
auto owner = resolveRef(ownerRef);
|
||||
@@ -265,7 +255,7 @@ YOGA_EXPORT void YGNodeRemoveChild(
|
||||
}
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeRemoveAllChildren(const YGNodeRef ownerRef) {
|
||||
void YGNodeRemoveAllChildren(const YGNodeRef ownerRef) {
|
||||
auto owner = resolveRef(ownerRef);
|
||||
|
||||
const size_t childCount = owner->getChildCount();
|
||||
@@ -292,7 +282,7 @@ YOGA_EXPORT void YGNodeRemoveAllChildren(const YGNodeRef ownerRef) {
|
||||
owner->markDirtyAndPropagate();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeSetChildren(
|
||||
void YGNodeSetChildren(
|
||||
const YGNodeRef ownerRef,
|
||||
const YGNodeRef* childrenRefs,
|
||||
const size_t count) {
|
||||
@@ -333,8 +323,7 @@ YOGA_EXPORT void YGNodeSetChildren(
|
||||
}
|
||||
}
|
||||
|
||||
YOGA_EXPORT YGNodeRef
|
||||
YGNodeGetChild(const YGNodeRef nodeRef, const size_t index) {
|
||||
YGNodeRef YGNodeGetChild(const YGNodeRef nodeRef, const size_t index) {
|
||||
const auto node = resolveRef(nodeRef);
|
||||
|
||||
if (index < node->getChildren().size()) {
|
||||
@@ -343,19 +332,19 @@ YGNodeGetChild(const YGNodeRef nodeRef, const size_t index) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
YOGA_EXPORT size_t YGNodeGetChildCount(const YGNodeConstRef node) {
|
||||
size_t YGNodeGetChildCount(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getChildren().size();
|
||||
}
|
||||
|
||||
YOGA_EXPORT YGNodeRef YGNodeGetOwner(const YGNodeRef node) {
|
||||
YGNodeRef YGNodeGetOwner(const YGNodeRef node) {
|
||||
return resolveRef(node)->getOwner();
|
||||
}
|
||||
|
||||
YOGA_EXPORT YGNodeRef YGNodeGetParent(const YGNodeRef node) {
|
||||
YGNodeRef YGNodeGetParent(const YGNodeRef node) {
|
||||
return resolveRef(node)->getOwner();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeMarkDirty(const YGNodeRef nodeRef) {
|
||||
void YGNodeMarkDirty(const YGNodeRef nodeRef) {
|
||||
const auto node = resolveRef(nodeRef);
|
||||
|
||||
yoga::assertFatalWithNode(
|
||||
@@ -367,7 +356,7 @@ YOGA_EXPORT void YGNodeMarkDirty(const YGNodeRef nodeRef) {
|
||||
node->markDirtyAndPropagate();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeCopyStyle(
|
||||
void YGNodeCopyStyle(
|
||||
const YGNodeRef dstNodeRef,
|
||||
const YGNodeConstRef srcNodeRef) {
|
||||
auto dstNode = resolveRef(dstNodeRef);
|
||||
@@ -379,14 +368,14 @@ YOGA_EXPORT void YGNodeCopyStyle(
|
||||
}
|
||||
}
|
||||
|
||||
YOGA_EXPORT float YGNodeStyleGetFlexGrow(const YGNodeConstRef nodeRef) {
|
||||
float YGNodeStyleGetFlexGrow(const YGNodeConstRef nodeRef) {
|
||||
const auto node = resolveRef(nodeRef);
|
||||
return node->getStyle().flexGrow().isUndefined()
|
||||
? Style::DefaultFlexGrow
|
||||
: node->getStyle().flexGrow().unwrap();
|
||||
}
|
||||
|
||||
YOGA_EXPORT float YGNodeStyleGetFlexShrink(const YGNodeConstRef nodeRef) {
|
||||
float YGNodeStyleGetFlexShrink(const YGNodeConstRef nodeRef) {
|
||||
const auto node = resolveRef(nodeRef);
|
||||
return node->getStyle().flexShrink().isUndefined()
|
||||
? (node->getConfig()->useWebDefaults() ? Style::WebDefaultFlexShrink
|
||||
@@ -439,109 +428,95 @@ void updateIndexedStyleProp(
|
||||
// decltype, MSVC will prefer the non-const version.
|
||||
#define MSVC_HINT(PROP) decltype(Style{}.PROP())
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetDirection(
|
||||
const YGNodeRef node,
|
||||
const YGDirection value) {
|
||||
void YGNodeStyleSetDirection(const YGNodeRef node, const YGDirection value) {
|
||||
updateStyle<MSVC_HINT(direction)>(node, &Style::direction, value);
|
||||
}
|
||||
YOGA_EXPORT YGDirection YGNodeStyleGetDirection(const YGNodeConstRef node) {
|
||||
YGDirection YGNodeStyleGetDirection(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().direction();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetFlexDirection(
|
||||
void YGNodeStyleSetFlexDirection(
|
||||
const YGNodeRef node,
|
||||
const YGFlexDirection flexDirection) {
|
||||
updateStyle<MSVC_HINT(flexDirection)>(
|
||||
node, &Style::flexDirection, flexDirection);
|
||||
}
|
||||
YOGA_EXPORT YGFlexDirection
|
||||
YGNodeStyleGetFlexDirection(const YGNodeConstRef node) {
|
||||
YGFlexDirection YGNodeStyleGetFlexDirection(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().flexDirection();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetJustifyContent(
|
||||
void YGNodeStyleSetJustifyContent(
|
||||
const YGNodeRef node,
|
||||
const YGJustify justifyContent) {
|
||||
updateStyle<MSVC_HINT(justifyContent)>(
|
||||
node, &Style::justifyContent, justifyContent);
|
||||
}
|
||||
YOGA_EXPORT YGJustify YGNodeStyleGetJustifyContent(const YGNodeConstRef node) {
|
||||
YGJustify YGNodeStyleGetJustifyContent(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().justifyContent();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetAlignContent(
|
||||
void YGNodeStyleSetAlignContent(
|
||||
const YGNodeRef node,
|
||||
const YGAlign alignContent) {
|
||||
updateStyle<MSVC_HINT(alignContent)>(
|
||||
node, &Style::alignContent, alignContent);
|
||||
}
|
||||
YOGA_EXPORT YGAlign YGNodeStyleGetAlignContent(const YGNodeConstRef node) {
|
||||
YGAlign YGNodeStyleGetAlignContent(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().alignContent();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetAlignItems(
|
||||
const YGNodeRef node,
|
||||
const YGAlign alignItems) {
|
||||
void YGNodeStyleSetAlignItems(const YGNodeRef node, const YGAlign alignItems) {
|
||||
updateStyle<MSVC_HINT(alignItems)>(node, &Style::alignItems, alignItems);
|
||||
}
|
||||
YOGA_EXPORT YGAlign YGNodeStyleGetAlignItems(const YGNodeConstRef node) {
|
||||
YGAlign YGNodeStyleGetAlignItems(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().alignItems();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetAlignSelf(
|
||||
const YGNodeRef node,
|
||||
const YGAlign alignSelf) {
|
||||
void YGNodeStyleSetAlignSelf(const YGNodeRef node, const YGAlign alignSelf) {
|
||||
updateStyle<MSVC_HINT(alignSelf)>(node, &Style::alignSelf, alignSelf);
|
||||
}
|
||||
YOGA_EXPORT YGAlign YGNodeStyleGetAlignSelf(const YGNodeConstRef node) {
|
||||
YGAlign YGNodeStyleGetAlignSelf(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().alignSelf();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetPositionType(
|
||||
void YGNodeStyleSetPositionType(
|
||||
const YGNodeRef node,
|
||||
const YGPositionType positionType) {
|
||||
updateStyle<MSVC_HINT(positionType)>(
|
||||
node, &Style::positionType, positionType);
|
||||
}
|
||||
YOGA_EXPORT YGPositionType
|
||||
YGNodeStyleGetPositionType(const YGNodeConstRef node) {
|
||||
YGPositionType YGNodeStyleGetPositionType(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().positionType();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetFlexWrap(
|
||||
const YGNodeRef node,
|
||||
const YGWrap flexWrap) {
|
||||
void YGNodeStyleSetFlexWrap(const YGNodeRef node, const YGWrap flexWrap) {
|
||||
updateStyle<MSVC_HINT(flexWrap)>(node, &Style::flexWrap, flexWrap);
|
||||
}
|
||||
YOGA_EXPORT YGWrap YGNodeStyleGetFlexWrap(const YGNodeConstRef node) {
|
||||
YGWrap YGNodeStyleGetFlexWrap(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().flexWrap();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetOverflow(
|
||||
const YGNodeRef node,
|
||||
const YGOverflow overflow) {
|
||||
void YGNodeStyleSetOverflow(const YGNodeRef node, const YGOverflow overflow) {
|
||||
updateStyle<MSVC_HINT(overflow)>(node, &Style::overflow, overflow);
|
||||
}
|
||||
YOGA_EXPORT YGOverflow YGNodeStyleGetOverflow(const YGNodeConstRef node) {
|
||||
YGOverflow YGNodeStyleGetOverflow(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().overflow();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetDisplay(
|
||||
const YGNodeRef node,
|
||||
const YGDisplay display) {
|
||||
void YGNodeStyleSetDisplay(const YGNodeRef node, const YGDisplay display) {
|
||||
updateStyle<MSVC_HINT(display)>(node, &Style::display, display);
|
||||
}
|
||||
YOGA_EXPORT YGDisplay YGNodeStyleGetDisplay(const YGNodeConstRef node) {
|
||||
YGDisplay YGNodeStyleGetDisplay(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().display();
|
||||
}
|
||||
|
||||
// TODO(T26792433): Change the API to accept FloatOptional.
|
||||
YOGA_EXPORT void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) {
|
||||
void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) {
|
||||
updateStyle<MSVC_HINT(flex)>(node, &Style::flex, FloatOptional{flex});
|
||||
}
|
||||
|
||||
// TODO(T26792433): Change the API to accept FloatOptional.
|
||||
YOGA_EXPORT float YGNodeStyleGetFlex(const YGNodeConstRef nodeRef) {
|
||||
float YGNodeStyleGetFlex(const YGNodeConstRef nodeRef) {
|
||||
const auto node = resolveRef(nodeRef);
|
||||
return node->getStyle().flex().isUndefined()
|
||||
? YGUndefined
|
||||
@@ -549,22 +524,18 @@ YOGA_EXPORT float YGNodeStyleGetFlex(const YGNodeConstRef nodeRef) {
|
||||
}
|
||||
|
||||
// TODO(T26792433): Change the API to accept FloatOptional.
|
||||
YOGA_EXPORT void YGNodeStyleSetFlexGrow(
|
||||
const YGNodeRef node,
|
||||
const float flexGrow) {
|
||||
void YGNodeStyleSetFlexGrow(const YGNodeRef node, const float flexGrow) {
|
||||
updateStyle<MSVC_HINT(flexGrow)>(
|
||||
node, &Style::flexGrow, FloatOptional{flexGrow});
|
||||
}
|
||||
|
||||
// TODO(T26792433): Change the API to accept FloatOptional.
|
||||
YOGA_EXPORT void YGNodeStyleSetFlexShrink(
|
||||
const YGNodeRef node,
|
||||
const float flexShrink) {
|
||||
void YGNodeStyleSetFlexShrink(const YGNodeRef node, const float flexShrink) {
|
||||
updateStyle<MSVC_HINT(flexShrink)>(
|
||||
node, &Style::flexShrink, FloatOptional{flexShrink});
|
||||
}
|
||||
|
||||
YOGA_EXPORT YGValue YGNodeStyleGetFlexBasis(const YGNodeConstRef node) {
|
||||
YGValue YGNodeStyleGetFlexBasis(const YGNodeConstRef node) {
|
||||
YGValue flexBasis = resolveRef(node)->getStyle().flexBasis();
|
||||
if (flexBasis.unit == YGUnitUndefined || flexBasis.unit == YGUnitAuto) {
|
||||
// TODO(T26792433): Get rid off the use of YGUndefined at client side
|
||||
@@ -573,89 +544,69 @@ YOGA_EXPORT YGValue YGNodeStyleGetFlexBasis(const YGNodeConstRef node) {
|
||||
return flexBasis;
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetFlexBasis(
|
||||
const YGNodeRef node,
|
||||
const float flexBasis) {
|
||||
void YGNodeStyleSetFlexBasis(const YGNodeRef node, const float flexBasis) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPoint>(flexBasis);
|
||||
updateStyle<MSVC_HINT(flexBasis)>(node, &Style::flexBasis, value);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetFlexBasisPercent(
|
||||
void YGNodeStyleSetFlexBasisPercent(
|
||||
const YGNodeRef node,
|
||||
const float flexBasisPercent) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPercent>(flexBasisPercent);
|
||||
updateStyle<MSVC_HINT(flexBasis)>(node, &Style::flexBasis, value);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetFlexBasisAuto(const YGNodeRef node) {
|
||||
void YGNodeStyleSetFlexBasisAuto(const YGNodeRef node) {
|
||||
updateStyle<MSVC_HINT(flexBasis)>(
|
||||
node, &Style::flexBasis, CompactValue::ofAuto());
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetPosition(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float points) {
|
||||
void YGNodeStyleSetPosition(YGNodeRef node, YGEdge edge, float points) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPoint>(points);
|
||||
updateIndexedStyleProp<MSVC_HINT(position)>(
|
||||
node, &Style::position, edge, value);
|
||||
}
|
||||
YOGA_EXPORT void YGNodeStyleSetPositionPercent(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float percent) {
|
||||
void YGNodeStyleSetPositionPercent(YGNodeRef node, YGEdge edge, float percent) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPercent>(percent);
|
||||
updateIndexedStyleProp<MSVC_HINT(position)>(
|
||||
node, &Style::position, edge, value);
|
||||
}
|
||||
YOGA_EXPORT YGValue YGNodeStyleGetPosition(YGNodeConstRef node, YGEdge edge) {
|
||||
YGValue YGNodeStyleGetPosition(YGNodeConstRef node, YGEdge edge) {
|
||||
return resolveRef(node)->getStyle().position()[edge];
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetMargin(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float points) {
|
||||
void YGNodeStyleSetMargin(YGNodeRef node, YGEdge edge, float points) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPoint>(points);
|
||||
updateIndexedStyleProp<MSVC_HINT(margin)>(node, &Style::margin, edge, value);
|
||||
}
|
||||
YOGA_EXPORT void YGNodeStyleSetMarginPercent(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float percent) {
|
||||
void YGNodeStyleSetMarginPercent(YGNodeRef node, YGEdge edge, float percent) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPercent>(percent);
|
||||
updateIndexedStyleProp<MSVC_HINT(margin)>(node, &Style::margin, edge, value);
|
||||
}
|
||||
YOGA_EXPORT void YGNodeStyleSetMarginAuto(YGNodeRef node, YGEdge edge) {
|
||||
void YGNodeStyleSetMarginAuto(YGNodeRef node, YGEdge edge) {
|
||||
updateIndexedStyleProp<MSVC_HINT(margin)>(
|
||||
node, &Style::margin, edge, CompactValue::ofAuto());
|
||||
}
|
||||
YOGA_EXPORT YGValue YGNodeStyleGetMargin(YGNodeConstRef node, YGEdge edge) {
|
||||
YGValue YGNodeStyleGetMargin(YGNodeConstRef node, YGEdge edge) {
|
||||
return resolveRef(node)->getStyle().margin()[edge];
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetPadding(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float points) {
|
||||
void YGNodeStyleSetPadding(YGNodeRef node, YGEdge edge, float points) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPoint>(points);
|
||||
updateIndexedStyleProp<MSVC_HINT(padding)>(
|
||||
node, &Style::padding, edge, value);
|
||||
}
|
||||
YOGA_EXPORT void YGNodeStyleSetPaddingPercent(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float percent) {
|
||||
void YGNodeStyleSetPaddingPercent(YGNodeRef node, YGEdge edge, float percent) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPercent>(percent);
|
||||
updateIndexedStyleProp<MSVC_HINT(padding)>(
|
||||
node, &Style::padding, edge, value);
|
||||
}
|
||||
YOGA_EXPORT YGValue YGNodeStyleGetPadding(YGNodeConstRef node, YGEdge edge) {
|
||||
YGValue YGNodeStyleGetPadding(YGNodeConstRef node, YGEdge edge) {
|
||||
return resolveRef(node)->getStyle().padding()[edge];
|
||||
}
|
||||
|
||||
// TODO(T26792433): Change the API to accept FloatOptional.
|
||||
YOGA_EXPORT void YGNodeStyleSetBorder(
|
||||
void YGNodeStyleSetBorder(
|
||||
const YGNodeRef node,
|
||||
const YGEdge edge,
|
||||
const float border) {
|
||||
@@ -663,9 +614,7 @@ YOGA_EXPORT void YGNodeStyleSetBorder(
|
||||
updateIndexedStyleProp<MSVC_HINT(border)>(node, &Style::border, edge, value);
|
||||
}
|
||||
|
||||
YOGA_EXPORT float YGNodeStyleGetBorder(
|
||||
const YGNodeConstRef node,
|
||||
const YGEdge edge) {
|
||||
float YGNodeStyleGetBorder(const YGNodeConstRef node, const YGEdge edge) {
|
||||
auto border = resolveRef(node)->getStyle().border()[edge];
|
||||
if (border.isUndefined() || border.isAuto()) {
|
||||
// TODO(T26792433): Rather than returning YGUndefined, change the api to
|
||||
@@ -676,7 +625,7 @@ YOGA_EXPORT float YGNodeStyleGetBorder(
|
||||
return static_cast<YGValue>(border).value;
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetGap(
|
||||
void YGNodeStyleSetGap(
|
||||
const YGNodeRef node,
|
||||
const YGGutter gutter,
|
||||
const float gapLength) {
|
||||
@@ -684,9 +633,7 @@ YOGA_EXPORT void YGNodeStyleSetGap(
|
||||
updateIndexedStyleProp<MSVC_HINT(gap)>(node, &Style::gap, gutter, length);
|
||||
}
|
||||
|
||||
YOGA_EXPORT float YGNodeStyleGetGap(
|
||||
const YGNodeConstRef node,
|
||||
const YGGutter gutter) {
|
||||
float YGNodeStyleGetGap(const YGNodeConstRef node, const YGGutter gutter) {
|
||||
auto gapLength = resolveRef(node)->getStyle().gap()[gutter];
|
||||
if (gapLength.isUndefined() || gapLength.isAuto()) {
|
||||
// TODO(T26792433): Rather than returning YGUndefined, change the api to
|
||||
@@ -700,134 +647,120 @@ YOGA_EXPORT float YGNodeStyleGetGap(
|
||||
// Yoga specific properties, not compatible with flexbox specification
|
||||
|
||||
// TODO(T26792433): Change the API to accept FloatOptional.
|
||||
YOGA_EXPORT float YGNodeStyleGetAspectRatio(const YGNodeConstRef node) {
|
||||
float YGNodeStyleGetAspectRatio(const YGNodeConstRef node) {
|
||||
const FloatOptional op = resolveRef(node)->getStyle().aspectRatio();
|
||||
return op.isUndefined() ? YGUndefined : op.unwrap();
|
||||
}
|
||||
|
||||
// TODO(T26792433): Change the API to accept FloatOptional.
|
||||
YOGA_EXPORT void YGNodeStyleSetAspectRatio(
|
||||
const YGNodeRef node,
|
||||
const float aspectRatio) {
|
||||
void YGNodeStyleSetAspectRatio(const YGNodeRef node, const float aspectRatio) {
|
||||
updateStyle<MSVC_HINT(aspectRatio)>(
|
||||
node, &Style::aspectRatio, FloatOptional{aspectRatio});
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetWidth(YGNodeRef node, float points) {
|
||||
void YGNodeStyleSetWidth(YGNodeRef node, float points) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPoint>(points);
|
||||
updateIndexedStyleProp<MSVC_HINT(dimensions)>(
|
||||
node, &Style::dimensions, YGDimensionWidth, value);
|
||||
}
|
||||
YOGA_EXPORT void YGNodeStyleSetWidthPercent(YGNodeRef node, float percent) {
|
||||
void YGNodeStyleSetWidthPercent(YGNodeRef node, float percent) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPercent>(percent);
|
||||
updateIndexedStyleProp<MSVC_HINT(dimensions)>(
|
||||
node, &Style::dimensions, YGDimensionWidth, value);
|
||||
}
|
||||
YOGA_EXPORT void YGNodeStyleSetWidthAuto(YGNodeRef node) {
|
||||
void YGNodeStyleSetWidthAuto(YGNodeRef node) {
|
||||
updateIndexedStyleProp<MSVC_HINT(dimensions)>(
|
||||
node, &Style::dimensions, YGDimensionWidth, CompactValue::ofAuto());
|
||||
}
|
||||
YOGA_EXPORT YGValue YGNodeStyleGetWidth(YGNodeConstRef node) {
|
||||
YGValue YGNodeStyleGetWidth(YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().dimensions()[YGDimensionWidth];
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetHeight(YGNodeRef node, float points) {
|
||||
void YGNodeStyleSetHeight(YGNodeRef node, float points) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPoint>(points);
|
||||
updateIndexedStyleProp<MSVC_HINT(dimensions)>(
|
||||
node, &Style::dimensions, YGDimensionHeight, value);
|
||||
}
|
||||
YOGA_EXPORT void YGNodeStyleSetHeightPercent(YGNodeRef node, float percent) {
|
||||
void YGNodeStyleSetHeightPercent(YGNodeRef node, float percent) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPercent>(percent);
|
||||
updateIndexedStyleProp<MSVC_HINT(dimensions)>(
|
||||
node, &Style::dimensions, YGDimensionHeight, value);
|
||||
}
|
||||
YOGA_EXPORT void YGNodeStyleSetHeightAuto(YGNodeRef node) {
|
||||
void YGNodeStyleSetHeightAuto(YGNodeRef node) {
|
||||
updateIndexedStyleProp<MSVC_HINT(dimensions)>(
|
||||
node, &Style::dimensions, YGDimensionHeight, CompactValue::ofAuto());
|
||||
}
|
||||
YOGA_EXPORT YGValue YGNodeStyleGetHeight(YGNodeConstRef node) {
|
||||
YGValue YGNodeStyleGetHeight(YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().dimensions()[YGDimensionHeight];
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetMinWidth(
|
||||
const YGNodeRef node,
|
||||
const float minWidth) {
|
||||
void YGNodeStyleSetMinWidth(const YGNodeRef node, const float minWidth) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPoint>(minWidth);
|
||||
updateIndexedStyleProp<MSVC_HINT(minDimensions)>(
|
||||
node, &Style::minDimensions, YGDimensionWidth, value);
|
||||
}
|
||||
YOGA_EXPORT void YGNodeStyleSetMinWidthPercent(
|
||||
const YGNodeRef node,
|
||||
const float minWidth) {
|
||||
void YGNodeStyleSetMinWidthPercent(const YGNodeRef node, const float minWidth) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPercent>(minWidth);
|
||||
updateIndexedStyleProp<MSVC_HINT(minDimensions)>(
|
||||
node, &Style::minDimensions, YGDimensionWidth, value);
|
||||
}
|
||||
YOGA_EXPORT YGValue YGNodeStyleGetMinWidth(const YGNodeConstRef node) {
|
||||
YGValue YGNodeStyleGetMinWidth(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().minDimensions()[YGDimensionWidth];
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetMinHeight(
|
||||
const YGNodeRef node,
|
||||
const float minHeight) {
|
||||
void YGNodeStyleSetMinHeight(const YGNodeRef node, const float minHeight) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPoint>(minHeight);
|
||||
updateIndexedStyleProp<MSVC_HINT(minDimensions)>(
|
||||
node, &Style::minDimensions, YGDimensionHeight, value);
|
||||
}
|
||||
YOGA_EXPORT void YGNodeStyleSetMinHeightPercent(
|
||||
void YGNodeStyleSetMinHeightPercent(
|
||||
const YGNodeRef node,
|
||||
const float minHeight) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPercent>(minHeight);
|
||||
updateIndexedStyleProp<MSVC_HINT(minDimensions)>(
|
||||
node, &Style::minDimensions, YGDimensionHeight, value);
|
||||
}
|
||||
YOGA_EXPORT YGValue YGNodeStyleGetMinHeight(const YGNodeConstRef node) {
|
||||
YGValue YGNodeStyleGetMinHeight(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().minDimensions()[YGDimensionHeight];
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetMaxWidth(
|
||||
const YGNodeRef node,
|
||||
const float maxWidth) {
|
||||
void YGNodeStyleSetMaxWidth(const YGNodeRef node, const float maxWidth) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPoint>(maxWidth);
|
||||
updateIndexedStyleProp<MSVC_HINT(maxDimensions)>(
|
||||
node, &Style::maxDimensions, YGDimensionWidth, value);
|
||||
}
|
||||
YOGA_EXPORT void YGNodeStyleSetMaxWidthPercent(
|
||||
const YGNodeRef node,
|
||||
const float maxWidth) {
|
||||
void YGNodeStyleSetMaxWidthPercent(const YGNodeRef node, const float maxWidth) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPercent>(maxWidth);
|
||||
updateIndexedStyleProp<MSVC_HINT(maxDimensions)>(
|
||||
node, &Style::maxDimensions, YGDimensionWidth, value);
|
||||
}
|
||||
YOGA_EXPORT YGValue YGNodeStyleGetMaxWidth(const YGNodeConstRef node) {
|
||||
YGValue YGNodeStyleGetMaxWidth(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().maxDimensions()[YGDimensionWidth];
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeStyleSetMaxHeight(
|
||||
const YGNodeRef node,
|
||||
const float maxHeight) {
|
||||
void YGNodeStyleSetMaxHeight(const YGNodeRef node, const float maxHeight) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPoint>(maxHeight);
|
||||
updateIndexedStyleProp<MSVC_HINT(maxDimensions)>(
|
||||
node, &Style::maxDimensions, YGDimensionHeight, value);
|
||||
}
|
||||
YOGA_EXPORT void YGNodeStyleSetMaxHeightPercent(
|
||||
void YGNodeStyleSetMaxHeightPercent(
|
||||
const YGNodeRef node,
|
||||
const float maxHeight) {
|
||||
auto value = CompactValue::ofMaybe<YGUnitPercent>(maxHeight);
|
||||
updateIndexedStyleProp<MSVC_HINT(maxDimensions)>(
|
||||
node, &Style::maxDimensions, YGDimensionHeight, value);
|
||||
}
|
||||
YOGA_EXPORT YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) {
|
||||
YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) {
|
||||
return resolveRef(node)->getStyle().maxDimensions()[YGDimensionHeight];
|
||||
}
|
||||
|
||||
#define YG_NODE_LAYOUT_PROPERTY_IMPL(type, name, instanceName) \
|
||||
YOGA_EXPORT type YGNodeLayoutGet##name(const YGNodeConstRef node) { \
|
||||
return resolveRef(node)->getLayout().instanceName; \
|
||||
#define YG_NODE_LAYOUT_PROPERTY_IMPL(type, name, instanceName) \
|
||||
type YGNodeLayoutGet##name(const YGNodeConstRef node) { \
|
||||
return resolveRef(node)->getLayout().instanceName; \
|
||||
}
|
||||
|
||||
#define YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(type, name, instanceName) \
|
||||
YOGA_EXPORT type YGNodeLayoutGet##name( \
|
||||
type YGNodeLayoutGet##name( \
|
||||
const YGNodeConstRef nodeRef, const YGEdge edge) { \
|
||||
const auto node = resolveRef(nodeRef); \
|
||||
yoga::assertFatalWithNode( \
|
||||
@@ -868,9 +801,7 @@ YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Border, border)
|
||||
YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Padding, padding)
|
||||
|
||||
#ifdef DEBUG
|
||||
YOGA_EXPORT void YGNodePrint(
|
||||
const YGNodeConstRef nodeRef,
|
||||
const YGPrintOptions options) {
|
||||
void YGNodePrint(const YGNodeConstRef nodeRef, const YGPrintOptions options) {
|
||||
const auto node = resolveRef(nodeRef);
|
||||
std::string str;
|
||||
yoga::nodeToString(str, node, options, 0);
|
||||
@@ -878,7 +809,7 @@ YOGA_EXPORT void YGNodePrint(
|
||||
}
|
||||
#endif
|
||||
|
||||
YOGA_EXPORT void YGConfigSetLogger(const YGConfigRef config, YGLogger logger) {
|
||||
void YGConfigSetLogger(const YGConfigRef config, YGLogger logger) {
|
||||
if (logger != nullptr) {
|
||||
resolveRef(config)->setLogger(logger);
|
||||
} else {
|
||||
@@ -886,7 +817,7 @@ YOGA_EXPORT void YGConfigSetLogger(const YGConfigRef config, YGLogger logger) {
|
||||
}
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGConfigSetPointScaleFactor(
|
||||
void YGConfigSetPointScaleFactor(
|
||||
const YGConfigRef config,
|
||||
const float pixelsInPoint) {
|
||||
yoga::assertFatalWithConfig(
|
||||
@@ -903,11 +834,11 @@ YOGA_EXPORT void YGConfigSetPointScaleFactor(
|
||||
}
|
||||
}
|
||||
|
||||
YOGA_EXPORT float YGConfigGetPointScaleFactor(const YGConfigConstRef config) {
|
||||
float YGConfigGetPointScaleFactor(const YGConfigConstRef config) {
|
||||
return resolveRef(config)->getPointScaleFactor();
|
||||
}
|
||||
|
||||
YOGA_EXPORT float YGRoundValueToPixelGrid(
|
||||
float YGRoundValueToPixelGrid(
|
||||
const double value,
|
||||
const double pointScaleFactor,
|
||||
const bool forceCeil,
|
||||
@@ -916,22 +847,20 @@ YOGA_EXPORT float YGRoundValueToPixelGrid(
|
||||
value, pointScaleFactor, forceCeil, forceFloor);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGConfigSetExperimentalFeatureEnabled(
|
||||
void YGConfigSetExperimentalFeatureEnabled(
|
||||
const YGConfigRef config,
|
||||
const YGExperimentalFeature feature,
|
||||
const bool enabled) {
|
||||
resolveRef(config)->setExperimentalFeatureEnabled(feature, enabled);
|
||||
}
|
||||
|
||||
YOGA_EXPORT bool YGConfigIsExperimentalFeatureEnabled(
|
||||
bool YGConfigIsExperimentalFeatureEnabled(
|
||||
const YGConfigConstRef config,
|
||||
const YGExperimentalFeature feature) {
|
||||
return resolveRef(config)->isExperimentalFeatureEnabled(feature);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGConfigSetUseWebDefaults(
|
||||
const YGConfigRef config,
|
||||
const bool enabled) {
|
||||
void YGConfigSetUseWebDefaults(const YGConfigRef config, const bool enabled) {
|
||||
resolveRef(config)->setUseWebDefaults(enabled);
|
||||
}
|
||||
|
||||
@@ -939,23 +868,23 @@ bool YGConfigGetUseWebDefaults(const YGConfigConstRef config) {
|
||||
return resolveRef(config)->useWebDefaults();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGConfigSetContext(const YGConfigRef config, void* context) {
|
||||
void YGConfigSetContext(const YGConfigRef config, void* context) {
|
||||
resolveRef(config)->setContext(context);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void* YGConfigGetContext(const YGConfigConstRef config) {
|
||||
void* YGConfigGetContext(const YGConfigConstRef config) {
|
||||
return resolveRef(config)->getContext();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGConfigSetErrata(YGConfigRef config, YGErrata errata) {
|
||||
void YGConfigSetErrata(YGConfigRef config, YGErrata errata) {
|
||||
resolveRef(config)->setErrata(errata);
|
||||
}
|
||||
|
||||
YOGA_EXPORT YGErrata YGConfigGetErrata(YGConfigConstRef config) {
|
||||
YGErrata YGConfigGetErrata(YGConfigConstRef config) {
|
||||
return resolveRef(config)->getErrata();
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGConfigSetCloneNodeFunc(
|
||||
void YGConfigSetCloneNodeFunc(
|
||||
const YGConfigRef config,
|
||||
const YGCloneNodeFunc callback) {
|
||||
resolveRef(config)->setCloneNodeCallback(callback);
|
||||
@@ -963,7 +892,7 @@ YOGA_EXPORT void YGConfigSetCloneNodeFunc(
|
||||
|
||||
// TODO: This should not be part of the public API. Remove after removing
|
||||
// ComponentKit usage of it.
|
||||
YOGA_EXPORT bool YGNodeCanUseCachedMeasurement(
|
||||
bool YGNodeCanUseCachedMeasurement(
|
||||
YGMeasureMode widthMode,
|
||||
float availableWidth,
|
||||
YGMeasureMode heightMode,
|
||||
@@ -993,7 +922,7 @@ YOGA_EXPORT bool YGNodeCanUseCachedMeasurement(
|
||||
resolveRef(config));
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeCalculateLayout(
|
||||
void YGNodeCalculateLayout(
|
||||
const YGNodeRef node,
|
||||
const float ownerWidth,
|
||||
const float ownerHeight,
|
||||
@@ -1002,7 +931,7 @@ YOGA_EXPORT void YGNodeCalculateLayout(
|
||||
node, ownerWidth, ownerHeight, ownerDirection, nullptr);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void YGNodeCalculateLayoutWithContext(
|
||||
void YGNodeCalculateLayoutWithContext(
|
||||
const YGNodeRef node,
|
||||
const float ownerWidth,
|
||||
const float ownerHeight,
|
||||
|
277
yoga/Yoga.h
277
yoga/Yoga.h
@@ -51,41 +51,38 @@ typedef YGNodeRef (*YGCloneNodeFunc)(
|
||||
size_t childIndex);
|
||||
|
||||
// YGNode
|
||||
WIN_EXPORT YGNodeRef YGNodeNew(void);
|
||||
WIN_EXPORT YGNodeRef YGNodeNewWithConfig(YGConfigConstRef config);
|
||||
WIN_EXPORT YGNodeRef YGNodeClone(YGNodeConstRef node);
|
||||
WIN_EXPORT void YGNodeFree(YGNodeRef node);
|
||||
WIN_EXPORT void YGNodeFreeRecursiveWithCleanupFunc(
|
||||
YG_EXPORT YGNodeRef YGNodeNew(void);
|
||||
YG_EXPORT YGNodeRef YGNodeNewWithConfig(YGConfigConstRef config);
|
||||
YG_EXPORT YGNodeRef YGNodeClone(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeFree(YGNodeRef node);
|
||||
YG_EXPORT void YGNodeFreeRecursiveWithCleanupFunc(
|
||||
YGNodeRef node,
|
||||
YGNodeCleanupFunc cleanup);
|
||||
WIN_EXPORT void YGNodeFreeRecursive(YGNodeRef node);
|
||||
WIN_EXPORT void YGNodeReset(YGNodeRef node);
|
||||
YG_EXPORT void YGNodeFreeRecursive(YGNodeRef node);
|
||||
YG_EXPORT void YGNodeReset(YGNodeRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeInsertChild(
|
||||
YGNodeRef node,
|
||||
YGNodeRef child,
|
||||
size_t index);
|
||||
YG_EXPORT void YGNodeInsertChild(YGNodeRef node, YGNodeRef child, size_t index);
|
||||
|
||||
WIN_EXPORT void YGNodeSwapChild(YGNodeRef node, YGNodeRef child, size_t index);
|
||||
YG_EXPORT void YGNodeSwapChild(YGNodeRef node, YGNodeRef child, size_t index);
|
||||
|
||||
WIN_EXPORT void YGNodeRemoveChild(YGNodeRef node, YGNodeRef child);
|
||||
WIN_EXPORT void YGNodeRemoveAllChildren(YGNodeRef node);
|
||||
WIN_EXPORT YGNodeRef YGNodeGetChild(YGNodeRef node, size_t index);
|
||||
WIN_EXPORT YGNodeRef YGNodeGetOwner(YGNodeRef node);
|
||||
WIN_EXPORT YGNodeRef YGNodeGetParent(YGNodeRef node);
|
||||
WIN_EXPORT size_t YGNodeGetChildCount(YGNodeConstRef node);
|
||||
WIN_EXPORT void YGNodeSetChildren(
|
||||
YG_EXPORT void YGNodeRemoveChild(YGNodeRef node, YGNodeRef child);
|
||||
YG_EXPORT void YGNodeRemoveAllChildren(YGNodeRef node);
|
||||
YG_EXPORT YGNodeRef YGNodeGetChild(YGNodeRef node, size_t index);
|
||||
YG_EXPORT YGNodeRef YGNodeGetOwner(YGNodeRef node);
|
||||
YG_EXPORT YGNodeRef YGNodeGetParent(YGNodeRef node);
|
||||
YG_EXPORT size_t YGNodeGetChildCount(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeSetChildren(
|
||||
YGNodeRef owner,
|
||||
const YGNodeRef* children,
|
||||
size_t count);
|
||||
|
||||
WIN_EXPORT void YGNodeSetIsReferenceBaseline(
|
||||
YG_EXPORT void YGNodeSetIsReferenceBaseline(
|
||||
YGNodeRef node,
|
||||
bool isReferenceBaseline);
|
||||
|
||||
WIN_EXPORT bool YGNodeIsReferenceBaseline(YGNodeConstRef node);
|
||||
YG_EXPORT bool YGNodeIsReferenceBaseline(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeCalculateLayout(
|
||||
YG_EXPORT void YGNodeCalculateLayout(
|
||||
YGNodeRef node,
|
||||
float availableWidth,
|
||||
float availableHeight,
|
||||
@@ -97,21 +94,21 @@ WIN_EXPORT void YGNodeCalculateLayout(
|
||||
// Yoga knows when to mark all other nodes as dirty but because nodes with
|
||||
// measure functions depend on information not known to Yoga they must perform
|
||||
// this dirty marking manually.
|
||||
WIN_EXPORT void YGNodeMarkDirty(YGNodeRef node);
|
||||
YG_EXPORT void YGNodeMarkDirty(YGNodeRef node);
|
||||
|
||||
// Marks the current node and all its descendants as dirty.
|
||||
//
|
||||
// Intended to be used for Yoga benchmarks. Don't use in production, as calling
|
||||
// `YGCalculateLayout` will cause the recalculation of each and every node.
|
||||
WIN_EXPORT void YGNodeMarkDirtyAndPropagateToDescendants(YGNodeRef node);
|
||||
YG_EXPORT void YGNodeMarkDirtyAndPropagateToDescendants(YGNodeRef node);
|
||||
|
||||
WIN_EXPORT void YGNodePrint(YGNodeConstRef node, YGPrintOptions options);
|
||||
YG_EXPORT void YGNodePrint(YGNodeConstRef node, YGPrintOptions options);
|
||||
|
||||
WIN_EXPORT bool YGFloatIsUndefined(float value);
|
||||
YG_EXPORT bool YGFloatIsUndefined(float value);
|
||||
|
||||
// TODO: This should not be part of the public API. Remove after removing
|
||||
// ComponentKit usage of it.
|
||||
WIN_EXPORT bool YGNodeCanUseCachedMeasurement(
|
||||
YG_EXPORT bool YGNodeCanUseCachedMeasurement(
|
||||
YGMeasureMode widthMode,
|
||||
float availableWidth,
|
||||
YGMeasureMode heightMode,
|
||||
@@ -126,142 +123,142 @@ WIN_EXPORT bool YGNodeCanUseCachedMeasurement(
|
||||
float marginColumn,
|
||||
YGConfigRef config);
|
||||
|
||||
WIN_EXPORT void YGNodeCopyStyle(YGNodeRef dstNode, YGNodeConstRef srcNode);
|
||||
YG_EXPORT void YGNodeCopyStyle(YGNodeRef dstNode, YGNodeConstRef srcNode);
|
||||
|
||||
WIN_EXPORT void* YGNodeGetContext(YGNodeConstRef node);
|
||||
WIN_EXPORT void YGNodeSetContext(YGNodeRef node, void* context);
|
||||
YG_EXPORT void* YGNodeGetContext(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeSetContext(YGNodeRef node, void* context);
|
||||
|
||||
WIN_EXPORT YGConfigConstRef YGNodeGetConfig(YGNodeRef node);
|
||||
WIN_EXPORT void YGNodeSetConfig(YGNodeRef node, YGConfigRef config);
|
||||
YG_EXPORT YGConfigConstRef YGNodeGetConfig(YGNodeRef node);
|
||||
YG_EXPORT void YGNodeSetConfig(YGNodeRef node, YGConfigRef config);
|
||||
|
||||
void YGConfigSetPrintTreeFlag(YGConfigRef config, bool enabled);
|
||||
bool YGNodeHasMeasureFunc(YGNodeConstRef node);
|
||||
WIN_EXPORT void YGNodeSetMeasureFunc(YGNodeRef node, YGMeasureFunc measureFunc);
|
||||
bool YGNodeHasBaselineFunc(YGNodeConstRef node);
|
||||
void YGNodeSetBaselineFunc(YGNodeRef node, YGBaselineFunc baselineFunc);
|
||||
YGDirtiedFunc YGNodeGetDirtiedFunc(YGNodeConstRef node);
|
||||
void YGNodeSetDirtiedFunc(YGNodeRef node, YGDirtiedFunc dirtiedFunc);
|
||||
void YGNodeSetPrintFunc(YGNodeRef node, YGPrintFunc printFunc);
|
||||
WIN_EXPORT bool YGNodeGetHasNewLayout(YGNodeConstRef node);
|
||||
WIN_EXPORT void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout);
|
||||
YGNodeType YGNodeGetNodeType(YGNodeConstRef node);
|
||||
void YGNodeSetNodeType(YGNodeRef node, YGNodeType nodeType);
|
||||
WIN_EXPORT bool YGNodeIsDirty(YGNodeConstRef node);
|
||||
YG_EXPORT void YGConfigSetPrintTreeFlag(YGConfigRef config, bool enabled);
|
||||
YG_EXPORT bool YGNodeHasMeasureFunc(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeSetMeasureFunc(YGNodeRef node, YGMeasureFunc measureFunc);
|
||||
YG_EXPORT bool YGNodeHasBaselineFunc(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeSetBaselineFunc(
|
||||
YGNodeRef node,
|
||||
YGBaselineFunc baselineFunc);
|
||||
YG_EXPORT YGDirtiedFunc YGNodeGetDirtiedFunc(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeSetDirtiedFunc(YGNodeRef node, YGDirtiedFunc dirtiedFunc);
|
||||
YG_EXPORT void YGNodeSetPrintFunc(YGNodeRef node, YGPrintFunc printFunc);
|
||||
YG_EXPORT bool YGNodeGetHasNewLayout(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout);
|
||||
YG_EXPORT YGNodeType YGNodeGetNodeType(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeSetNodeType(YGNodeRef node, YGNodeType nodeType);
|
||||
YG_EXPORT bool YGNodeIsDirty(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetDirection(YGNodeRef node, YGDirection direction);
|
||||
WIN_EXPORT YGDirection YGNodeStyleGetDirection(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetDirection(YGNodeRef node, YGDirection direction);
|
||||
YG_EXPORT YGDirection YGNodeStyleGetDirection(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetFlexDirection(
|
||||
YG_EXPORT void YGNodeStyleSetFlexDirection(
|
||||
YGNodeRef node,
|
||||
YGFlexDirection flexDirection);
|
||||
WIN_EXPORT YGFlexDirection YGNodeStyleGetFlexDirection(YGNodeConstRef node);
|
||||
YG_EXPORT YGFlexDirection YGNodeStyleGetFlexDirection(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetJustifyContent(
|
||||
YG_EXPORT void YGNodeStyleSetJustifyContent(
|
||||
YGNodeRef node,
|
||||
YGJustify justifyContent);
|
||||
WIN_EXPORT YGJustify YGNodeStyleGetJustifyContent(YGNodeConstRef node);
|
||||
YG_EXPORT YGJustify YGNodeStyleGetJustifyContent(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetAlignContent(
|
||||
YGNodeRef node,
|
||||
YGAlign alignContent);
|
||||
WIN_EXPORT YGAlign YGNodeStyleGetAlignContent(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetAlignContent(YGNodeRef node, YGAlign alignContent);
|
||||
YG_EXPORT YGAlign YGNodeStyleGetAlignContent(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetAlignItems(YGNodeRef node, YGAlign alignItems);
|
||||
WIN_EXPORT YGAlign YGNodeStyleGetAlignItems(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetAlignItems(YGNodeRef node, YGAlign alignItems);
|
||||
YG_EXPORT YGAlign YGNodeStyleGetAlignItems(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetAlignSelf(YGNodeRef node, YGAlign alignSelf);
|
||||
WIN_EXPORT YGAlign YGNodeStyleGetAlignSelf(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetAlignSelf(YGNodeRef node, YGAlign alignSelf);
|
||||
YG_EXPORT YGAlign YGNodeStyleGetAlignSelf(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetPositionType(
|
||||
YG_EXPORT void YGNodeStyleSetPositionType(
|
||||
YGNodeRef node,
|
||||
YGPositionType positionType);
|
||||
WIN_EXPORT YGPositionType YGNodeStyleGetPositionType(YGNodeConstRef node);
|
||||
YG_EXPORT YGPositionType YGNodeStyleGetPositionType(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetFlexWrap(YGNodeRef node, YGWrap flexWrap);
|
||||
WIN_EXPORT YGWrap YGNodeStyleGetFlexWrap(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetFlexWrap(YGNodeRef node, YGWrap flexWrap);
|
||||
YG_EXPORT YGWrap YGNodeStyleGetFlexWrap(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetOverflow(YGNodeRef node, YGOverflow overflow);
|
||||
WIN_EXPORT YGOverflow YGNodeStyleGetOverflow(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetOverflow(YGNodeRef node, YGOverflow overflow);
|
||||
YG_EXPORT YGOverflow YGNodeStyleGetOverflow(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetDisplay(YGNodeRef node, YGDisplay display);
|
||||
WIN_EXPORT YGDisplay YGNodeStyleGetDisplay(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetDisplay(YGNodeRef node, YGDisplay display);
|
||||
YG_EXPORT YGDisplay YGNodeStyleGetDisplay(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetFlex(YGNodeRef node, float flex);
|
||||
WIN_EXPORT float YGNodeStyleGetFlex(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetFlex(YGNodeRef node, float flex);
|
||||
YG_EXPORT float YGNodeStyleGetFlex(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetFlexGrow(YGNodeRef node, float flexGrow);
|
||||
WIN_EXPORT float YGNodeStyleGetFlexGrow(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetFlexGrow(YGNodeRef node, float flexGrow);
|
||||
YG_EXPORT float YGNodeStyleGetFlexGrow(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetFlexShrink(YGNodeRef node, float flexShrink);
|
||||
WIN_EXPORT float YGNodeStyleGetFlexShrink(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetFlexShrink(YGNodeRef node, float flexShrink);
|
||||
YG_EXPORT float YGNodeStyleGetFlexShrink(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetFlexBasis(YGNodeRef node, float flexBasis);
|
||||
WIN_EXPORT void YGNodeStyleSetFlexBasisPercent(YGNodeRef node, float flexBasis);
|
||||
WIN_EXPORT void YGNodeStyleSetFlexBasisAuto(YGNodeRef node);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetFlexBasis(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetFlexBasis(YGNodeRef node, float flexBasis);
|
||||
YG_EXPORT void YGNodeStyleSetFlexBasisPercent(YGNodeRef node, float flexBasis);
|
||||
YG_EXPORT void YGNodeStyleSetFlexBasisAuto(YGNodeRef node);
|
||||
YG_EXPORT YGValue YGNodeStyleGetFlexBasis(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetPosition(
|
||||
YG_EXPORT void YGNodeStyleSetPosition(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float position);
|
||||
WIN_EXPORT void YGNodeStyleSetPositionPercent(
|
||||
YG_EXPORT void YGNodeStyleSetPositionPercent(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float position);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetPosition(YGNodeConstRef node, YGEdge edge);
|
||||
YG_EXPORT YGValue YGNodeStyleGetPosition(YGNodeConstRef node, YGEdge edge);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetMargin(YGNodeRef node, YGEdge edge, float margin);
|
||||
WIN_EXPORT void YGNodeStyleSetMarginPercent(
|
||||
YG_EXPORT void YGNodeStyleSetMargin(YGNodeRef node, YGEdge edge, float margin);
|
||||
YG_EXPORT void YGNodeStyleSetMarginPercent(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float margin);
|
||||
WIN_EXPORT void YGNodeStyleSetMarginAuto(YGNodeRef node, YGEdge edge);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetMargin(YGNodeConstRef node, YGEdge edge);
|
||||
YG_EXPORT void YGNodeStyleSetMarginAuto(YGNodeRef node, YGEdge edge);
|
||||
YG_EXPORT YGValue YGNodeStyleGetMargin(YGNodeConstRef node, YGEdge edge);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetPadding(
|
||||
YG_EXPORT void YGNodeStyleSetPadding(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float padding);
|
||||
WIN_EXPORT void YGNodeStyleSetPaddingPercent(
|
||||
YG_EXPORT void YGNodeStyleSetPaddingPercent(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float padding);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetPadding(YGNodeConstRef node, YGEdge edge);
|
||||
YG_EXPORT YGValue YGNodeStyleGetPadding(YGNodeConstRef node, YGEdge edge);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetBorder(YGNodeRef node, YGEdge edge, float border);
|
||||
WIN_EXPORT float YGNodeStyleGetBorder(YGNodeConstRef node, YGEdge edge);
|
||||
YG_EXPORT void YGNodeStyleSetBorder(YGNodeRef node, YGEdge edge, float border);
|
||||
YG_EXPORT float YGNodeStyleGetBorder(YGNodeConstRef node, YGEdge edge);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetGap(
|
||||
YG_EXPORT void YGNodeStyleSetGap(
|
||||
YGNodeRef node,
|
||||
YGGutter gutter,
|
||||
float gapLength);
|
||||
WIN_EXPORT float YGNodeStyleGetGap(YGNodeConstRef node, YGGutter gutter);
|
||||
YG_EXPORT float YGNodeStyleGetGap(YGNodeConstRef node, YGGutter gutter);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetWidth(YGNodeRef node, float width);
|
||||
WIN_EXPORT void YGNodeStyleSetWidthPercent(YGNodeRef node, float width);
|
||||
WIN_EXPORT void YGNodeStyleSetWidthAuto(YGNodeRef node);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetWidth(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetWidth(YGNodeRef node, float width);
|
||||
YG_EXPORT void YGNodeStyleSetWidthPercent(YGNodeRef node, float width);
|
||||
YG_EXPORT void YGNodeStyleSetWidthAuto(YGNodeRef node);
|
||||
YG_EXPORT YGValue YGNodeStyleGetWidth(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetHeight(YGNodeRef node, float height);
|
||||
WIN_EXPORT void YGNodeStyleSetHeightPercent(YGNodeRef node, float height);
|
||||
WIN_EXPORT void YGNodeStyleSetHeightAuto(YGNodeRef node);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetHeight(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetHeight(YGNodeRef node, float height);
|
||||
YG_EXPORT void YGNodeStyleSetHeightPercent(YGNodeRef node, float height);
|
||||
YG_EXPORT void YGNodeStyleSetHeightAuto(YGNodeRef node);
|
||||
YG_EXPORT YGValue YGNodeStyleGetHeight(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetMinWidth(YGNodeRef node, float minWidth);
|
||||
WIN_EXPORT void YGNodeStyleSetMinWidthPercent(YGNodeRef node, float minWidth);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetMinWidth(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetMinWidth(YGNodeRef node, float minWidth);
|
||||
YG_EXPORT void YGNodeStyleSetMinWidthPercent(YGNodeRef node, float minWidth);
|
||||
YG_EXPORT YGValue YGNodeStyleGetMinWidth(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetMinHeight(YGNodeRef node, float minHeight);
|
||||
WIN_EXPORT void YGNodeStyleSetMinHeightPercent(YGNodeRef node, float minHeight);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetMinHeight(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetMinHeight(YGNodeRef node, float minHeight);
|
||||
YG_EXPORT void YGNodeStyleSetMinHeightPercent(YGNodeRef node, float minHeight);
|
||||
YG_EXPORT YGValue YGNodeStyleGetMinHeight(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetMaxWidth(YGNodeRef node, float maxWidth);
|
||||
WIN_EXPORT void YGNodeStyleSetMaxWidthPercent(YGNodeRef node, float maxWidth);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetMaxWidth(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetMaxWidth(YGNodeRef node, float maxWidth);
|
||||
YG_EXPORT void YGNodeStyleSetMaxWidthPercent(YGNodeRef node, float maxWidth);
|
||||
YG_EXPORT YGValue YGNodeStyleGetMaxWidth(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetMaxHeight(YGNodeRef node, float maxHeight);
|
||||
WIN_EXPORT void YGNodeStyleSetMaxHeightPercent(YGNodeRef node, float maxHeight);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetMaxHeight(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetMaxHeight(YGNodeRef node, float maxHeight);
|
||||
YG_EXPORT void YGNodeStyleSetMaxHeightPercent(YGNodeRef node, float maxHeight);
|
||||
YG_EXPORT YGValue YGNodeStyleGetMaxHeight(YGNodeConstRef node);
|
||||
|
||||
// Yoga specific properties, not compatible with flexbox specification Aspect
|
||||
// ratio control the size of the undefined dimension of a node. Aspect ratio is
|
||||
@@ -278,64 +275,64 @@ WIN_EXPORT YGValue YGNodeStyleGetMaxHeight(YGNodeConstRef node);
|
||||
// - 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
|
||||
WIN_EXPORT void YGNodeStyleSetAspectRatio(YGNodeRef node, float aspectRatio);
|
||||
WIN_EXPORT float YGNodeStyleGetAspectRatio(YGNodeConstRef node);
|
||||
YG_EXPORT void YGNodeStyleSetAspectRatio(YGNodeRef node, float aspectRatio);
|
||||
YG_EXPORT float YGNodeStyleGetAspectRatio(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT float YGNodeLayoutGetLeft(YGNodeConstRef node);
|
||||
WIN_EXPORT float YGNodeLayoutGetTop(YGNodeConstRef node);
|
||||
WIN_EXPORT float YGNodeLayoutGetRight(YGNodeConstRef node);
|
||||
WIN_EXPORT float YGNodeLayoutGetBottom(YGNodeConstRef node);
|
||||
WIN_EXPORT float YGNodeLayoutGetWidth(YGNodeConstRef node);
|
||||
WIN_EXPORT float YGNodeLayoutGetHeight(YGNodeConstRef node);
|
||||
WIN_EXPORT YGDirection YGNodeLayoutGetDirection(YGNodeConstRef node);
|
||||
WIN_EXPORT bool YGNodeLayoutGetHadOverflow(YGNodeConstRef node);
|
||||
YG_EXPORT float YGNodeLayoutGetLeft(YGNodeConstRef node);
|
||||
YG_EXPORT float YGNodeLayoutGetTop(YGNodeConstRef node);
|
||||
YG_EXPORT float YGNodeLayoutGetRight(YGNodeConstRef node);
|
||||
YG_EXPORT float YGNodeLayoutGetBottom(YGNodeConstRef node);
|
||||
YG_EXPORT float YGNodeLayoutGetWidth(YGNodeConstRef node);
|
||||
YG_EXPORT float YGNodeLayoutGetHeight(YGNodeConstRef node);
|
||||
YG_EXPORT YGDirection YGNodeLayoutGetDirection(YGNodeConstRef node);
|
||||
YG_EXPORT bool YGNodeLayoutGetHadOverflow(YGNodeConstRef node);
|
||||
|
||||
// Get the computed values for these nodes after performing layout. If they were
|
||||
// set using point values then the returned value will be the same as
|
||||
// YGNodeStyleGetXXX. However if they were set using a percentage value then the
|
||||
// returned value is the computed value used during layout.
|
||||
WIN_EXPORT float YGNodeLayoutGetMargin(YGNodeConstRef node, YGEdge edge);
|
||||
WIN_EXPORT float YGNodeLayoutGetBorder(YGNodeConstRef node, YGEdge edge);
|
||||
WIN_EXPORT float YGNodeLayoutGetPadding(YGNodeConstRef node, YGEdge edge);
|
||||
YG_EXPORT float YGNodeLayoutGetMargin(YGNodeConstRef node, YGEdge edge);
|
||||
YG_EXPORT float YGNodeLayoutGetBorder(YGNodeConstRef node, YGEdge edge);
|
||||
YG_EXPORT float YGNodeLayoutGetPadding(YGNodeConstRef node, YGEdge edge);
|
||||
|
||||
WIN_EXPORT void YGConfigSetLogger(YGConfigRef config, YGLogger logger);
|
||||
YG_EXPORT void YGConfigSetLogger(YGConfigRef config, YGLogger logger);
|
||||
// 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 YGConfigSetPointScaleFactor(
|
||||
YG_EXPORT void YGConfigSetPointScaleFactor(
|
||||
YGConfigRef config,
|
||||
float pixelsInPoint);
|
||||
WIN_EXPORT float YGConfigGetPointScaleFactor(YGConfigConstRef config);
|
||||
YG_EXPORT float YGConfigGetPointScaleFactor(YGConfigConstRef config);
|
||||
|
||||
// YGConfig
|
||||
WIN_EXPORT YGConfigRef YGConfigNew(void);
|
||||
WIN_EXPORT void YGConfigFree(YGConfigRef config);
|
||||
YG_EXPORT YGConfigRef YGConfigNew(void);
|
||||
YG_EXPORT void YGConfigFree(YGConfigRef config);
|
||||
|
||||
WIN_EXPORT void YGConfigSetExperimentalFeatureEnabled(
|
||||
YG_EXPORT void YGConfigSetExperimentalFeatureEnabled(
|
||||
YGConfigRef config,
|
||||
YGExperimentalFeature feature,
|
||||
bool enabled);
|
||||
WIN_EXPORT bool YGConfigIsExperimentalFeatureEnabled(
|
||||
YG_EXPORT bool YGConfigIsExperimentalFeatureEnabled(
|
||||
YGConfigConstRef config,
|
||||
YGExperimentalFeature feature);
|
||||
|
||||
// Using the web defaults is the preferred configuration for new projects. Usage
|
||||
// of non web defaults should be considered as legacy.
|
||||
WIN_EXPORT void YGConfigSetUseWebDefaults(YGConfigRef config, bool enabled);
|
||||
WIN_EXPORT bool YGConfigGetUseWebDefaults(YGConfigConstRef config);
|
||||
YG_EXPORT void YGConfigSetUseWebDefaults(YGConfigRef config, bool enabled);
|
||||
YG_EXPORT bool YGConfigGetUseWebDefaults(YGConfigConstRef config);
|
||||
|
||||
WIN_EXPORT void YGConfigSetCloneNodeFunc(
|
||||
YG_EXPORT void YGConfigSetCloneNodeFunc(
|
||||
YGConfigRef config,
|
||||
YGCloneNodeFunc callback);
|
||||
|
||||
WIN_EXPORT YGConfigConstRef YGConfigGetDefault(void);
|
||||
YG_EXPORT YGConfigConstRef YGConfigGetDefault(void);
|
||||
|
||||
WIN_EXPORT void YGConfigSetContext(YGConfigRef config, void* context);
|
||||
WIN_EXPORT void* YGConfigGetContext(YGConfigConstRef config);
|
||||
YG_EXPORT void YGConfigSetContext(YGConfigRef config, void* context);
|
||||
YG_EXPORT void* YGConfigGetContext(YGConfigConstRef config);
|
||||
|
||||
WIN_EXPORT void YGConfigSetErrata(YGConfigRef config, YGErrata errata);
|
||||
WIN_EXPORT YGErrata YGConfigGetErrata(YGConfigConstRef config);
|
||||
YG_EXPORT void YGConfigSetErrata(YGConfigRef config, YGErrata errata);
|
||||
YG_EXPORT YGErrata YGConfigGetErrata(YGConfigConstRef config);
|
||||
|
||||
WIN_EXPORT float YGRoundValueToPixelGrid(
|
||||
YG_EXPORT float YGRoundValueToPixelGrid(
|
||||
double value,
|
||||
double pointScaleFactor,
|
||||
bool forceCeil,
|
||||
|
@@ -50,7 +50,7 @@ struct ConfigFlags {
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
class YOGA_EXPORT Config : public ::YGConfig {
|
||||
class YG_EXPORT Config : public ::YGConfig {
|
||||
public:
|
||||
Config(YGLogger logger);
|
||||
|
||||
|
@@ -48,7 +48,7 @@ struct LayoutData {
|
||||
|
||||
const char* LayoutPassReasonToString(const LayoutPassReason value);
|
||||
|
||||
struct YOGA_EXPORT Event {
|
||||
struct YG_EXPORT Event {
|
||||
enum Type {
|
||||
NodeAllocation,
|
||||
NodeDeallocation,
|
||||
|
@@ -260,7 +260,7 @@ void Node::setMeasureFunc(YGMeasureFunc measureFunc) {
|
||||
setMeasureFunc(m);
|
||||
}
|
||||
|
||||
YOGA_EXPORT void Node::setMeasureFunc(MeasureWithContextFn measureFunc) {
|
||||
void Node::setMeasureFunc(MeasureWithContextFn measureFunc) {
|
||||
flags_.measureUsesContext = true;
|
||||
decltype(Node::measure_) m;
|
||||
m.withContext = measureFunc;
|
||||
@@ -478,7 +478,7 @@ YGDirection Node::resolveDirection(const YGDirection ownerDirection) {
|
||||
}
|
||||
}
|
||||
|
||||
YOGA_EXPORT void Node::clearChildren() {
|
||||
void Node::clearChildren() {
|
||||
children_.clear();
|
||||
children_.shrink_to_fit();
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ struct NodeFlags {
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
class YOGA_EXPORT Node : public ::YGNode {
|
||||
class YG_EXPORT Node : public ::YGNode {
|
||||
public:
|
||||
// Internal variants of callbacks, currently used only by JNI bindings.
|
||||
// TODO: Reconcile this with the public API
|
||||
|
@@ -41,7 +41,7 @@ namespace facebook::yoga {
|
||||
// 0x40000000 0x7f7fffff
|
||||
// - Zero is supported, negative zero is not
|
||||
// - values outside of the representable range are clamped
|
||||
class YOGA_EXPORT CompactValue {
|
||||
class YG_EXPORT CompactValue {
|
||||
friend constexpr bool operator==(CompactValue, CompactValue) noexcept;
|
||||
|
||||
public:
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
namespace facebook::yoga {
|
||||
|
||||
class YOGA_EXPORT Style {
|
||||
class YG_EXPORT Style {
|
||||
template <typename Enum>
|
||||
using Values = std::array<CompactValue, enums::count<Enum>()>;
|
||||
|
||||
@@ -224,8 +224,8 @@ public:
|
||||
Ref<FloatOptional, &Style::aspectRatio_> aspectRatio() { return {*this}; }
|
||||
};
|
||||
|
||||
YOGA_EXPORT bool operator==(const Style& lhs, const Style& rhs);
|
||||
YOGA_EXPORT inline bool operator!=(const Style& lhs, const Style& rhs) {
|
||||
YG_EXPORT bool operator==(const Style& lhs, const Style& rhs);
|
||||
YG_EXPORT inline bool operator!=(const Style& lhs, const Style& rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
} // namespace facebook::yoga
|
||||
|
Reference in New Issue
Block a user