Move YGStyle to seperate file and add constructors
Reviewed By: emilsjolander Differential Revision: D7016575 fbshipit-source-id: eb28df0ffb4cc813b23edaff80d7d4ebc56ce6af
This commit is contained in:
parent
973ef9728c
commit
b9991d33e3
|
@ -952,6 +952,10 @@
|
||||||
3DFE0D1C1DF8575800459392 /* Yoga.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130A77081DF767AF001F9587 /* Yoga.h */; };
|
3DFE0D1C1DF8575800459392 /* Yoga.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 130A77081DF767AF001F9587 /* Yoga.h */; };
|
||||||
3EDCA8A51D3591E700450C31 /* RCTErrorInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */; };
|
3EDCA8A51D3591E700450C31 /* RCTErrorInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */; };
|
||||||
5335D5411FE81A4700883D58 /* RCTShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5335D5401FE81A4700883D58 /* RCTShadowView.m */; };
|
5335D5411FE81A4700883D58 /* RCTShadowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5335D5401FE81A4700883D58 /* RCTShadowView.m */; };
|
||||||
|
5352C5752038FF9500A3B97E /* YGStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5352C5722038FF8D00A3B97E /* YGStyle.cpp */; };
|
||||||
|
5352C5762038FF9700A3B97E /* YGStyle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5352C5722038FF8D00A3B97E /* YGStyle.cpp */; };
|
||||||
|
5352C5772038FF9A00A3B97E /* YGStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 5352C5712038FF8D00A3B97E /* YGStyle.h */; };
|
||||||
|
5352C5782038FF9B00A3B97E /* YGStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 5352C5712038FF8D00A3B97E /* YGStyle.h */; };
|
||||||
53756E3B2004FFFA00FBBD99 /* Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53756E372004FFF700FBBD99 /* Utils.cpp */; };
|
53756E3B2004FFFA00FBBD99 /* Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 53756E372004FFF700FBBD99 /* Utils.cpp */; };
|
||||||
53756E3C2004FFFC00FBBD99 /* Utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 53756E382004FFF700FBBD99 /* Utils.h */; };
|
53756E3C2004FFFC00FBBD99 /* Utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 53756E382004FFF700FBBD99 /* Utils.h */; };
|
||||||
53756E3D2004FFFE00FBBD99 /* Utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 53756E382004FFF700FBBD99 /* Utils.h */; };
|
53756E3D2004FFFE00FBBD99 /* Utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 53756E382004FFF700FBBD99 /* Utils.h */; };
|
||||||
|
@ -2144,6 +2148,8 @@
|
||||||
3EDCA8A31D3591E700450C31 /* RCTErrorInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTErrorInfo.h; sourceTree = "<group>"; };
|
3EDCA8A31D3591E700450C31 /* RCTErrorInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTErrorInfo.h; sourceTree = "<group>"; };
|
||||||
3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTErrorInfo.m; sourceTree = "<group>"; };
|
3EDCA8A41D3591E700450C31 /* RCTErrorInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTErrorInfo.m; sourceTree = "<group>"; };
|
||||||
5335D5401FE81A4700883D58 /* RCTShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTShadowView.m; sourceTree = "<group>"; };
|
5335D5401FE81A4700883D58 /* RCTShadowView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTShadowView.m; sourceTree = "<group>"; };
|
||||||
|
5352C5712038FF8D00A3B97E /* YGStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGStyle.h; sourceTree = "<group>"; };
|
||||||
|
5352C5722038FF8D00A3B97E /* YGStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = YGStyle.cpp; sourceTree = "<group>"; };
|
||||||
53756E372004FFF700FBBD99 /* Utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Utils.cpp; sourceTree = "<group>"; };
|
53756E372004FFF700FBBD99 /* Utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Utils.cpp; sourceTree = "<group>"; };
|
||||||
53756E382004FFF700FBBD99 /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utils.h; sourceTree = "<group>"; };
|
53756E382004FFF700FBBD99 /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utils.h; sourceTree = "<group>"; };
|
||||||
5376C5E01FC6DDB20083513D /* YGNodePrint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGNodePrint.h; sourceTree = "<group>"; };
|
5376C5E01FC6DDB20083513D /* YGNodePrint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YGNodePrint.h; sourceTree = "<group>"; };
|
||||||
|
@ -2332,6 +2338,8 @@
|
||||||
130A77021DF767AF001F9587 /* yoga */ = {
|
130A77021DF767AF001F9587 /* yoga */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
5352C5722038FF8D00A3B97E /* YGStyle.cpp */,
|
||||||
|
5352C5712038FF8D00A3B97E /* YGStyle.h */,
|
||||||
53756E372004FFF700FBBD99 /* Utils.cpp */,
|
53756E372004FFF700FBBD99 /* Utils.cpp */,
|
||||||
53756E382004FFF700FBBD99 /* Utils.h */,
|
53756E382004FFF700FBBD99 /* Utils.h */,
|
||||||
53EC85DF1FDEC75A0051B2B5 /* YGNode.cpp */,
|
53EC85DF1FDEC75A0051B2B5 /* YGNode.cpp */,
|
||||||
|
@ -3268,6 +3276,7 @@
|
||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
5352C5782038FF9B00A3B97E /* YGStyle.h in Headers */,
|
||||||
53EC85E41FDEC7630051B2B5 /* YGNode.h in Headers */,
|
53EC85E41FDEC7630051B2B5 /* YGNode.h in Headers */,
|
||||||
53D1239F1FBF1EFB001B8A10 /* Yoga-internal.h in Headers */,
|
53D1239F1FBF1EFB001B8A10 /* Yoga-internal.h in Headers */,
|
||||||
3DFE0D161DF8574D00459392 /* YGEnums.h in Headers */,
|
3DFE0D161DF8574D00459392 /* YGEnums.h in Headers */,
|
||||||
|
@ -3346,6 +3355,7 @@
|
||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
5352C5772038FF9A00A3B97E /* YGStyle.h in Headers */,
|
||||||
53EC85E51FDEC7630051B2B5 /* YGNode.h in Headers */,
|
53EC85E51FDEC7630051B2B5 /* YGNode.h in Headers */,
|
||||||
53D1239E1FBF1EFB001B8A10 /* Yoga-internal.h in Headers */,
|
53D1239E1FBF1EFB001B8A10 /* Yoga-internal.h in Headers */,
|
||||||
133957881DF76D3500EC27BE /* YGEnums.h in Headers */,
|
133957881DF76D3500EC27BE /* YGEnums.h in Headers */,
|
||||||
|
@ -4292,6 +4302,7 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
53D123A01FBF1EFF001B8A10 /* Yoga.cpp in Sources */,
|
53D123A01FBF1EFF001B8A10 /* Yoga.cpp in Sources */,
|
||||||
|
5352C5752038FF9500A3B97E /* YGStyle.cpp in Sources */,
|
||||||
53EC85E21FDEC75F0051B2B5 /* YGNode.cpp in Sources */,
|
53EC85E21FDEC75F0051B2B5 /* YGNode.cpp in Sources */,
|
||||||
53D1239A1FBF1EF2001B8A10 /* YGEnums.cpp in Sources */,
|
53D1239A1FBF1EF2001B8A10 /* YGEnums.cpp in Sources */,
|
||||||
53756E3B2004FFFA00FBBD99 /* Utils.cpp in Sources */,
|
53756E3B2004FFFA00FBBD99 /* Utils.cpp in Sources */,
|
||||||
|
@ -4304,6 +4315,7 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
53D123A11FBF1EFF001B8A10 /* Yoga.cpp in Sources */,
|
53D123A11FBF1EFF001B8A10 /* Yoga.cpp in Sources */,
|
||||||
|
5352C5762038FF9700A3B97E /* YGStyle.cpp in Sources */,
|
||||||
53EC85E31FDEC75F0051B2B5 /* YGNode.cpp in Sources */,
|
53EC85E31FDEC75F0051B2B5 /* YGNode.cpp in Sources */,
|
||||||
53D1239B1FBF1EF4001B8A10 /* YGEnums.cpp in Sources */,
|
53D1239B1FBF1EF4001B8A10 /* YGEnums.cpp in Sources */,
|
||||||
53756E3E2005000300FBBD99 /* Utils.cpp in Sources */,
|
53756E3E2005000300FBBD99 /* Utils.cpp in Sources */,
|
||||||
|
|
|
@ -382,7 +382,7 @@ YGNode::YGNode()
|
||||||
measure_(nullptr),
|
measure_(nullptr),
|
||||||
baseline_(nullptr),
|
baseline_(nullptr),
|
||||||
dirtied_(nullptr),
|
dirtied_(nullptr),
|
||||||
style_(gYGNodeStyleDefaults),
|
style_(YGStyle()),
|
||||||
layout_(gYGNodeLayoutDefaults),
|
layout_(gYGNodeLayoutDefaults),
|
||||||
lineIndex_(0),
|
lineIndex_(0),
|
||||||
parent_(nullptr),
|
parent_(nullptr),
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include "YGStyle.h"
|
||||||
#include "Yoga-internal.h"
|
#include "Yoga-internal.h"
|
||||||
|
|
||||||
struct YGNode {
|
struct YGNode {
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
#include "YGStyle.h"
|
||||||
|
|
||||||
|
YGStyle::YGStyle()
|
||||||
|
: direction(YGDirectionInherit),
|
||||||
|
flexDirection(YGFlexDirectionColumn),
|
||||||
|
justifyContent(YGJustifyFlexStart),
|
||||||
|
alignContent(YGAlignFlexStart),
|
||||||
|
alignItems(YGAlignStretch),
|
||||||
|
alignSelf(YGAlignAuto),
|
||||||
|
positionType(YGPositionTypeRelative),
|
||||||
|
flexWrap(YGWrapNoWrap),
|
||||||
|
overflow(YGOverflowVisible),
|
||||||
|
display(YGDisplayFlex),
|
||||||
|
flex(YGUndefined),
|
||||||
|
flexGrow(YGUndefined),
|
||||||
|
flexShrink(YGUndefined),
|
||||||
|
flexBasis(kYGValueAuto),
|
||||||
|
margin(kYGDefaultEdgeValuesUnit),
|
||||||
|
position(kYGDefaultEdgeValuesUnit),
|
||||||
|
padding(kYGDefaultEdgeValuesUnit),
|
||||||
|
border(kYGDefaultEdgeValuesUnit),
|
||||||
|
dimensions(kYGDefaultDimensionValuesAutoUnit),
|
||||||
|
minDimensions(kYGDefaultDimensionValuesUnit),
|
||||||
|
maxDimensions(kYGDefaultDimensionValuesUnit),
|
||||||
|
aspectRatio(YGUndefined) {}
|
||||||
|
|
||||||
|
// Yoga specific properties, not compatible with flexbox specification
|
||||||
|
bool YGStyle::operator==(const YGStyle& style) {
|
||||||
|
bool areNonFloatValuesEqual = direction == style.direction &&
|
||||||
|
flexDirection == style.flexDirection &&
|
||||||
|
justifyContent == style.justifyContent &&
|
||||||
|
alignContent == style.alignContent && alignItems == style.alignItems &&
|
||||||
|
alignSelf == style.alignSelf && positionType == style.positionType &&
|
||||||
|
flexWrap == style.flexWrap && overflow == style.overflow &&
|
||||||
|
display == style.display && YGValueEqual(flexBasis, style.flexBasis) &&
|
||||||
|
YGValueArrayEqual(margin, style.margin) &&
|
||||||
|
YGValueArrayEqual(position, style.position) &&
|
||||||
|
YGValueArrayEqual(padding, style.padding) &&
|
||||||
|
YGValueArrayEqual(border, style.border) &&
|
||||||
|
YGValueArrayEqual(dimensions, style.dimensions) &&
|
||||||
|
YGValueArrayEqual(minDimensions, style.minDimensions) &&
|
||||||
|
YGValueArrayEqual(maxDimensions, style.maxDimensions);
|
||||||
|
|
||||||
|
if (!(std::isnan(flex) && std::isnan(style.flex))) {
|
||||||
|
areNonFloatValuesEqual = areNonFloatValuesEqual && flex == style.flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(std::isnan(flexGrow) && std::isnan(style.flexGrow))) {
|
||||||
|
areNonFloatValuesEqual =
|
||||||
|
areNonFloatValuesEqual && flexGrow == style.flexGrow;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(std::isnan(flexShrink) && std::isnan(style.flexShrink))) {
|
||||||
|
areNonFloatValuesEqual =
|
||||||
|
areNonFloatValuesEqual && flexShrink == style.flexShrink;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(std::isnan(aspectRatio) && std::isnan(style.aspectRatio))) {
|
||||||
|
areNonFloatValuesEqual =
|
||||||
|
areNonFloatValuesEqual && aspectRatio == style.aspectRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
return areNonFloatValuesEqual;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool YGStyle::operator!=(YGStyle style) {
|
||||||
|
return !(*this == style);
|
||||||
|
}
|
||||||
|
|
||||||
|
YGStyle::~YGStyle() {}
|
|
@ -0,0 +1,43 @@
|
||||||
|
/**
|
||||||
|
* 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 "Yoga-internal.h"
|
||||||
|
#include "Yoga.h"
|
||||||
|
|
||||||
|
struct YGStyle {
|
||||||
|
YGDirection direction;
|
||||||
|
YGFlexDirection flexDirection;
|
||||||
|
YGJustify justifyContent;
|
||||||
|
YGAlign alignContent;
|
||||||
|
YGAlign alignItems;
|
||||||
|
YGAlign alignSelf;
|
||||||
|
YGPositionType positionType;
|
||||||
|
YGWrap flexWrap;
|
||||||
|
YGOverflow overflow;
|
||||||
|
YGDisplay display;
|
||||||
|
float flex;
|
||||||
|
float flexGrow;
|
||||||
|
float flexShrink;
|
||||||
|
YGValue flexBasis;
|
||||||
|
std::array<YGValue, YGEdgeCount> margin;
|
||||||
|
std::array<YGValue, YGEdgeCount> position;
|
||||||
|
std::array<YGValue, YGEdgeCount> padding;
|
||||||
|
std::array<YGValue, YGEdgeCount> border;
|
||||||
|
std::array<YGValue, 2> dimensions;
|
||||||
|
std::array<YGValue, 2> minDimensions;
|
||||||
|
std::array<YGValue, 2> maxDimensions;
|
||||||
|
float aspectRatio;
|
||||||
|
|
||||||
|
YGStyle();
|
||||||
|
// Yoga specific properties, not compatible with flexbox specification
|
||||||
|
bool operator==(const YGStyle& style);
|
||||||
|
|
||||||
|
bool operator!=(YGStyle style);
|
||||||
|
~YGStyle();
|
||||||
|
};
|
|
@ -10,7 +10,6 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "Yoga.h"
|
#include "Yoga.h"
|
||||||
|
|
||||||
using YGVector = std::vector<YGNodeRef>;
|
using YGVector = std::vector<YGNodeRef>;
|
||||||
|
@ -42,6 +41,23 @@ bool YGValueArrayEqual(
|
||||||
return areEqual;
|
return areEqual;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const YGValue kYGValueUndefined = {YGUndefined, YGUnitUndefined};
|
||||||
|
const YGValue kYGValueAuto = {YGUndefined, YGUnitAuto};
|
||||||
|
const std::array<YGValue, YGEdgeCount> kYGDefaultEdgeValuesUnit = {
|
||||||
|
{kYGValueUndefined,
|
||||||
|
kYGValueUndefined,
|
||||||
|
kYGValueUndefined,
|
||||||
|
kYGValueUndefined,
|
||||||
|
kYGValueUndefined,
|
||||||
|
kYGValueUndefined,
|
||||||
|
kYGValueUndefined,
|
||||||
|
kYGValueUndefined,
|
||||||
|
kYGValueUndefined}};
|
||||||
|
const std::array<YGValue, 2> kYGDefaultDimensionValuesAutoUnit = {
|
||||||
|
{kYGValueAuto, kYGValueAuto}};
|
||||||
|
const std::array<YGValue, 2> kYGDefaultDimensionValuesUnit = {
|
||||||
|
{kYGValueUndefined, kYGValueUndefined}};
|
||||||
|
|
||||||
struct YGCachedMeasurement {
|
struct YGCachedMeasurement {
|
||||||
float availableWidth;
|
float availableWidth;
|
||||||
float availableHeight;
|
float availableHeight;
|
||||||
|
@ -141,74 +157,6 @@ struct YGLayout {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct YGStyle {
|
|
||||||
YGDirection direction;
|
|
||||||
YGFlexDirection flexDirection;
|
|
||||||
YGJustify justifyContent;
|
|
||||||
YGAlign alignContent;
|
|
||||||
YGAlign alignItems;
|
|
||||||
YGAlign alignSelf;
|
|
||||||
YGPositionType positionType;
|
|
||||||
YGWrap flexWrap;
|
|
||||||
YGOverflow overflow;
|
|
||||||
YGDisplay display;
|
|
||||||
float flex;
|
|
||||||
float flexGrow;
|
|
||||||
float flexShrink;
|
|
||||||
YGValue flexBasis;
|
|
||||||
std::array<YGValue, YGEdgeCount> margin;
|
|
||||||
std::array<YGValue, YGEdgeCount> position;
|
|
||||||
std::array<YGValue, YGEdgeCount> padding;
|
|
||||||
std::array<YGValue, YGEdgeCount> border;
|
|
||||||
std::array<YGValue, 2> dimensions;
|
|
||||||
std::array<YGValue, 2> minDimensions;
|
|
||||||
std::array<YGValue, 2> maxDimensions;
|
|
||||||
|
|
||||||
// Yoga specific properties, not compatible with flexbox specification
|
|
||||||
float aspectRatio;
|
|
||||||
bool operator==(YGStyle style) {
|
|
||||||
bool areNonFloatValuesEqual = direction == style.direction &&
|
|
||||||
flexDirection == style.flexDirection &&
|
|
||||||
justifyContent == style.justifyContent &&
|
|
||||||
alignContent == style.alignContent && alignItems == style.alignItems &&
|
|
||||||
alignSelf == style.alignSelf && positionType == style.positionType &&
|
|
||||||
flexWrap == style.flexWrap && overflow == style.overflow &&
|
|
||||||
display == style.display && YGValueEqual(flexBasis, style.flexBasis) &&
|
|
||||||
YGValueArrayEqual(margin, style.margin) &&
|
|
||||||
YGValueArrayEqual(position, style.position) &&
|
|
||||||
YGValueArrayEqual(padding, style.padding) &&
|
|
||||||
YGValueArrayEqual(border, style.border) &&
|
|
||||||
YGValueArrayEqual(dimensions, style.dimensions) &&
|
|
||||||
YGValueArrayEqual(minDimensions, style.minDimensions) &&
|
|
||||||
YGValueArrayEqual(maxDimensions, style.maxDimensions);
|
|
||||||
|
|
||||||
if (!(std::isnan(flex) && std::isnan(style.flex))) {
|
|
||||||
areNonFloatValuesEqual = areNonFloatValuesEqual && flex == style.flex;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(std::isnan(flexGrow) && std::isnan(style.flexGrow))) {
|
|
||||||
areNonFloatValuesEqual =
|
|
||||||
areNonFloatValuesEqual && flexGrow == style.flexGrow;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(std::isnan(flexShrink) && std::isnan(style.flexShrink))) {
|
|
||||||
areNonFloatValuesEqual =
|
|
||||||
areNonFloatValuesEqual && flexShrink == style.flexShrink;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(std::isnan(aspectRatio) && std::isnan(style.aspectRatio))) {
|
|
||||||
areNonFloatValuesEqual =
|
|
||||||
areNonFloatValuesEqual && aspectRatio == style.aspectRatio;
|
|
||||||
}
|
|
||||||
|
|
||||||
return areNonFloatValuesEqual;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(YGStyle style) {
|
|
||||||
return !(*this == style);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct YGConfig {
|
struct YGConfig {
|
||||||
bool experimentalFeatures[YGExperimentalFeatureCount + 1];
|
bool experimentalFeatures[YGExperimentalFeatureCount + 1];
|
||||||
bool useWebDefaults;
|
bool useWebDefaults;
|
||||||
|
@ -220,94 +168,10 @@ struct YGConfig {
|
||||||
void* context;
|
void* context;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define YG_UNDEFINED_VALUES \
|
|
||||||
{ .value = YGUndefined, .unit = YGUnitUndefined }
|
|
||||||
|
|
||||||
#define YG_AUTO_VALUES \
|
|
||||||
{ .value = YGUndefined, .unit = YGUnitAuto }
|
|
||||||
|
|
||||||
#define YG_DEFAULT_EDGE_VALUES_UNIT \
|
|
||||||
{ \
|
|
||||||
[YGEdgeLeft] = YG_UNDEFINED_VALUES, [YGEdgeTop] = YG_UNDEFINED_VALUES, \
|
|
||||||
[YGEdgeRight] = YG_UNDEFINED_VALUES, [YGEdgeBottom] = YG_UNDEFINED_VALUES, \
|
|
||||||
[YGEdgeStart] = YG_UNDEFINED_VALUES, [YGEdgeEnd] = YG_UNDEFINED_VALUES, \
|
|
||||||
[YGEdgeHorizontal] = YG_UNDEFINED_VALUES, \
|
|
||||||
[YGEdgeVertical] = YG_UNDEFINED_VALUES, [YGEdgeAll] = YG_UNDEFINED_VALUES, \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define YG_DEFAULT_DIMENSION_VALUES \
|
|
||||||
{ [YGDimensionWidth] = YGUndefined, [YGDimensionHeight] = YGUndefined, }
|
|
||||||
|
|
||||||
#define YG_DEFAULT_DIMENSION_VALUES_UNIT \
|
|
||||||
{ \
|
|
||||||
[YGDimensionWidth] = YG_UNDEFINED_VALUES, \
|
|
||||||
[YGDimensionHeight] = YG_UNDEFINED_VALUES, \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define YG_DEFAULT_DIMENSION_VALUES_AUTO_UNIT \
|
|
||||||
{ [YGDimensionWidth] = YG_AUTO_VALUES, [YGDimensionHeight] = YG_AUTO_VALUES, }
|
|
||||||
|
|
||||||
static const float kDefaultFlexGrow = 0.0f;
|
static const float kDefaultFlexGrow = 0.0f;
|
||||||
static const float kDefaultFlexShrink = 0.0f;
|
static const float kDefaultFlexShrink = 0.0f;
|
||||||
static const float kWebDefaultFlexShrink = 1.0f;
|
static const float kWebDefaultFlexShrink = 1.0f;
|
||||||
|
|
||||||
static const YGStyle gYGNodeStyleDefaults = {
|
|
||||||
.direction = YGDirectionInherit,
|
|
||||||
.flexDirection = YGFlexDirectionColumn,
|
|
||||||
.justifyContent = YGJustifyFlexStart,
|
|
||||||
.alignContent = YGAlignFlexStart,
|
|
||||||
.alignItems = YGAlignStretch,
|
|
||||||
.alignSelf = YGAlignAuto,
|
|
||||||
.positionType = YGPositionTypeRelative,
|
|
||||||
.flexWrap = YGWrapNoWrap,
|
|
||||||
.overflow = YGOverflowVisible,
|
|
||||||
.display = YGDisplayFlex,
|
|
||||||
.flex = YGUndefined,
|
|
||||||
.flexGrow = YGUndefined,
|
|
||||||
.flexShrink = YGUndefined,
|
|
||||||
.flexBasis = YG_AUTO_VALUES,
|
|
||||||
.margin = {{YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES}},
|
|
||||||
.position = {{YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES}},
|
|
||||||
.padding = {{YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES}},
|
|
||||||
.border = {{YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES,
|
|
||||||
YG_UNDEFINED_VALUES}},
|
|
||||||
.dimensions = {{YG_AUTO_VALUES, YG_AUTO_VALUES}},
|
|
||||||
.minDimensions = {{YG_UNDEFINED_VALUES, YG_UNDEFINED_VALUES}},
|
|
||||||
.maxDimensions = {{YG_UNDEFINED_VALUES, YG_UNDEFINED_VALUES}},
|
|
||||||
.aspectRatio = YGUndefined,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const YGLayout gYGNodeLayoutDefaults = {
|
static const YGLayout gYGNodeLayoutDefaults = {
|
||||||
.position = {},
|
.position = {},
|
||||||
.dimensions = {{YGUndefined, YGUndefined}},
|
.dimensions = {{YGUndefined, YGUndefined}},
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
export RCT_METRO_PORT=8081
|
Loading…
Reference in New Issue