[YogaKit] support macOS, tvOS, Carthage; auto apply layout like AutoLayout. #1026
@@ -375,9 +375,9 @@ YG_PROPERTY(CGFloat, aspectRatio, AspectRatio)
|
||||
|
||||
static YGSize YGMeasureView(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
YGFloat width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGFloat height,
|
||||
YGMeasureMode heightMode) {
|
||||
const CGFloat constrainedWidth =
|
||||
(widthMode == YGMeasureModeUndefined) ? CGFLOAT_MAX : width;
|
||||
@@ -409,9 +409,9 @@ static YGSize YGMeasureView(
|
||||
}
|
||||
|
||||
return (YGSize){
|
||||
.width = (float)YGSanitizeMeasurement(
|
||||
.width = (YGFloat)YGSanitizeMeasurement(
|
||||
constrainedWidth, sizeThatFits.width, widthMode),
|
||||
.height = (float)YGSanitizeMeasurement(
|
||||
.height = (YGFloat)YGSanitizeMeasurement(
|
||||
constrainedHeight, sizeThatFits.height, heightMode),
|
||||
};
|
||||
}
|
||||
@@ -488,11 +488,6 @@ static void YGRemoveAllChildren(const YGNodeRef node) {
|
||||
YGNodeRemoveAllChildren(node);
|
||||
}
|
||||
|
||||
static inline CGPoint YGRoundPixelPosition(CGPoint p) {
|
||||
CGFloat scale = YGScaleFactor();
|
||||
return (CGPoint) { .x = round(p.x * scale) / scale, .y = round(p.y * scale) / scale };
|
||||
}
|
||||
|
||||
static inline CGSize YGAlignPixelSize(CGSize s) {
|
||||
CGFloat scale = YGScaleFactor();
|
||||
return (CGSize) { .width = ceil(s.width * scale) / scale, .height = ceil(s.height * scale) / scale };
|
||||
@@ -553,7 +548,7 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) {
|
||||
}
|
||||
|
||||
view.frame = (CGRect) {
|
||||
.origin = YGRoundPixelPosition(frame.origin),
|
||||
.origin = frame.origin,
|
||||
.size = YGAlignPixelSize(frame.size)
|
||||
};
|
||||
#else
|
||||
@@ -562,10 +557,10 @@ static void YGApplyLayoutToViewHierarchy(UIView* view, BOOL preserveOrigin) {
|
||||
.size = YGAlignPixelSize(frame.size)
|
||||
};
|
||||
|
||||
view.center = YGRoundPixelPosition((CGPoint) {
|
||||
.x = CGRectGetMinX(frame) + CGRectGetWidth(frame) * 0.5,
|
||||
.y = CGRectGetMinY(frame) + CGRectGetHeight(frame) * 0.5
|
||||
});
|
||||
view.center = (CGPoint) {
|
||||
.x = CGRectGetMidX(frame),
|
||||
.y = CGRectGetMidY(frame)
|
||||
};
|
||||
#endif
|
||||
|
||||
if (!yoga.isLeaf) {
|
||||
|
@@ -265,16 +265,28 @@
|
||||
subview1.yoga.flexGrow = 1;
|
||||
[container addSubview:subview1];
|
||||
|
||||
UIView *leafView = [[UIView alloc] init];
|
||||
leafView.yoga.isEnabled = YES;
|
||||
[subview1 addSubview:leafView];
|
||||
|
||||
UIView* subview2 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview2.yoga.isEnabled = YES;
|
||||
subview2.yoga.flexGrow = 1;
|
||||
[container addSubview:subview2];
|
||||
|
||||
leafView = [[UIView alloc] init];
|
||||
leafView.yoga.isEnabled = YES;
|
||||
[subview2 addSubview:leafView];
|
||||
|
||||
UIView* subview3 = [[UIView alloc] initWithFrame:CGRectZero];
|
||||
subview3.yoga.isEnabled = YES;
|
||||
subview3.yoga.flexGrow = 1;
|
||||
[container addSubview:subview3];
|
||||
|
||||
leafView = [[UIView alloc] init];
|
||||
leafView.yoga.isEnabled = YES;
|
||||
[subview3 addSubview:leafView];
|
||||
|
||||
[container.yoga applyLayoutPreservingOrigin:YES];
|
||||
|
||||
XCTAssertEqualWithAccuracy(
|
||||
|
@@ -18,16 +18,16 @@ YGFlexDirection YGFlexDirectionCross(
|
||||
: YGFlexDirectionColumn;
|
||||
}
|
||||
|
||||
float YGFloatMax(const float a, const float b) {
|
||||
YGFloat YGFloatMax(const YGFloat a, const YGFloat b) {
|
||||
if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) {
|
||||
return fmaxf(a, b);
|
||||
return fmax(a, b);
|
||||
}
|
||||
return yoga::isUndefined(a) ? b : a;
|
||||
}
|
||||
|
||||
float YGFloatMin(const float a, const float b) {
|
||||
YGFloat YGFloatMin(const YGFloat a, const YGFloat b) {
|
||||
if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) {
|
||||
return fminf(a, b);
|
||||
return fmin(a, b);
|
||||
}
|
||||
|
||||
return yoga::isUndefined(a) ? b : a;
|
||||
@@ -46,7 +46,7 @@ bool YGValueEqual(const YGValue& a, const YGValue& b) {
|
||||
return fabs(a.value - b.value) < 0.0001f;
|
||||
}
|
||||
|
||||
bool YGFloatsEqual(const float a, const float b) {
|
||||
bool YGFloatsEqual(const YGFloat a, const YGFloat b) {
|
||||
if (!yoga::isUndefined(a) && !yoga::isUndefined(b)) {
|
||||
return fabs(a - b) < 0.0001f;
|
||||
}
|
||||
@@ -60,7 +60,7 @@ bool YGDoubleEqual(const double a, const double b) {
|
||||
return yoga::isUndefined(a) && yoga::isUndefined(b);
|
||||
}
|
||||
|
||||
float YGFloatSanitize(const float val) {
|
||||
YGFloat YGFloatSanitize(const YGFloat val) {
|
||||
return yoga::isUndefined(val) ? 0 : val;
|
||||
}
|
||||
|
||||
|
36
yoga/Utils.h
36
yoga/Utils.h
@@ -38,19 +38,19 @@
|
||||
|
||||
struct YGCollectFlexItemsRowValues {
|
||||
uint32_t itemsOnLine;
|
||||
float sizeConsumedOnCurrentLine;
|
||||
float totalFlexGrowFactors;
|
||||
float totalFlexShrinkScaledFactors;
|
||||
YGFloat sizeConsumedOnCurrentLine;
|
||||
YGFloat totalFlexGrowFactors;
|
||||
YGFloat totalFlexShrinkScaledFactors;
|
||||
uint32_t endOfLineIndex;
|
||||
std::vector<YGNodeRef> relativeChildren;
|
||||
float remainingFreeSpace;
|
||||
YGFloat remainingFreeSpace;
|
||||
// The size of the mainDim for the row after considering size, padding, margin
|
||||
// and border of flex items. This is used to calculate maxLineDim after going
|
||||
// through all the rows to decide on the main axis size of owner.
|
||||
float mainDim;
|
||||
YGFloat mainDim;
|
||||
// The size of the crossDim for the row after considering size, padding,
|
||||
// margin and border of flex items. Used for calculating containers crossSize.
|
||||
float crossDim;
|
||||
YGFloat crossDim;
|
||||
};
|
||||
|
||||
bool YGValueEqual(const YGValue& a, const YGValue& b);
|
||||
@@ -60,27 +60,27 @@ inline bool YGValueEqual(
|
||||
return YGValueEqual((YGValue) a, (YGValue) b);
|
||||
}
|
||||
|
||||
// This custom float equality function returns true if either absolute
|
||||
// This custom YGFloat equality function returns true if either absolute
|
||||
// difference between two floats is less than 0.0001f or both are undefined.
|
||||
bool YGFloatsEqual(const float a, const float b);
|
||||
bool YGFloatsEqual(const YGFloat a, const YGFloat b);
|
||||
|
||||
bool YGDoubleEqual(const double a, const double b);
|
||||
|
||||
float YGFloatMax(const float a, const float b);
|
||||
YGFloat YGFloatMax(const YGFloat a, const YGFloat b);
|
||||
|
||||
YGFloatOptional YGFloatOptionalMax(
|
||||
const YGFloatOptional op1,
|
||||
const YGFloatOptional op2);
|
||||
|
||||
float YGFloatMin(const float a, const float b);
|
||||
YGFloat YGFloatMin(const YGFloat a, const YGFloat b);
|
||||
|
||||
// This custom float comparison function compares the array of float with
|
||||
// YGFloatsEqual, as the default float comparison operator will not work(Look
|
||||
// This custom YGFloat comparison function compares the array of YGFloat with
|
||||
// YGFloatsEqual, as the default YGFloat comparison operator will not work(Look
|
||||
// at the comments of YGFloatsEqual function).
|
||||
template <std::size_t size>
|
||||
bool YGFloatArrayEqual(
|
||||
const std::array<float, size>& val1,
|
||||
const std::array<float, size>& val2) {
|
||||
const std::array<YGFloat, size>& val1,
|
||||
const std::array<YGFloat, size>& val2) {
|
||||
bool areEqual = true;
|
||||
for (std::size_t i = 0; i < size && areEqual; ++i) {
|
||||
areEqual = YGFloatsEqual(val1[i], val2[i]);
|
||||
@@ -89,7 +89,7 @@ bool YGFloatArrayEqual(
|
||||
}
|
||||
|
||||
// This function returns 0 if YGFloatIsUndefined(val) is true and val otherwise
|
||||
float YGFloatSanitize(const float val);
|
||||
YGFloat YGFloatSanitize(const YGFloat val);
|
||||
|
||||
YGFlexDirection YGFlexDirectionCross(
|
||||
const YGFlexDirection flexDirection,
|
||||
@@ -102,7 +102,7 @@ inline bool YGFlexDirectionIsRow(const YGFlexDirection flexDirection) {
|
||||
|
||||
inline YGFloatOptional YGResolveValue(
|
||||
const YGValue value,
|
||||
const float ownerSize) {
|
||||
const YGFloat ownerSize) {
|
||||
switch (value.unit) {
|
||||
case YGUnitPoint:
|
||||
return YGFloatOptional{value.value};
|
||||
@@ -115,7 +115,7 @@ inline YGFloatOptional YGResolveValue(
|
||||
|
||||
inline YGFloatOptional YGResolveValue(
|
||||
yoga::detail::CompactValue value,
|
||||
float ownerSize) {
|
||||
YGFloat ownerSize) {
|
||||
return YGResolveValue((YGValue) value, ownerSize);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ inline YGFlexDirection YGResolveFlexDirection(
|
||||
|
||||
inline YGFloatOptional YGResolveValueMargin(
|
||||
yoga::detail::CompactValue value,
|
||||
const float ownerSize) {
|
||||
const YGFloat ownerSize) {
|
||||
return value.isAuto() ? YGFloatOptional{0} : YGResolveValue(value, ownerSize);
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,7 @@ public:
|
||||
bool useLegacyStretchBehaviour = false;
|
||||
bool shouldDiffLayoutWithoutLegacyStretchBehaviour = false;
|
||||
bool printTree = false;
|
||||
float pointScaleFactor = 1.0f;
|
||||
YGFloat pointScaleFactor = 1.0f;
|
||||
std::array<bool, facebook::yoga::enums::count<YGExperimentalFeature>()>
|
||||
experimentalFeatures = {};
|
||||
void* context = nullptr;
|
||||
|
@@ -13,14 +13,14 @@
|
||||
|
||||
struct YGFloatOptional {
|
||||
private:
|
||||
float value_ = std::numeric_limits<float>::quiet_NaN();
|
||||
YGFloat value_ = std::numeric_limits<YGFloat>::quiet_NaN();
|
||||
|
||||
public:
|
||||
explicit constexpr YGFloatOptional(float value) : value_(value) {}
|
||||
explicit constexpr YGFloatOptional(YGFloat value) : value_(value) {}
|
||||
constexpr YGFloatOptional() = default;
|
||||
|
||||
// returns the wrapped value, or a value x with YGIsUndefined(x) == true
|
||||
constexpr float unwrap() const { return value_; }
|
||||
constexpr YGFloat unwrap() const { return value_; }
|
||||
|
||||
bool isUndefined() const { return std::isnan(value_); }
|
||||
};
|
||||
@@ -35,17 +35,17 @@ inline bool operator!=(YGFloatOptional lhs, YGFloatOptional rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
inline bool operator==(YGFloatOptional lhs, float rhs) {
|
||||
inline bool operator==(YGFloatOptional lhs, YGFloat rhs) {
|
||||
return lhs == YGFloatOptional{rhs};
|
||||
}
|
||||
inline bool operator!=(YGFloatOptional lhs, float rhs) {
|
||||
inline bool operator!=(YGFloatOptional lhs, YGFloat rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
inline bool operator==(float lhs, YGFloatOptional rhs) {
|
||||
inline bool operator==(YGFloat lhs, YGFloatOptional rhs) {
|
||||
return rhs == lhs;
|
||||
}
|
||||
inline bool operator!=(float lhs, YGFloatOptional rhs) {
|
||||
inline bool operator!=(YGFloat lhs, YGFloatOptional rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
|
@@ -13,11 +13,11 @@
|
||||
using namespace facebook::yoga;
|
||||
|
||||
struct YGLayout {
|
||||
std::array<float, 4> position = {};
|
||||
std::array<float, 2> dimensions = {{YGUndefined, YGUndefined}};
|
||||
std::array<float, 4> margin = {};
|
||||
std::array<float, 4> border = {};
|
||||
std::array<float, 4> padding = {};
|
||||
std::array<YGFloat, 4> position = {};
|
||||
std::array<YGFloat, 2> dimensions = {{YGUndefined, YGUndefined}};
|
||||
std::array<YGFloat, 4> margin = {};
|
||||
std::array<YGFloat, 4> border = {};
|
||||
std::array<YGFloat, 4> padding = {};
|
||||
|
||||
private:
|
||||
static constexpr size_t directionOffset = 0;
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
uint32_t nextCachedMeasurementsIndex = 0;
|
||||
std::array<YGCachedMeasurement, YG_MAX_CACHED_RESULT_COUNT>
|
||||
cachedMeasurements = {};
|
||||
std::array<float, 2> measuredDimensions = {{YGUndefined, YGUndefined}};
|
||||
std::array<YGFloat, 2> measuredDimensions = {{YGUndefined, YGUndefined}};
|
||||
|
||||
YGCachedMeasurement cachedLayout = YGCachedMeasurement();
|
||||
|
||||
|
@@ -7,6 +7,21 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(__LP64__) && __LP64__
|
||||
# define YGFLOAT_TYPE double
|
||||
# define YGFLOAT_IS_DOUBLE 1
|
||||
# define YGFLOAT_MIN DBL_MIN
|
||||
# define YGFLOAT_MAX DBL_MAX
|
||||
#else
|
||||
# define YGFLOAT_TYPE float
|
||||
# define YGFLOAT_IS_DOUBLE 0
|
||||
# define YGFLOAT_MIN FLT_MIN
|
||||
# define YGFLOAT_MAX FLT_MAX
|
||||
#endif
|
||||
|
||||
typedef YGFLOAT_TYPE YGFloat;
|
||||
#define YGFLOAT_DEFINED 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define YG_EXTERN_CXX_BEGIN extern "C++" {
|
||||
#define YG_EXTERN_C_BEGIN extern "C" {
|
||||
|
@@ -52,7 +52,7 @@ void YGNode::print(void* printContext) {
|
||||
|
||||
YGFloatOptional YGNode::getLeadingPosition(
|
||||
const YGFlexDirection axis,
|
||||
const float axisSize) const {
|
||||
const YGFloat axisSize) const {
|
||||
if (YGFlexDirectionIsRow(axis)) {
|
||||
auto leadingPosition = YGComputedEdgeValue(
|
||||
style_.position(), YGEdgeStart, CompactValue::ofUndefined());
|
||||
@@ -71,7 +71,7 @@ YGFloatOptional YGNode::getLeadingPosition(
|
||||
|
||||
YGFloatOptional YGNode::getTrailingPosition(
|
||||
const YGFlexDirection axis,
|
||||
const float axisSize) const {
|
||||
const YGFloat axisSize) const {
|
||||
if (YGFlexDirectionIsRow(axis)) {
|
||||
auto trailingPosition = YGComputedEdgeValue(
|
||||
style_.position(), YGEdgeEnd, CompactValue::ofUndefined());
|
||||
@@ -110,7 +110,7 @@ bool YGNode::isTrailingPosDefined(const YGFlexDirection axis) const {
|
||||
|
||||
YGFloatOptional YGNode::getLeadingMargin(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const {
|
||||
const YGFloat widthSize) const {
|
||||
if (YGFlexDirectionIsRow(axis) &&
|
||||
!style_.margin()[YGEdgeStart].isUndefined()) {
|
||||
return YGResolveValueMargin(style_.margin()[YGEdgeStart], widthSize);
|
||||
@@ -124,7 +124,7 @@ YGFloatOptional YGNode::getLeadingMargin(
|
||||
|
||||
YGFloatOptional YGNode::getTrailingMargin(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const {
|
||||
const YGFloat widthSize) const {
|
||||
if (YGFlexDirectionIsRow(axis) && !style_.margin()[YGEdgeEnd].isUndefined()) {
|
||||
return YGResolveValueMargin(style_.margin()[YGEdgeEnd], widthSize);
|
||||
}
|
||||
@@ -137,14 +137,14 @@ YGFloatOptional YGNode::getTrailingMargin(
|
||||
|
||||
YGFloatOptional YGNode::getMarginForAxis(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const {
|
||||
const YGFloat widthSize) const {
|
||||
return getLeadingMargin(axis, widthSize) + getTrailingMargin(axis, widthSize);
|
||||
}
|
||||
|
||||
YGSize YGNode::measure(
|
||||
float width,
|
||||
YGFloat width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGFloat height,
|
||||
YGMeasureMode heightMode,
|
||||
void* layoutContext) {
|
||||
|
||||
@@ -154,7 +154,7 @@ YGSize YGNode::measure(
|
||||
: measure_.noContext(this, width, widthMode, height, heightMode);
|
||||
}
|
||||
|
||||
float YGNode::baseline(float width, float height, void* layoutContext) {
|
||||
YGFloat YGNode::baseline(YGFloat width, YGFloat height, void* layoutContext) {
|
||||
return facebook::yoga::detail::getBooleanData(flags, baselineUsesContext_)
|
||||
? baseline_.withContext(this, width, height, layoutContext)
|
||||
: baseline_.noContext(this, width, height);
|
||||
@@ -235,15 +235,15 @@ void YGNode::setLayoutDirection(YGDirection direction) {
|
||||
layout_.setDirection(direction);
|
||||
}
|
||||
|
||||
void YGNode::setLayoutMargin(float margin, int index) {
|
||||
void YGNode::setLayoutMargin(YGFloat margin, int index) {
|
||||
layout_.margin[index] = margin;
|
||||
}
|
||||
|
||||
void YGNode::setLayoutBorder(float border, int index) {
|
||||
void YGNode::setLayoutBorder(YGFloat border, int index) {
|
||||
layout_.border[index] = border;
|
||||
}
|
||||
|
||||
void YGNode::setLayoutPadding(float padding, int index) {
|
||||
void YGNode::setLayoutPadding(YGFloat padding, int index) {
|
||||
layout_.padding[index] = padding;
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ void YGNode::setLayoutComputedFlexBasis(
|
||||
layout_.computedFlexBasis = computedFlexBasis;
|
||||
}
|
||||
|
||||
void YGNode::setLayoutPosition(float position, int index) {
|
||||
void YGNode::setLayoutPosition(YGFloat position, int index) {
|
||||
layout_.position[index] = position;
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ void YGNode::setLayoutComputedFlexBasisGeneration(
|
||||
layout_.computedFlexBasisGeneration = computedFlexBasisGeneration;
|
||||
}
|
||||
|
||||
void YGNode::setLayoutMeasuredDimension(float measuredDimension, int index) {
|
||||
void YGNode::setLayoutMeasuredDimension(YGFloat measuredDimension, int index) {
|
||||
layout_.measuredDimensions[index] = measuredDimension;
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ void YGNode::setLayoutHadOverflow(bool hadOverflow) {
|
||||
layout_.setHadOverflow(hadOverflow);
|
||||
}
|
||||
|
||||
void YGNode::setLayoutDimension(float dimension, int index) {
|
||||
void YGNode::setLayoutDimension(YGFloat dimension, int index) {
|
||||
layout_.dimensions[index] = dimension;
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ void YGNode::setLayoutDimension(float dimension, int index) {
|
||||
// -right depending on which is defined.
|
||||
YGFloatOptional YGNode::relativePosition(
|
||||
const YGFlexDirection axis,
|
||||
const float axisSize) const {
|
||||
const YGFloat axisSize) const {
|
||||
if (isLeadingPositionDefined(axis)) {
|
||||
return getLeadingPosition(axis, axisSize);
|
||||
}
|
||||
@@ -295,9 +295,9 @@ YGFloatOptional YGNode::relativePosition(
|
||||
|
||||
void YGNode::setPosition(
|
||||
const YGDirection direction,
|
||||
const float mainSize,
|
||||
const float crossSize,
|
||||
const float ownerWidth) {
|
||||
const YGFloat mainSize,
|
||||
const YGFloat crossSize,
|
||||
const YGFloat ownerWidth) {
|
||||
/* Root nodes should be always layouted as LTR, so we don't return negative
|
||||
* values. */
|
||||
const YGDirection directionRespectingRoot =
|
||||
@@ -411,7 +411,7 @@ void YGNode::markDirtyAndPropogateDownwards() {
|
||||
});
|
||||
}
|
||||
|
||||
float YGNode::resolveFlexGrow() const {
|
||||
YGFloat YGNode::resolveFlexGrow() const {
|
||||
// Root nodes flexGrow should always be 0
|
||||
if (owner_ == nullptr) {
|
||||
return 0.0;
|
||||
@@ -425,7 +425,7 @@ float YGNode::resolveFlexGrow() const {
|
||||
return kDefaultFlexGrow;
|
||||
}
|
||||
|
||||
float YGNode::resolveFlexShrink() const {
|
||||
YGFloat YGNode::resolveFlexShrink() const {
|
||||
if (owner_ == nullptr) {
|
||||
return 0.0;
|
||||
}
|
||||
@@ -447,7 +447,7 @@ bool YGNode::isNodeFlexible() {
|
||||
(resolveFlexGrow() != 0 || resolveFlexShrink() != 0));
|
||||
}
|
||||
|
||||
float YGNode::getLeadingBorder(const YGFlexDirection axis) const {
|
||||
YGFloat YGNode::getLeadingBorder(const YGFlexDirection axis) const {
|
||||
YGValue leadingBorder;
|
||||
if (YGFlexDirectionIsRow(axis) &&
|
||||
!style_.border()[YGEdgeStart].isUndefined()) {
|
||||
@@ -462,7 +462,7 @@ float YGNode::getLeadingBorder(const YGFlexDirection axis) const {
|
||||
return YGFloatMax(leadingBorder.value, 0.0f);
|
||||
}
|
||||
|
||||
float YGNode::getTrailingBorder(const YGFlexDirection flexDirection) const {
|
||||
YGFloat YGNode::getTrailingBorder(const YGFlexDirection flexDirection) const {
|
||||
YGValue trailingBorder;
|
||||
if (YGFlexDirectionIsRow(flexDirection) &&
|
||||
!style_.border()[YGEdgeEnd].isUndefined()) {
|
||||
@@ -479,7 +479,7 @@ float YGNode::getTrailingBorder(const YGFlexDirection flexDirection) const {
|
||||
|
||||
YGFloatOptional YGNode::getLeadingPadding(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const {
|
||||
const YGFloat widthSize) const {
|
||||
const YGFloatOptional paddingEdgeStart =
|
||||
YGResolveValue(style_.padding()[YGEdgeStart], widthSize);
|
||||
if (YGFlexDirectionIsRow(axis) &&
|
||||
@@ -497,7 +497,7 @@ YGFloatOptional YGNode::getLeadingPadding(
|
||||
|
||||
YGFloatOptional YGNode::getTrailingPadding(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const {
|
||||
const YGFloat widthSize) const {
|
||||
const YGFloatOptional paddingEdgeEnd =
|
||||
YGResolveValue(style_.padding()[YGEdgeEnd], widthSize);
|
||||
if (YGFlexDirectionIsRow(axis) && paddingEdgeEnd >= YGFloatOptional{0.0f}) {
|
||||
@@ -514,14 +514,14 @@ YGFloatOptional YGNode::getTrailingPadding(
|
||||
|
||||
YGFloatOptional YGNode::getLeadingPaddingAndBorder(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const {
|
||||
const YGFloat widthSize) const {
|
||||
return getLeadingPadding(axis, widthSize) +
|
||||
YGFloatOptional(getLeadingBorder(axis));
|
||||
}
|
||||
|
||||
YGFloatOptional YGNode::getTrailingPaddingAndBorder(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const {
|
||||
const YGFloat widthSize) const {
|
||||
return getTrailingPadding(axis, widthSize) +
|
||||
YGFloatOptional(getTrailingBorder(axis));
|
||||
}
|
||||
|
@@ -23,8 +23,8 @@ YGConfigRef YGConfigGetDefault();
|
||||
|
||||
struct YOGA_EXPORT YGNode {
|
||||
using MeasureWithContextFn =
|
||||
YGSize (*)(YGNode*, float, YGMeasureMode, float, YGMeasureMode, void*);
|
||||
using BaselineWithContextFn = float (*)(YGNode*, float, float, void*);
|
||||
YGSize (*)(YGNode*, YGFloat, YGMeasureMode, YGFloat, YGMeasureMode, void*);
|
||||
using BaselineWithContextFn = YGFloat (*)(YGNode*, YGFloat, YGFloat, void*);
|
||||
using PrintWithContextFn = void (*)(YGNode*, void*);
|
||||
|
||||
private:
|
||||
@@ -64,7 +64,7 @@ private:
|
||||
|
||||
YGFloatOptional relativePosition(
|
||||
const YGFlexDirection axis,
|
||||
const float axisSize) const;
|
||||
const YGFloat axisSize) const;
|
||||
|
||||
void setMeasureFunc(decltype(measure_));
|
||||
void setBaselineFunc(decltype(baseline_));
|
||||
@@ -124,13 +124,13 @@ public:
|
||||
|
||||
bool hasMeasureFunc() const noexcept { return measure_.noContext != nullptr; }
|
||||
|
||||
YGSize measure(float, YGMeasureMode, float, YGMeasureMode, void*);
|
||||
YGSize measure(YGFloat, YGMeasureMode, YGFloat, YGMeasureMode, void*);
|
||||
|
||||
bool hasBaselineFunc() const noexcept {
|
||||
return baseline_.noContext != nullptr;
|
||||
}
|
||||
|
||||
float baseline(float width, float height, void* layoutContext);
|
||||
YGFloat baseline(YGFloat width, YGFloat height, void* layoutContext);
|
||||
|
||||
YGDirtiedFunc getDirtied() const { return dirtied_; }
|
||||
|
||||
@@ -196,35 +196,35 @@ public:
|
||||
// Methods related to positions, margin, padding and border
|
||||
YGFloatOptional getLeadingPosition(
|
||||
const YGFlexDirection axis,
|
||||
const float axisSize) const;
|
||||
const YGFloat axisSize) const;
|
||||
bool isLeadingPositionDefined(const YGFlexDirection axis) const;
|
||||
bool isTrailingPosDefined(const YGFlexDirection axis) const;
|
||||
YGFloatOptional getTrailingPosition(
|
||||
const YGFlexDirection axis,
|
||||
const float axisSize) const;
|
||||
const YGFloat axisSize) const;
|
||||
YGFloatOptional getLeadingMargin(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const;
|
||||
const YGFloat widthSize) const;
|
||||
YGFloatOptional getTrailingMargin(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const;
|
||||
float getLeadingBorder(const YGFlexDirection flexDirection) const;
|
||||
float getTrailingBorder(const YGFlexDirection flexDirection) const;
|
||||
const YGFloat widthSize) const;
|
||||
YGFloat getLeadingBorder(const YGFlexDirection flexDirection) const;
|
||||
YGFloat getTrailingBorder(const YGFlexDirection flexDirection) const;
|
||||
YGFloatOptional getLeadingPadding(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const;
|
||||
const YGFloat widthSize) const;
|
||||
YGFloatOptional getTrailingPadding(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const;
|
||||
const YGFloat widthSize) const;
|
||||
YGFloatOptional getLeadingPaddingAndBorder(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const;
|
||||
const YGFloat widthSize) const;
|
||||
YGFloatOptional getTrailingPaddingAndBorder(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const;
|
||||
const YGFloat widthSize) const;
|
||||
YGFloatOptional getMarginForAxis(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const;
|
||||
const YGFloat widthSize) const;
|
||||
// Setters
|
||||
|
||||
void setContext(void* context) { context_ = context; }
|
||||
@@ -292,19 +292,19 @@ public:
|
||||
void setLayoutComputedFlexBasis(const YGFloatOptional computedFlexBasis);
|
||||
void setLayoutComputedFlexBasisGeneration(
|
||||
uint32_t computedFlexBasisGeneration);
|
||||
void setLayoutMeasuredDimension(float measuredDimension, int index);
|
||||
void setLayoutMeasuredDimension(YGFloat measuredDimension, int index);
|
||||
void setLayoutHadOverflow(bool hadOverflow);
|
||||
void setLayoutDimension(float dimension, int index);
|
||||
void setLayoutDimension(YGFloat dimension, int index);
|
||||
void setLayoutDirection(YGDirection direction);
|
||||
void setLayoutMargin(float margin, int index);
|
||||
void setLayoutBorder(float border, int index);
|
||||
void setLayoutPadding(float padding, int index);
|
||||
void setLayoutPosition(float position, int index);
|
||||
void setLayoutMargin(YGFloat margin, int index);
|
||||
void setLayoutBorder(YGFloat border, int index);
|
||||
void setLayoutPadding(YGFloat padding, int index);
|
||||
void setLayoutPosition(YGFloat position, int index);
|
||||
void setPosition(
|
||||
const YGDirection direction,
|
||||
const float mainSize,
|
||||
const float crossSize,
|
||||
const float ownerWidth);
|
||||
const YGFloat mainSize,
|
||||
const YGFloat crossSize,
|
||||
const YGFloat ownerWidth);
|
||||
void setLayoutDoesLegacyFlagAffectsLayout(bool doesLegacyFlagAffectsLayout);
|
||||
void setLayoutDidUseLegacyFlag(bool didUseLegacyFlag);
|
||||
void markDirtyAndPropogateDownwards();
|
||||
@@ -326,8 +326,8 @@ public:
|
||||
|
||||
void cloneChildrenIfNeeded(void*);
|
||||
void markDirtyAndPropogate();
|
||||
float resolveFlexGrow() const;
|
||||
float resolveFlexShrink() const;
|
||||
YGFloat resolveFlexGrow() const;
|
||||
YGFloat resolveFlexShrink() const;
|
||||
bool isNodeFlexible();
|
||||
bool didUseLegacyFlag();
|
||||
bool isLayoutTreeEqualToNode(const YGNode& node) const;
|
||||
|
@@ -25,7 +25,7 @@ YG_EXTERN_C_BEGIN
|
||||
// Not defined in MSVC++
|
||||
#ifndef NAN
|
||||
static const uint32_t __nan = 0x7fc00000;
|
||||
#define NAN (*(const float*) __nan)
|
||||
#define NAN (*(const YGFloat*) __nan)
|
||||
#endif
|
||||
|
||||
#define YGUndefined NAN
|
||||
|
@@ -19,8 +19,8 @@ YG_EXTERN_C_BEGIN
|
||||
|
||||
void YGNodeCalculateLayoutWithContext(
|
||||
YGNodeRef node,
|
||||
float availableWidth,
|
||||
float availableHeight,
|
||||
YGFloat availableWidth,
|
||||
YGFloat availableHeight,
|
||||
YGDirection ownerDirection,
|
||||
void* layoutContext);
|
||||
|
||||
@@ -29,7 +29,7 @@ YG_EXTERN_C_END
|
||||
namespace facebook {
|
||||
namespace yoga {
|
||||
|
||||
inline bool isUndefined(float value) {
|
||||
inline bool isUndefined(YGFloat value) {
|
||||
return std::isnan(value);
|
||||
}
|
||||
|
||||
@@ -45,13 +45,13 @@ extern const YGValue YGValueAuto;
|
||||
extern const YGValue YGValueZero;
|
||||
|
||||
struct YGCachedMeasurement {
|
||||
float availableWidth;
|
||||
float availableHeight;
|
||||
YGFloat availableWidth;
|
||||
YGFloat availableHeight;
|
||||
YGMeasureMode widthMeasureMode;
|
||||
YGMeasureMode heightMeasureMode;
|
||||
|
||||
float computedWidth;
|
||||
float computedHeight;
|
||||
YGFloat computedWidth;
|
||||
YGFloat computedHeight;
|
||||
|
||||
YGCachedMeasurement()
|
||||
: availableWidth(-1),
|
||||
@@ -139,11 +139,11 @@ public:
|
||||
} // namespace yoga
|
||||
} // namespace facebook
|
||||
|
||||
static const float kDefaultFlexGrow = 0.0f;
|
||||
static const float kDefaultFlexShrink = 0.0f;
|
||||
static const float kWebDefaultFlexShrink = 1.0f;
|
||||
static const YGFloat kDefaultFlexGrow = 0.0f;
|
||||
static const YGFloat kDefaultFlexShrink = 0.0f;
|
||||
static const YGFloat kWebDefaultFlexShrink = 1.0f;
|
||||
|
||||
extern bool YGFloatsEqual(const float a, const float b);
|
||||
extern bool YGFloatsEqual(const YGFloat a, const YGFloat b);
|
||||
extern facebook::yoga::detail::CompactValue YGComputedEdgeValue(
|
||||
const facebook::yoga::detail::Values<
|
||||
facebook::yoga::enums::count<YGEdge>()>& edges,
|
||||
|
492
yoga/Yoga.cpp
492
yoga/Yoga.cpp
File diff suppressed because it is too large
Load Diff
114
yoga/Yoga.h
114
yoga/Yoga.h
@@ -25,8 +25,8 @@
|
||||
YG_EXTERN_C_BEGIN
|
||||
|
||||
typedef struct YGSize {
|
||||
float width;
|
||||
float height;
|
||||
YGFloat width;
|
||||
YGFloat height;
|
||||
} YGSize;
|
||||
|
||||
typedef struct YGConfig* YGConfigRef;
|
||||
@@ -36,11 +36,11 @@ typedef const struct YGNode* YGNodeConstRef;
|
||||
|
||||
typedef YGSize (*YGMeasureFunc)(
|
||||
YGNodeRef node,
|
||||
float width,
|
||||
YGFloat width,
|
||||
YGMeasureMode widthMode,
|
||||
float height,
|
||||
YGFloat height,
|
||||
YGMeasureMode heightMode);
|
||||
typedef float (*YGBaselineFunc)(YGNodeRef node, float width, float height);
|
||||
typedef YGFloat (*YGBaselineFunc)(YGNodeRef node, YGFloat width, YGFloat height);
|
||||
typedef void (*YGDirtiedFunc)(YGNodeRef node);
|
||||
typedef void (*YGPrintFunc)(YGNodeRef node);
|
||||
typedef void (*YGNodeCleanupFunc)(YGNodeRef node);
|
||||
@@ -93,8 +93,8 @@ WIN_EXPORT bool YGNodeIsReferenceBaseline(YGNodeRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeCalculateLayout(
|
||||
YGNodeRef node,
|
||||
float availableWidth,
|
||||
float availableHeight,
|
||||
YGFloat availableWidth,
|
||||
YGFloat availableHeight,
|
||||
YGDirection ownerDirection);
|
||||
|
||||
// Mark a node as dirty. Only valid for nodes with a custom measure function
|
||||
@@ -113,21 +113,21 @@ WIN_EXPORT void YGNodeMarkDirtyAndPropogateToDescendants(YGNodeRef node);
|
||||
|
||||
WIN_EXPORT void YGNodePrint(YGNodeRef node, YGPrintOptions options);
|
||||
|
||||
WIN_EXPORT bool YGFloatIsUndefined(float value);
|
||||
WIN_EXPORT bool YGFloatIsUndefined(YGFloat value);
|
||||
|
||||
WIN_EXPORT bool YGNodeCanUseCachedMeasurement(
|
||||
YGMeasureMode widthMode,
|
||||
float width,
|
||||
YGFloat width,
|
||||
YGMeasureMode heightMode,
|
||||
float height,
|
||||
YGFloat height,
|
||||
YGMeasureMode lastWidthMode,
|
||||
float lastWidth,
|
||||
YGFloat lastWidth,
|
||||
YGMeasureMode lastHeightMode,
|
||||
float lastHeight,
|
||||
float lastComputedWidth,
|
||||
float lastComputedHeight,
|
||||
float marginRow,
|
||||
float marginColumn,
|
||||
YGFloat lastHeight,
|
||||
YGFloat lastComputedWidth,
|
||||
YGFloat lastComputedHeight,
|
||||
YGFloat marginRow,
|
||||
YGFloat marginColumn,
|
||||
YGConfigRef config);
|
||||
|
||||
WIN_EXPORT void YGNodeCopyStyle(YGNodeRef dstNode, YGNodeRef srcNode);
|
||||
@@ -187,75 +187,75 @@ WIN_EXPORT YGOverflow YGNodeStyleGetOverflow(YGNodeConstRef node);
|
||||
WIN_EXPORT void YGNodeStyleSetDisplay(YGNodeRef node, YGDisplay display);
|
||||
WIN_EXPORT YGDisplay YGNodeStyleGetDisplay(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetFlex(YGNodeRef node, float flex);
|
||||
WIN_EXPORT float YGNodeStyleGetFlex(YGNodeConstRef node);
|
||||
WIN_EXPORT void YGNodeStyleSetFlex(YGNodeRef node, YGFloat flex);
|
||||
WIN_EXPORT YGFloat YGNodeStyleGetFlex(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetFlexGrow(YGNodeRef node, float flexGrow);
|
||||
WIN_EXPORT float YGNodeStyleGetFlexGrow(YGNodeConstRef node);
|
||||
WIN_EXPORT void YGNodeStyleSetFlexGrow(YGNodeRef node, YGFloat flexGrow);
|
||||
WIN_EXPORT YGFloat YGNodeStyleGetFlexGrow(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetFlexShrink(YGNodeRef node, float flexShrink);
|
||||
WIN_EXPORT float YGNodeStyleGetFlexShrink(YGNodeConstRef node);
|
||||
WIN_EXPORT void YGNodeStyleSetFlexShrink(YGNodeRef node, YGFloat flexShrink);
|
||||
WIN_EXPORT YGFloat YGNodeStyleGetFlexShrink(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetFlexBasis(YGNodeRef node, float flexBasis);
|
||||
WIN_EXPORT void YGNodeStyleSetFlexBasisPercent(YGNodeRef node, float flexBasis);
|
||||
WIN_EXPORT void YGNodeStyleSetFlexBasis(YGNodeRef node, YGFloat flexBasis);
|
||||
WIN_EXPORT void YGNodeStyleSetFlexBasisPercent(YGNodeRef node, YGFloat flexBasis);
|
||||
WIN_EXPORT void YGNodeStyleSetFlexBasisAuto(YGNodeRef node);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetFlexBasis(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetPosition(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float position);
|
||||
YGFloat position);
|
||||
WIN_EXPORT void YGNodeStyleSetPositionPercent(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float position);
|
||||
YGFloat position);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetPosition(YGNodeConstRef node, YGEdge edge);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetMargin(YGNodeRef node, YGEdge edge, float margin);
|
||||
WIN_EXPORT void YGNodeStyleSetMargin(YGNodeRef node, YGEdge edge, YGFloat margin);
|
||||
WIN_EXPORT void YGNodeStyleSetMarginPercent(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float margin);
|
||||
YGFloat margin);
|
||||
WIN_EXPORT void YGNodeStyleSetMarginAuto(YGNodeRef node, YGEdge edge);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetMargin(YGNodeConstRef node, YGEdge edge);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetPadding(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float padding);
|
||||
YGFloat padding);
|
||||
WIN_EXPORT void YGNodeStyleSetPaddingPercent(
|
||||
YGNodeRef node,
|
||||
YGEdge edge,
|
||||
float padding);
|
||||
YGFloat padding);
|
||||
WIN_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);
|
||||
WIN_EXPORT void YGNodeStyleSetBorder(YGNodeRef node, YGEdge edge, YGFloat border);
|
||||
WIN_EXPORT YGFloat YGNodeStyleGetBorder(YGNodeConstRef node, YGEdge edge);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetWidth(YGNodeRef node, float width);
|
||||
WIN_EXPORT void YGNodeStyleSetWidthPercent(YGNodeRef node, float width);
|
||||
WIN_EXPORT void YGNodeStyleSetWidth(YGNodeRef node, YGFloat width);
|
||||
WIN_EXPORT void YGNodeStyleSetWidthPercent(YGNodeRef node, YGFloat width);
|
||||
WIN_EXPORT void YGNodeStyleSetWidthAuto(YGNodeRef node);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetWidth(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetHeight(YGNodeRef node, float height);
|
||||
WIN_EXPORT void YGNodeStyleSetHeightPercent(YGNodeRef node, float height);
|
||||
WIN_EXPORT void YGNodeStyleSetHeight(YGNodeRef node, YGFloat height);
|
||||
WIN_EXPORT void YGNodeStyleSetHeightPercent(YGNodeRef node, YGFloat height);
|
||||
WIN_EXPORT void YGNodeStyleSetHeightAuto(YGNodeRef node);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetHeight(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetMinWidth(YGNodeRef node, float minWidth);
|
||||
WIN_EXPORT void YGNodeStyleSetMinWidthPercent(YGNodeRef node, float minWidth);
|
||||
WIN_EXPORT void YGNodeStyleSetMinWidth(YGNodeRef node, YGFloat minWidth);
|
||||
WIN_EXPORT void YGNodeStyleSetMinWidthPercent(YGNodeRef node, YGFloat minWidth);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetMinWidth(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetMinHeight(YGNodeRef node, float minHeight);
|
||||
WIN_EXPORT void YGNodeStyleSetMinHeightPercent(YGNodeRef node, float minHeight);
|
||||
WIN_EXPORT void YGNodeStyleSetMinHeight(YGNodeRef node, YGFloat minHeight);
|
||||
WIN_EXPORT void YGNodeStyleSetMinHeightPercent(YGNodeRef node, YGFloat minHeight);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetMinHeight(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetMaxWidth(YGNodeRef node, float maxWidth);
|
||||
WIN_EXPORT void YGNodeStyleSetMaxWidthPercent(YGNodeRef node, float maxWidth);
|
||||
WIN_EXPORT void YGNodeStyleSetMaxWidth(YGNodeRef node, YGFloat maxWidth);
|
||||
WIN_EXPORT void YGNodeStyleSetMaxWidthPercent(YGNodeRef node, YGFloat maxWidth);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetMaxWidth(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT void YGNodeStyleSetMaxHeight(YGNodeRef node, float maxHeight);
|
||||
WIN_EXPORT void YGNodeStyleSetMaxHeightPercent(YGNodeRef node, float maxHeight);
|
||||
WIN_EXPORT void YGNodeStyleSetMaxHeight(YGNodeRef node, YGFloat maxHeight);
|
||||
WIN_EXPORT void YGNodeStyleSetMaxHeightPercent(YGNodeRef node, YGFloat maxHeight);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetMaxHeight(YGNodeConstRef node);
|
||||
|
||||
// Yoga specific properties, not compatible with flexbox specification Aspect
|
||||
@@ -273,15 +273,15 @@ 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);
|
||||
WIN_EXPORT void YGNodeStyleSetAspectRatio(YGNodeRef node, YGFloat aspectRatio);
|
||||
WIN_EXPORT YGFloat YGNodeStyleGetAspectRatio(YGNodeConstRef node);
|
||||
|
||||
WIN_EXPORT float YGNodeLayoutGetLeft(YGNodeRef node);
|
||||
WIN_EXPORT float YGNodeLayoutGetTop(YGNodeRef node);
|
||||
WIN_EXPORT float YGNodeLayoutGetRight(YGNodeRef node);
|
||||
WIN_EXPORT float YGNodeLayoutGetBottom(YGNodeRef node);
|
||||
WIN_EXPORT float YGNodeLayoutGetWidth(YGNodeRef node);
|
||||
WIN_EXPORT float YGNodeLayoutGetHeight(YGNodeRef node);
|
||||
WIN_EXPORT YGFloat YGNodeLayoutGetLeft(YGNodeRef node);
|
||||
WIN_EXPORT YGFloat YGNodeLayoutGetTop(YGNodeRef node);
|
||||
WIN_EXPORT YGFloat YGNodeLayoutGetRight(YGNodeRef node);
|
||||
WIN_EXPORT YGFloat YGNodeLayoutGetBottom(YGNodeRef node);
|
||||
WIN_EXPORT YGFloat YGNodeLayoutGetWidth(YGNodeRef node);
|
||||
WIN_EXPORT YGFloat YGNodeLayoutGetHeight(YGNodeRef node);
|
||||
WIN_EXPORT YGDirection YGNodeLayoutGetDirection(YGNodeRef node);
|
||||
WIN_EXPORT bool YGNodeLayoutGetHadOverflow(YGNodeRef node);
|
||||
bool YGNodeLayoutGetDidLegacyStretchFlagAffectLayout(YGNodeRef node);
|
||||
@@ -290,9 +290,9 @@ bool YGNodeLayoutGetDidLegacyStretchFlagAffectLayout(YGNodeRef node);
|
||||
// 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(YGNodeRef node, YGEdge edge);
|
||||
WIN_EXPORT float YGNodeLayoutGetBorder(YGNodeRef node, YGEdge edge);
|
||||
WIN_EXPORT float YGNodeLayoutGetPadding(YGNodeRef node, YGEdge edge);
|
||||
WIN_EXPORT YGFloat YGNodeLayoutGetMargin(YGNodeRef node, YGEdge edge);
|
||||
WIN_EXPORT YGFloat YGNodeLayoutGetBorder(YGNodeRef node, YGEdge edge);
|
||||
WIN_EXPORT YGFloat YGNodeLayoutGetPadding(YGNodeRef node, YGEdge edge);
|
||||
|
||||
WIN_EXPORT void YGConfigSetLogger(YGConfigRef config, YGLogger logger);
|
||||
WIN_EXPORT void YGAssert(bool condition, const char* message);
|
||||
@@ -308,7 +308,7 @@ WIN_EXPORT void YGAssertWithConfig(
|
||||
// want to avoid rounding - set PointScaleFactor to 0
|
||||
WIN_EXPORT void YGConfigSetPointScaleFactor(
|
||||
YGConfigRef config,
|
||||
float pixelsInPoint);
|
||||
YGFloat pixelsInPoint);
|
||||
void YGConfigSetShouldDiffLayoutWithoutLegacyStretchBehaviour(
|
||||
YGConfigRef config,
|
||||
bool shouldDiffLayout);
|
||||
@@ -351,7 +351,7 @@ WIN_EXPORT YGConfigRef YGConfigGetDefault(void);
|
||||
WIN_EXPORT void YGConfigSetContext(YGConfigRef config, void* context);
|
||||
WIN_EXPORT void* YGConfigGetContext(YGConfigRef config);
|
||||
|
||||
WIN_EXPORT float YGRoundValueToPixelGrid(
|
||||
WIN_EXPORT YGFloat YGRoundValueToPixelGrid(
|
||||
double value,
|
||||
double pointScaleFactor,
|
||||
bool forceCeil,
|
||||
|
@@ -127,12 +127,12 @@ struct Event::TypedData<Event::LayoutPassEnd> {
|
||||
template <>
|
||||
struct Event::TypedData<Event::MeasureCallbackEnd> {
|
||||
void* layoutContext;
|
||||
float width;
|
||||
YGFloat width;
|
||||
YGMeasureMode widthMeasureMode;
|
||||
float height;
|
||||
YGFloat height;
|
||||
YGMeasureMode heightMeasureMode;
|
||||
float measuredWidth;
|
||||
float measuredHeight;
|
||||
YGFloat measuredWidth;
|
||||
YGFloat measuredHeight;
|
||||
const LayoutPassReason reason;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user