diff --git a/yoga/Utils.cpp b/yoga/Utils.cpp index 2035fe00..38b686c5 100644 --- a/yoga/Utils.cpp +++ b/yoga/Utils.cpp @@ -31,7 +31,7 @@ float YGFloatMin(const float a, const float b) { return yoga::isUndefined(a) ? b : a; } -bool YGValueEqual(const YGValue a, const YGValue b) { +bool YGValueEqual(const YGValue& a, const YGValue& b) { if (a.unit != b.unit) { return false; } diff --git a/yoga/Utils.h b/yoga/Utils.h index a27b62a1..900ccb1b 100644 --- a/yoga/Utils.h +++ b/yoga/Utils.h @@ -52,7 +52,12 @@ struct YGCollectFlexItemsRowValues { float crossDim; }; -bool YGValueEqual(const YGValue a, const YGValue b); +bool YGValueEqual(const YGValue& a, const YGValue& b); +inline bool YGValueEqual( + facebook::yoga::detail::CompactValue a, + facebook::yoga::detail::CompactValue b) { + return YGValueEqual((YGValue) a, (YGValue) b); +} // This custom float equality function returns true if either absolute // difference between two floats is less than 0.0001f or both are undefined. @@ -105,6 +110,12 @@ inline YGFloatOptional YGResolveValue( } } +inline YGFloatOptional YGResolveValue( + yoga::detail::CompactValue value, + float ownerSize) { + return YGResolveValue((YGValue) value, ownerSize); +} + inline bool YGFlexDirectionIsColumn(const YGFlexDirection flexDirection) { return flexDirection == YGFlexDirectionColumn || flexDirection == YGFlexDirectionColumnReverse; diff --git a/yoga/YGNodePrint.cpp b/yoga/YGNodePrint.cpp index ee07ac92..cc3ead74 100644 --- a/yoga/YGNodePrint.cpp +++ b/yoga/YGNodePrint.cpp @@ -10,6 +10,7 @@ #include "YGEnums.h" #include "YGNode.h" #include "Yoga-internal.h" +#include "Utils.h" namespace facebook { namespace yoga { diff --git a/yoga/YGStyle.cpp b/yoga/YGStyle.cpp index d9956363..26b0f269 100644 --- a/yoga/YGStyle.cpp +++ b/yoga/YGStyle.cpp @@ -5,6 +5,7 @@ * file in the root directory of this source tree. */ #include "YGStyle.h" +#include "Utils.h" // Yoga specific properties, not compatible with flexbox specification bool operator==(const YGStyle& lhs, const YGStyle& rhs) { diff --git a/yoga/Yoga-internal.h b/yoga/Yoga-internal.h index 5b4bc5be..f5cd6136 100644 --- a/yoga/Yoga-internal.h +++ b/yoga/Yoga-internal.h @@ -45,7 +45,6 @@ using namespace facebook; extern const std::array trailing; extern const std::array leading; -extern bool YGValueEqual(const YGValue a, const YGValue b); extern const YGValue YGValueUndefined; extern const YGValue YGValueAuto; extern const YGValue YGValueZero;