From c9fc570a488edefd4208c3bd32420deba4759797 Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Thu, 31 Jan 2019 09:29:12 -0800 Subject: [PATCH] Adds fixes for react-native-windows UWP (#848) Summary: Specifically, updates the UWP .vcxproj for MSBuild and also exposes the UseLegacyStretchBehaviour API for use with react-native-windows. Pull Request resolved: https://github.com/facebook/yoga/pull/848 Reviewed By: SidharthGuglani Differential Revision: D13848609 Pulled By: davidaurelio fbshipit-source-id: eab046ff3c47e49706f515e209d8aaf750c2198f --- ReactCommon/yoga/yoga/YGMacros.h | 8 -------- ReactCommon/yoga/yoga/Yoga.cpp | 9 ++++----- ReactCommon/yoga/yoga/Yoga.h | 10 +++++----- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/ReactCommon/yoga/yoga/YGMacros.h b/ReactCommon/yoga/yoga/YGMacros.h index 0e1319027bdc22..9c2989acb97670 100644 --- a/ReactCommon/yoga/yoga/YGMacros.h +++ b/ReactCommon/yoga/yoga/YGMacros.h @@ -20,14 +20,6 @@ #define WIN_EXPORT #endif -#ifdef WINARMDLL -#define WIN_STRUCT(type) type* -#define WIN_STRUCT_REF(value) &value -#else -#define WIN_STRUCT(type) type -#define WIN_STRUCT_REF(value) value -#endif - #ifdef NS_ENUM // Cannot use NSInteger as NSInteger has a different size than int (which is the // default type of a enum). Therefor when linking the Yoga C library into obj-c diff --git a/ReactCommon/yoga/yoga/Yoga.cpp b/ReactCommon/yoga/yoga/Yoga.cpp index 0d576d59b90589..f60a153efa9c21 100644 --- a/ReactCommon/yoga/yoga/Yoga.cpp +++ b/ReactCommon/yoga/yoga/Yoga.cpp @@ -602,12 +602,12 @@ inline detail::CompactValue Value::create(float) { template struct DimensionProp { template - static WIN_STRUCT(YGValue) get(YGNodeRef node) { + static YGValue get(YGNodeRef node) { YGValue value = (node->getStyle().*P)[idx]; if (value.unit == YGUnitUndefined || value.unit == YGUnitAuto) { value.value = YGUndefined; } - return WIN_STRUCT_REF(value); + return value; } template @@ -690,13 +690,12 @@ struct DimensionProp { } \ } \ \ - WIN_STRUCT(type) \ - YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge) { \ + type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge) { \ YGValue value = node->getStyle().instanceName[edge]; \ if (value.unit == YGUnitUndefined || value.unit == YGUnitAuto) { \ value.value = YGUndefined; \ } \ - return WIN_STRUCT_REF(value); \ + return value; \ } #define YG_NODE_LAYOUT_PROPERTY_IMPL(type, name, instanceName) \ diff --git a/ReactCommon/yoga/yoga/Yoga.h b/ReactCommon/yoga/yoga/Yoga.h index b15f8bb28d0dff..214c5f6921438c 100644 --- a/ReactCommon/yoga/yoga/Yoga.h +++ b/ReactCommon/yoga/yoga/Yoga.h @@ -140,11 +140,11 @@ YGDirtiedFunc YGNodeGetDirtiedFunc(YGNodeRef node); void YGNodeSetDirtiedFunc(YGNodeRef node, YGDirtiedFunc dirtiedFunc); YGPrintFunc YGNodeGetPrintFunc(YGNodeRef node); void YGNodeSetPrintFunc(YGNodeRef node, YGPrintFunc printFunc); -bool YGNodeGetHasNewLayout(YGNodeRef node); -void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout); +WIN_EXPORT bool YGNodeGetHasNewLayout(YGNodeRef node); +WIN_EXPORT void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout); YGNodeType YGNodeGetNodeType(YGNodeRef node); void YGNodeSetNodeType(YGNodeRef node, YGNodeType nodeType); -bool YGNodeIsDirty(YGNodeRef node); +WIN_EXPORT bool YGNodeIsDirty(YGNodeRef node); bool YGNodeLayoutGetDidUseLegacyFlag(const YGNodeRef node); WIN_EXPORT void YGNodeStyleSetDirection( @@ -227,8 +227,8 @@ WIN_EXPORT void YGNodeStyleSetPositionPercent( const YGNodeRef node, const YGEdge edge, const float position); -WIN_EXPORT WIN_STRUCT(YGValue) - YGNodeStyleGetPosition(const YGNodeRef node, const YGEdge edge); +WIN_EXPORT YGValue +YGNodeStyleGetPosition(const YGNodeRef node, const YGEdge edge); WIN_EXPORT void YGNodeStyleSetMargin( const YGNodeRef node,