mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-28 20:25:33 +08:00
Add feature to use percentage as value unit
Summary: Adds the feature to use percentage as a value unit. You can use the function ```YGPx(float)``` and ```YGPercent(float)``` for convenience. I did some benchmarks: ``` Without Percentage Feature - Release x86: Stack with flex: median: 0.000000 ms, stddev: 0.146683 ms Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms Nested flex: median: 0.000000 ms, stddev: 0.490101 ms Huge nested layout: median: 23.000000 ms, stddev: 0.928291 ms Stack with flex: median: 0.000000 ms, stddev: 0.170587 ms Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.143384 ms Nested flex: median: 0.000000 ms, stddev: 0.477791 ms Huge nested layout: median: 22.000000 ms, stddev: 2.129779 ms With Percentage Feature - Release x86: Stack with flex: median: 0.000000 ms, stddev: 0.132951 ms Align stretch in undefined axis: median: 0.000000 ms, stddev: 0.136525 ms Nested flex: median: 0.000000 ms, stddev: 0.489570 ms Huge nested layout: median: 21.000000 ms, stddev: 1.390476 ms Closes https://github.com/facebook/yoga/pull/258 Reviewed By: dshahidehpour Differential Revision: D4361945 Pulled By: emilsjolander fbshipit-source-id: a8f5bc63ad352eb9410d792729e56664468cd76a
This commit is contained in:
committed by
Facebook Github Bot
parent
d625a72f63
commit
16359ec8ee
@@ -165,8 +165,8 @@
|
|||||||
|
|
||||||
- (void)testDoesNotAssignSuggestedDimensionsWhenStyledWithFlexAttribute
|
- (void)testDoesNotAssignSuggestedDimensionsWhenStyledWithFlexAttribute
|
||||||
{
|
{
|
||||||
float parentWidth = YGNodeStyleGetWidth(self.parentView.cssNode);
|
float parentWidth = YGNodeStyleGetWidth(self.parentView.cssNode).value;
|
||||||
float parentHeight = YGNodeStyleGetHeight(self.parentView.cssNode);
|
float parentHeight = YGNodeStyleGetHeight(self.parentView.cssNode).value;
|
||||||
[self _withShadowViewWithStyle:^(YGNodeRef node) {
|
[self _withShadowViewWithStyle:^(YGNodeRef node) {
|
||||||
YGNodeStyleSetFlex(node, 1);
|
YGNodeStyleSetFlex(node, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,9 +161,9 @@ static YGSize RCTMeasure(YGNodeRef node, float width, YGMeasureMode widthMode, f
|
|||||||
[layoutManager.textStorage enumerateAttribute:RCTShadowViewAttributeName inRange:characterRange options:0 usingBlock:^(RCTShadowView *child, NSRange range, BOOL *_) {
|
[layoutManager.textStorage enumerateAttribute:RCTShadowViewAttributeName inRange:characterRange options:0 usingBlock:^(RCTShadowView *child, NSRange range, BOOL *_) {
|
||||||
if (child) {
|
if (child) {
|
||||||
YGNodeRef childNode = child.cssNode;
|
YGNodeRef childNode = child.cssNode;
|
||||||
float width = YGNodeStyleGetWidth(childNode);
|
float width = YGNodeStyleGetWidth(childNode).value;
|
||||||
float height = YGNodeStyleGetHeight(childNode);
|
float height = YGNodeStyleGetHeight(childNode).value;
|
||||||
if (YGValueIsUndefined(width) || YGValueIsUndefined(height)) {
|
if (YGFloatIsUndefined(width) || YGFloatIsUndefined(height)) {
|
||||||
RCTLogError(@"Views nested within a <Text> must have a width and height");
|
RCTLogError(@"Views nested within a <Text> must have a width and height");
|
||||||
}
|
}
|
||||||
UIFont *font = [textStorage attribute:NSFontAttributeName atIndex:range.location effectiveRange:nil];
|
UIFont *font = [textStorage attribute:NSFontAttributeName atIndex:range.location effectiveRange:nil];
|
||||||
@@ -307,9 +307,9 @@ static YGSize RCTMeasure(YGNodeRef node, float width, YGMeasureMode widthMode, f
|
|||||||
[attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:shadowRawText.text ?: @""]];
|
[attributedString appendAttributedString:[[NSAttributedString alloc] initWithString:shadowRawText.text ?: @""]];
|
||||||
[child setTextComputed];
|
[child setTextComputed];
|
||||||
} else {
|
} else {
|
||||||
float width = YGNodeStyleGetWidth(child.cssNode);
|
float width = YGNodeStyleGetWidth(child.cssNode).value;
|
||||||
float height = YGNodeStyleGetHeight(child.cssNode);
|
float height = YGNodeStyleGetHeight(child.cssNode).value;
|
||||||
if (YGValueIsUndefined(width) || YGValueIsUndefined(height)) {
|
if (YGFloatIsUndefined(width) || YGFloatIsUndefined(height)) {
|
||||||
RCTLogError(@"Views nested within a <Text> must have a width and height");
|
RCTLogError(@"Views nested within a <Text> must have a width and height");
|
||||||
}
|
}
|
||||||
NSTextAttachment *attachment = [NSTextAttachment new];
|
NSTextAttachment *attachment = [NSTextAttachment new];
|
||||||
|
|||||||
@@ -59,41 +59,41 @@ static void RCTPrint(YGNodeRef node)
|
|||||||
// Enforces precedence rules, e.g. marginLeft > marginHorizontal > margin.
|
// Enforces precedence rules, e.g. marginLeft > marginHorizontal > margin.
|
||||||
#define DEFINE_PROCESS_META_PROPS(type) \
|
#define DEFINE_PROCESS_META_PROPS(type) \
|
||||||
static void RCTProcessMetaProps##type(const float metaProps[META_PROP_COUNT], YGNodeRef node) { \
|
static void RCTProcessMetaProps##type(const float metaProps[META_PROP_COUNT], YGNodeRef node) { \
|
||||||
if (!YGValueIsUndefined(metaProps[META_PROP_LEFT])) { \
|
if (!YGFloatIsUndefined(metaProps[META_PROP_LEFT])) { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_LEFT]); \
|
YGNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_LEFT]); \
|
||||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_HORIZONTAL])) { \
|
} else if (!YGFloatIsUndefined(metaProps[META_PROP_HORIZONTAL])) { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_HORIZONTAL]); \
|
YGNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_HORIZONTAL]); \
|
||||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
} else if (!YGFloatIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_ALL]); \
|
YGNodeStyleSet##type(node, YGEdgeStart, metaProps[META_PROP_ALL]); \
|
||||||
} else { \
|
} else { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeStart, 0); \
|
YGNodeStyleSet##type(node, YGEdgeStart, 0); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (!YGValueIsUndefined(metaProps[META_PROP_RIGHT])) { \
|
if (!YGFloatIsUndefined(metaProps[META_PROP_RIGHT])) { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_RIGHT]); \
|
YGNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_RIGHT]); \
|
||||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_HORIZONTAL])) { \
|
} else if (!YGFloatIsUndefined(metaProps[META_PROP_HORIZONTAL])) { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_HORIZONTAL]); \
|
YGNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_HORIZONTAL]); \
|
||||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
} else if (!YGFloatIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_ALL]); \
|
YGNodeStyleSet##type(node, YGEdgeEnd, metaProps[META_PROP_ALL]); \
|
||||||
} else { \
|
} else { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeEnd, 0); \
|
YGNodeStyleSet##type(node, YGEdgeEnd, 0); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (!YGValueIsUndefined(metaProps[META_PROP_TOP])) { \
|
if (!YGFloatIsUndefined(metaProps[META_PROP_TOP])) { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_TOP]); \
|
YGNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_TOP]); \
|
||||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_VERTICAL])) { \
|
} else if (!YGFloatIsUndefined(metaProps[META_PROP_VERTICAL])) { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_VERTICAL]); \
|
YGNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_VERTICAL]); \
|
||||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
} else if (!YGFloatIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_ALL]); \
|
YGNodeStyleSet##type(node, YGEdgeTop, metaProps[META_PROP_ALL]); \
|
||||||
} else { \
|
} else { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeTop, 0); \
|
YGNodeStyleSet##type(node, YGEdgeTop, 0); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (!YGValueIsUndefined(metaProps[META_PROP_BOTTOM])) { \
|
if (!YGFloatIsUndefined(metaProps[META_PROP_BOTTOM])) { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_BOTTOM]); \
|
YGNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_BOTTOM]); \
|
||||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_VERTICAL])) { \
|
} else if (!YGFloatIsUndefined(metaProps[META_PROP_VERTICAL])) { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_VERTICAL]); \
|
YGNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_VERTICAL]); \
|
||||||
} else if (!YGValueIsUndefined(metaProps[META_PROP_ALL])) { \
|
} else if (!YGFloatIsUndefined(metaProps[META_PROP_ALL])) { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_ALL]); \
|
YGNodeStyleSet##type(node, YGEdgeBottom, metaProps[META_PROP_ALL]); \
|
||||||
} else { \
|
} else { \
|
||||||
YGNodeStyleSet##type(node, YGEdgeBottom, 0); \
|
YGNodeStyleSet##type(node, YGEdgeBottom, 0); \
|
||||||
@@ -145,9 +145,9 @@ DEFINE_PROCESS_META_PROPS(Border);
|
|||||||
#if RCT_DEBUG
|
#if RCT_DEBUG
|
||||||
// This works around a breaking change in css-layout where setting flexBasis needs to be set explicitly, instead of relying on flex to propagate.
|
// This works around a breaking change in css-layout where setting flexBasis needs to be set explicitly, instead of relying on flex to propagate.
|
||||||
// We check for it by seeing if a width/height is provided along with a flexBasis of 0 and the width/height is laid out as 0.
|
// We check for it by seeing if a width/height is provided along with a flexBasis of 0 and the width/height is laid out as 0.
|
||||||
if ((!YGValueIsUndefined(YGNodeStyleGetFlexBasis(node)) && YGNodeStyleGetFlexBasis(node) == 0) &&
|
if ((YGNodeStyleGetFlexBasis(node).unit == YGUnitPixel && YGNodeStyleGetFlexBasis(node).value == 0) &&
|
||||||
((!YGValueIsUndefined(YGNodeStyleGetWidth(node)) && YGNodeStyleGetWidth(node) > 0 && YGNodeLayoutGetWidth(node) == 0) ||
|
((YGNodeStyleGetWidth(node).unit == YGUnitPixel && YGNodeStyleGetWidth(node).value > 0 && YGNodeLayoutGetWidth(node) == 0) ||
|
||||||
(!YGValueIsUndefined(YGNodeStyleGetHeight(node)) && YGNodeStyleGetHeight(node) > 0 && YGNodeLayoutGetHeight(node) == 0))) {
|
(YGNodeStyleGetHeight(node).unit == YGUnitPixel && YGNodeStyleGetHeight(node).value > 0 && YGNodeLayoutGetHeight(node) == 0))) {
|
||||||
RCTLogError(@"View was rendered with explicitly set width/height but with a 0 flexBasis. (This might be fixed by changing flex: to flexGrow:) View: %@", self);
|
RCTLogError(@"View was rendered with explicitly set width/height but with a 0 flexBasis. (This might be fixed by changing flex: to flexGrow:) View: %@", self);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -493,25 +493,25 @@ RCT_PADDING_PROPERTY(Right, RIGHT)
|
|||||||
{
|
{
|
||||||
if (YGNodeLayoutGetDirection(_cssNode) == YGDirectionRTL) {
|
if (YGNodeLayoutGetDirection(_cssNode) == YGDirectionRTL) {
|
||||||
return (UIEdgeInsets){
|
return (UIEdgeInsets){
|
||||||
YGNodeStyleGetPadding(_cssNode, YGEdgeTop),
|
YGNodeStyleGetPadding(_cssNode, YGEdgeTop).value,
|
||||||
!YGValueIsUndefined(YGNodeStyleGetPadding(_cssNode, YGEdgeEnd)) ?
|
YGNodeStyleGetPadding(_cssNode, YGEdgeEnd).unit == YGUnitPixel ?
|
||||||
YGNodeStyleGetPadding(_cssNode, YGEdgeEnd) :
|
YGNodeStyleGetPadding(_cssNode, YGEdgeEnd).value :
|
||||||
YGNodeStyleGetPadding(_cssNode, YGEdgeLeft),
|
YGNodeStyleGetPadding(_cssNode, YGEdgeLeft).value,
|
||||||
YGNodeStyleGetPadding(_cssNode, YGEdgeBottom),
|
YGNodeStyleGetPadding(_cssNode, YGEdgeBottom).value,
|
||||||
!YGValueIsUndefined(YGNodeStyleGetPadding(_cssNode, YGEdgeStart)) ?
|
YGNodeStyleGetPadding(_cssNode, YGEdgeStart).unit == YGUnitPixel ?
|
||||||
YGNodeStyleGetPadding(_cssNode, YGEdgeStart) :
|
YGNodeStyleGetPadding(_cssNode, YGEdgeStart).value :
|
||||||
YGNodeStyleGetPadding(_cssNode, YGEdgeRight)
|
YGNodeStyleGetPadding(_cssNode, YGEdgeRight).value
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return (UIEdgeInsets){
|
return (UIEdgeInsets){
|
||||||
YGNodeStyleGetPadding(_cssNode, YGEdgeTop),
|
YGNodeStyleGetPadding(_cssNode, YGEdgeTop).value,
|
||||||
!YGValueIsUndefined(YGNodeStyleGetPadding(_cssNode, YGEdgeStart)) ?
|
YGNodeStyleGetPadding(_cssNode, YGEdgeStart).unit == YGUnitPixel ?
|
||||||
YGNodeStyleGetPadding(_cssNode, YGEdgeStart) :
|
YGNodeStyleGetPadding(_cssNode, YGEdgeStart).value :
|
||||||
YGNodeStyleGetPadding(_cssNode, YGEdgeLeft),
|
YGNodeStyleGetPadding(_cssNode, YGEdgeLeft).value,
|
||||||
YGNodeStyleGetPadding(_cssNode, YGEdgeBottom),
|
YGNodeStyleGetPadding(_cssNode, YGEdgeBottom).value,
|
||||||
!YGValueIsUndefined(YGNodeStyleGetPadding(_cssNode, YGEdgeEnd)) ?
|
YGNodeStyleGetPadding(_cssNode, YGEdgeEnd).unit == YGUnitPixel ?
|
||||||
YGNodeStyleGetPadding(_cssNode, YGEdgeEnd) :
|
YGNodeStyleGetPadding(_cssNode, YGEdgeEnd).value :
|
||||||
YGNodeStyleGetPadding(_cssNode, YGEdgeRight)
|
YGNodeStyleGetPadding(_cssNode, YGEdgeRight).value
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -541,12 +541,12 @@ RCT_BORDER_PROPERTY(Right, RIGHT)
|
|||||||
#define RCT_DIMENSION_PROPERTY(setProp, getProp, cssProp) \
|
#define RCT_DIMENSION_PROPERTY(setProp, getProp, cssProp) \
|
||||||
- (void)set##setProp:(float)value \
|
- (void)set##setProp:(float)value \
|
||||||
{ \
|
{ \
|
||||||
YGNodeStyleSet##cssProp(_cssNode, value); \
|
YGNodeStyleSet##cssProp(_cssNode, value); \
|
||||||
[self dirtyText]; \
|
[self dirtyText]; \
|
||||||
} \
|
} \
|
||||||
- (float)getProp \
|
- (float)getProp \
|
||||||
{ \
|
{ \
|
||||||
return YGNodeStyleGet##cssProp(_cssNode); \
|
return YGNodeStyleGet##cssProp(_cssNode).value; \
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT_DIMENSION_PROPERTY(Width, width, Width)
|
RCT_DIMENSION_PROPERTY(Width, width, Width)
|
||||||
@@ -561,12 +561,12 @@ RCT_DIMENSION_PROPERTY(MaxHeight, maxHeight, MaxHeight)
|
|||||||
#define RCT_POSITION_PROPERTY(setProp, getProp, edge) \
|
#define RCT_POSITION_PROPERTY(setProp, getProp, edge) \
|
||||||
- (void)set##setProp:(float)value \
|
- (void)set##setProp:(float)value \
|
||||||
{ \
|
{ \
|
||||||
YGNodeStyleSetPosition(_cssNode, edge, value); \
|
YGNodeStyleSetPosition(_cssNode, edge, value); \
|
||||||
[self dirtyText]; \
|
[self dirtyText]; \
|
||||||
} \
|
} \
|
||||||
- (float)getProp \
|
- (float)getProp \
|
||||||
{ \
|
{ \
|
||||||
return YGNodeStyleGetPosition(_cssNode, edge); \
|
return YGNodeStyleGetPosition(_cssNode, edge).value; \
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT_POSITION_PROPERTY(Top, top, YGEdgeTop)
|
RCT_POSITION_PROPERTY(Top, top, YGEdgeTop)
|
||||||
@@ -590,12 +590,12 @@ static inline void RCTAssignSuggestedDimension(YGNodeRef cssNode, YGDimension di
|
|||||||
if (amount != UIViewNoIntrinsicMetric) {
|
if (amount != UIViewNoIntrinsicMetric) {
|
||||||
switch (dimension) {
|
switch (dimension) {
|
||||||
case YGDimensionWidth:
|
case YGDimensionWidth:
|
||||||
if (isnan(YGNodeStyleGetWidth(cssNode))) {
|
if (isnan(YGNodeStyleGetWidth(cssNode).value)) {
|
||||||
YGNodeStyleSetWidth(cssNode, amount);
|
YGNodeStyleSetWidth(cssNode, amount);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case YGDimensionHeight:
|
case YGDimensionHeight:
|
||||||
if (isnan(YGNodeStyleGetHeight(cssNode))) {
|
if (isnan(YGNodeStyleGetHeight(cssNode).value)) {
|
||||||
YGNodeStyleSetHeight(cssNode, amount);
|
YGNodeStyleSetHeight(cssNode, amount);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -630,19 +630,28 @@ static inline void RCTAssignSuggestedDimension(YGNodeRef cssNode, YGDimension di
|
|||||||
YGNodeStyleSetFlex(_cssNode, value);
|
YGNodeStyleSetFlex(_cssNode, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)setFlexBasis:(float)value
|
||||||
|
{
|
||||||
|
YGNodeStyleSetFlexBasis(_cssNode, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (float)flexBasis
|
||||||
|
{
|
||||||
|
return YGNodeStyleGetFlexBasis(_cssNode).value;
|
||||||
|
}
|
||||||
|
|
||||||
#define RCT_STYLE_PROPERTY(setProp, getProp, cssProp, type) \
|
#define RCT_STYLE_PROPERTY(setProp, getProp, cssProp, type) \
|
||||||
- (void)set##setProp:(type)value \
|
- (void)set##setProp:(type)value \
|
||||||
{ \
|
{ \
|
||||||
YGNodeStyleSet##cssProp(_cssNode, value); \
|
YGNodeStyleSet##cssProp(_cssNode, value); \
|
||||||
} \
|
} \
|
||||||
- (type)getProp \
|
- (type)getProp \
|
||||||
{ \
|
{ \
|
||||||
return YGNodeStyleGet##cssProp(_cssNode); \
|
return YGNodeStyleGet##cssProp(_cssNode); \
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT_STYLE_PROPERTY(FlexGrow, flexGrow, FlexGrow, float)
|
RCT_STYLE_PROPERTY(FlexGrow, flexGrow, FlexGrow, float)
|
||||||
RCT_STYLE_PROPERTY(FlexShrink, flexShrink, FlexShrink, float)
|
RCT_STYLE_PROPERTY(FlexShrink, flexShrink, FlexShrink, float)
|
||||||
RCT_STYLE_PROPERTY(FlexBasis, flexBasis, FlexBasis, float)
|
|
||||||
RCT_STYLE_PROPERTY(FlexDirection, flexDirection, FlexDirection, YGFlexDirection)
|
RCT_STYLE_PROPERTY(FlexDirection, flexDirection, FlexDirection, YGFlexDirection)
|
||||||
RCT_STYLE_PROPERTY(JustifyContent, justifyContent, JustifyContent, YGJustify)
|
RCT_STYLE_PROPERTY(JustifyContent, justifyContent, JustifyContent, YGJustify)
|
||||||
RCT_STYLE_PROPERTY(AlignSelf, alignSelf, AlignSelf, YGAlign)
|
RCT_STYLE_PROPERTY(AlignSelf, alignSelf, AlignSelf, YGAlign)
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ public class ReactShadowNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final float getStyleWidth() {
|
public final float getStyleWidth() {
|
||||||
return mYogaNode.getWidth();
|
return mYogaNode.getWidth().value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStyleWidth(float widthPx) {
|
public void setStyleWidth(float widthPx) {
|
||||||
@@ -531,7 +531,7 @@ public class ReactShadowNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final float getStyleHeight() {
|
public final float getStyleHeight() {
|
||||||
return mYogaNode.getHeight();
|
return mYogaNode.getHeight().value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStyleHeight(float heightPx) {
|
public void setStyleHeight(float heightPx) {
|
||||||
@@ -595,7 +595,7 @@ public class ReactShadowNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final float getPadding(int spacingType) {
|
public final float getPadding(int spacingType) {
|
||||||
return mYogaNode.getPadding(YogaEdge.fromInt(spacingType));
|
return mYogaNode.getPadding(YogaEdge.fromInt(spacingType)).value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDefaultPadding(int spacingType, float padding) {
|
public void setDefaultPadding(int spacingType, float padding) {
|
||||||
|
|||||||
@@ -16,4 +16,8 @@ public class YogaConstants {
|
|||||||
public static boolean isUndefined(float value) {
|
public static boolean isUndefined(float value) {
|
||||||
return Float.compare(value, UNDEFINED) == 0;
|
return Float.compare(value, UNDEFINED) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isUndefined(YogaValue value) {
|
||||||
|
return value.unit == YogaUnit.UNDEFINED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -323,10 +323,10 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
jni_YGNodeStyleSetFlexShrink(mNativePointer, flexShrink);
|
jni_YGNodeStyleSetFlexShrink(mNativePointer, flexShrink);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetFlexBasis(long nativePointer);
|
private native Object jni_YGNodeStyleGetFlexBasis(long nativePointer);
|
||||||
@Override
|
@Override
|
||||||
public float getFlexBasis() {
|
public YogaValue getFlexBasis() {
|
||||||
return jni_YGNodeStyleGetFlexBasis(mNativePointer);
|
return (YogaValue) jni_YGNodeStyleGetFlexBasis(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
|
private native void jni_YGNodeStyleSetFlexBasis(long nativePointer, float flexBasis);
|
||||||
@@ -335,13 +335,19 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
jni_YGNodeStyleSetFlexBasis(mNativePointer, flexBasis);
|
jni_YGNodeStyleSetFlexBasis(mNativePointer, flexBasis);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetMargin(long nativePointer, int edge);
|
private native void jni_YGNodeStyleSetFlexBasisPercent(long nativePointer, float percent);
|
||||||
@Override
|
@Override
|
||||||
public float getMargin(YogaEdge edge) {
|
public void setFlexBasisPercent(float percent) {
|
||||||
|
jni_YGNodeStyleSetFlexBasisPercent(mNativePointer, percent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetMargin(long nativePointer, int edge);
|
||||||
|
@Override
|
||||||
|
public YogaValue getMargin(YogaEdge edge) {
|
||||||
if (!mHasSetMargin) {
|
if (!mHasSetMargin) {
|
||||||
return edge.intValue() < YogaEdge.START.intValue() ? 0 : YogaConstants.UNDEFINED;
|
return edge.intValue() < YogaEdge.START.intValue() ? YogaValue.ZERO : YogaValue.UNDEFINED;
|
||||||
}
|
}
|
||||||
return jni_YGNodeStyleGetMargin(mNativePointer, edge.intValue());
|
return (YogaValue) jni_YGNodeStyleGetMargin(mNativePointer, edge.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
private native void jni_YGNodeStyleSetMargin(long nativePointer, int edge, float margin);
|
||||||
@@ -351,13 +357,20 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
jni_YGNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
|
jni_YGNodeStyleSetMargin(mNativePointer, edge.intValue(), margin);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetPadding(long nativePointer, int edge);
|
private native void jni_YGNodeStyleSetMarginPercent(long nativePointer, int edge, float percent);
|
||||||
@Override
|
@Override
|
||||||
public float getPadding(YogaEdge edge) {
|
public void setMarginPercent(YogaEdge edge, float percent) {
|
||||||
|
mHasSetMargin = true;
|
||||||
|
jni_YGNodeStyleSetMarginPercent(mNativePointer, edge.intValue(), percent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetPadding(long nativePointer, int edge);
|
||||||
|
@Override
|
||||||
|
public YogaValue getPadding(YogaEdge edge) {
|
||||||
if (!mHasSetPadding) {
|
if (!mHasSetPadding) {
|
||||||
return edge.intValue() < YogaEdge.START.intValue() ? 0 : YogaConstants.UNDEFINED;
|
return edge.intValue() < YogaEdge.START.intValue() ? YogaValue.ZERO : YogaValue.UNDEFINED;
|
||||||
}
|
}
|
||||||
return jni_YGNodeStyleGetPadding(mNativePointer, edge.intValue());
|
return (YogaValue) jni_YGNodeStyleGetPadding(mNativePointer, edge.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
private native void jni_YGNodeStyleSetPadding(long nativePointer, int edge, float padding);
|
||||||
@@ -367,6 +380,13 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
jni_YGNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
|
jni_YGNodeStyleSetPadding(mNativePointer, edge.intValue(), padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetPaddingPercent(long nativePointer, int edge, float percent);
|
||||||
|
@Override
|
||||||
|
public void setPaddingPercent(YogaEdge edge, float percent) {
|
||||||
|
mHasSetPadding = true;
|
||||||
|
jni_YGNodeStyleSetPaddingPercent(mNativePointer, edge.intValue(), percent);
|
||||||
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetBorder(long nativePointer, int edge);
|
private native float jni_YGNodeStyleGetBorder(long nativePointer, int edge);
|
||||||
@Override
|
@Override
|
||||||
public float getBorder(YogaEdge edge) {
|
public float getBorder(YogaEdge edge) {
|
||||||
@@ -383,13 +403,13 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
jni_YGNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
|
jni_YGNodeStyleSetBorder(mNativePointer, edge.intValue(), border);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetPosition(long nativePointer, int edge);
|
private native Object jni_YGNodeStyleGetPosition(long nativePointer, int edge);
|
||||||
@Override
|
@Override
|
||||||
public float getPosition(YogaEdge edge) {
|
public YogaValue getPosition(YogaEdge edge) {
|
||||||
if (!mHasSetPosition) {
|
if (!mHasSetPosition) {
|
||||||
return YogaConstants.UNDEFINED;
|
return YogaValue.UNDEFINED;
|
||||||
}
|
}
|
||||||
return jni_YGNodeStyleGetPosition(mNativePointer, edge.intValue());
|
return (YogaValue) jni_YGNodeStyleGetPosition(mNativePointer, edge.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetPosition(long nativePointer, int edge, float position);
|
private native void jni_YGNodeStyleSetPosition(long nativePointer, int edge, float position);
|
||||||
@@ -399,10 +419,17 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
jni_YGNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
|
jni_YGNodeStyleSetPosition(mNativePointer, edge.intValue(), position);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetWidth(long nativePointer);
|
private native void jni_YGNodeStyleSetPositionPercent(long nativePointer, int edge, float percent);
|
||||||
@Override
|
@Override
|
||||||
public float getWidth() {
|
public void setPositionPercent(YogaEdge edge, float percent) {
|
||||||
return jni_YGNodeStyleGetWidth(mNativePointer);
|
mHasSetPosition = true;
|
||||||
|
jni_YGNodeStyleSetPositionPercent(mNativePointer, edge.intValue(), percent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetWidth(long nativePointer);
|
||||||
|
@Override
|
||||||
|
public YogaValue getWidth() {
|
||||||
|
return (YogaValue) jni_YGNodeStyleGetWidth(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetWidth(long nativePointer, float width);
|
private native void jni_YGNodeStyleSetWidth(long nativePointer, float width);
|
||||||
@@ -411,10 +438,16 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
jni_YGNodeStyleSetWidth(mNativePointer, width);
|
jni_YGNodeStyleSetWidth(mNativePointer, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetHeight(long nativePointer);
|
private native void jni_YGNodeStyleSetWidthPercent(long nativePointer, float percent);
|
||||||
@Override
|
@Override
|
||||||
public float getHeight() {
|
public void setWidthPercent(float percent) {
|
||||||
return jni_YGNodeStyleGetHeight(mNativePointer);
|
jni_YGNodeStyleSetWidthPercent(mNativePointer, percent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetHeight(long nativePointer);
|
||||||
|
@Override
|
||||||
|
public YogaValue getHeight() {
|
||||||
|
return (YogaValue) jni_YGNodeStyleGetHeight(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetHeight(long nativePointer, float height);
|
private native void jni_YGNodeStyleSetHeight(long nativePointer, float height);
|
||||||
@@ -423,10 +456,16 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
jni_YGNodeStyleSetHeight(mNativePointer, height);
|
jni_YGNodeStyleSetHeight(mNativePointer, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetMinWidth(long nativePointer);
|
private native void jni_YGNodeStyleSetHeightPercent(long nativePointer, float percent);
|
||||||
@Override
|
@Override
|
||||||
public float getMinWidth() {
|
public void setHeightPercent(float percent) {
|
||||||
return jni_YGNodeStyleGetMinWidth(mNativePointer);
|
jni_YGNodeStyleSetHeightPercent(mNativePointer, percent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetMinWidth(long nativePointer);
|
||||||
|
@Override
|
||||||
|
public YogaValue getMinWidth() {
|
||||||
|
return (YogaValue) jni_YGNodeStyleGetMinWidth(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMinWidth(long nativePointer, float minWidth);
|
private native void jni_YGNodeStyleSetMinWidth(long nativePointer, float minWidth);
|
||||||
@@ -435,10 +474,16 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
jni_YGNodeStyleSetMinWidth(mNativePointer, minWidth);
|
jni_YGNodeStyleSetMinWidth(mNativePointer, minWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetMinHeight(long nativePointer);
|
private native void jni_YGNodeStyleSetMinWidthPercent(long nativePointer, float percent);
|
||||||
@Override
|
@Override
|
||||||
public float getMinHeight() {
|
public void setMinWidthPercent(float percent) {
|
||||||
return jni_YGNodeStyleGetMinHeight(mNativePointer);
|
jni_YGNodeStyleSetMinWidthPercent(mNativePointer, percent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetMinHeight(long nativePointer);
|
||||||
|
@Override
|
||||||
|
public YogaValue getMinHeight() {
|
||||||
|
return (YogaValue) jni_YGNodeStyleGetMinHeight(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMinHeight(long nativePointer, float minHeight);
|
private native void jni_YGNodeStyleSetMinHeight(long nativePointer, float minHeight);
|
||||||
@@ -447,10 +492,16 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
jni_YGNodeStyleSetMinHeight(mNativePointer, minHeight);
|
jni_YGNodeStyleSetMinHeight(mNativePointer, minHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetMaxWidth(long nativePointer);
|
private native void jni_YGNodeStyleSetMinHeightPercent(long nativePointer, float percent);
|
||||||
@Override
|
@Override
|
||||||
public float getMaxWidth() {
|
public void setMinHeightPercent(float percent) {
|
||||||
return jni_YGNodeStyleGetMaxWidth(mNativePointer);
|
jni_YGNodeStyleSetMinHeightPercent(mNativePointer, percent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetMaxWidth(long nativePointer);
|
||||||
|
@Override
|
||||||
|
public YogaValue getMaxWidth() {
|
||||||
|
return (YogaValue) jni_YGNodeStyleGetMaxWidth(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
|
private native void jni_YGNodeStyleSetMaxWidth(long nativePointer, float maxWidth);
|
||||||
@@ -459,10 +510,16 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
jni_YGNodeStyleSetMaxWidth(mNativePointer, maxWidth);
|
jni_YGNodeStyleSetMaxWidth(mNativePointer, maxWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetMaxHeight(long nativePointer);
|
private native void jni_YGNodeStyleSetMaxWidthPercent(long nativePointer, float percent);
|
||||||
@Override
|
@Override
|
||||||
public float getMaxHeight() {
|
public void setMaxWidthPercent(float percent) {
|
||||||
return jni_YGNodeStyleGetMaxHeight(mNativePointer);
|
jni_YGNodeStyleSetMaxWidthPercent(mNativePointer, percent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private native Object jni_YGNodeStyleGetMaxHeight(long nativePointer);
|
||||||
|
@Override
|
||||||
|
public YogaValue getMaxHeight() {
|
||||||
|
return (YogaValue) jni_YGNodeStyleGetMaxHeight(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private native void jni_YGNodeStyleSetMaxHeight(long nativePointer, float maxheight);
|
private native void jni_YGNodeStyleSetMaxHeight(long nativePointer, float maxheight);
|
||||||
@@ -471,6 +528,12 @@ public class YogaNode implements YogaNodeAPI<YogaNode> {
|
|||||||
jni_YGNodeStyleSetMaxHeight(mNativePointer, maxheight);
|
jni_YGNodeStyleSetMaxHeight(mNativePointer, maxheight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeStyleSetMaxHeightPercent(long nativePointer, float percent);
|
||||||
|
@Override
|
||||||
|
public void setMaxHeightPercent(float percent) {
|
||||||
|
jni_YGNodeStyleSetMaxHeightPercent(mNativePointer, percent);
|
||||||
|
}
|
||||||
|
|
||||||
private native float jni_YGNodeStyleGetAspectRatio(long nativePointer);
|
private native float jni_YGNodeStyleGetAspectRatio(long nativePointer);
|
||||||
public float getAspectRatio() {
|
public float getAspectRatio() {
|
||||||
return jni_YGNodeStyleGetAspectRatio(mNativePointer);
|
return jni_YGNodeStyleGetAspectRatio(mNativePointer);
|
||||||
|
|||||||
@@ -45,28 +45,38 @@ public interface YogaNodeAPI<YogaNodeType extends YogaNodeAPI> {
|
|||||||
void setFlexGrow(float flexGrow);
|
void setFlexGrow(float flexGrow);
|
||||||
float getFlexShrink();
|
float getFlexShrink();
|
||||||
void setFlexShrink(float flexShrink);
|
void setFlexShrink(float flexShrink);
|
||||||
float getFlexBasis();
|
YogaValue getFlexBasis();
|
||||||
void setFlexBasis(float flexBasis);
|
void setFlexBasis(float flexBasis);
|
||||||
float getMargin(YogaEdge edge);
|
void setFlexBasisPercent(float percent);
|
||||||
|
YogaValue getMargin(YogaEdge edge);
|
||||||
void setMargin(YogaEdge edge, float margin);
|
void setMargin(YogaEdge edge, float margin);
|
||||||
float getPadding(YogaEdge edge);
|
void setMarginPercent(YogaEdge edge, float percent);
|
||||||
|
YogaValue getPadding(YogaEdge edge);
|
||||||
void setPadding(YogaEdge edge, float padding);
|
void setPadding(YogaEdge edge, float padding);
|
||||||
|
void setPaddingPercent(YogaEdge edge, float percent);
|
||||||
float getBorder(YogaEdge edge);
|
float getBorder(YogaEdge edge);
|
||||||
void setBorder(YogaEdge edge, float border);
|
void setBorder(YogaEdge edge, float border);
|
||||||
float getPosition(YogaEdge edge);
|
YogaValue getPosition(YogaEdge edge);
|
||||||
void setPosition(YogaEdge edge, float position);
|
void setPosition(YogaEdge edge, float position);
|
||||||
float getWidth();
|
void setPositionPercent(YogaEdge edge, float percent);
|
||||||
|
YogaValue getWidth();
|
||||||
void setWidth(float width);
|
void setWidth(float width);
|
||||||
float getHeight();
|
void setWidthPercent(float percent);
|
||||||
|
YogaValue getHeight();
|
||||||
void setHeight(float height);
|
void setHeight(float height);
|
||||||
float getMaxWidth();
|
void setHeightPercent(float percent);
|
||||||
|
YogaValue getMaxWidth();
|
||||||
void setMaxWidth(float maxWidth);
|
void setMaxWidth(float maxWidth);
|
||||||
float getMinWidth();
|
void setMaxWidthPercent(float percent);
|
||||||
|
YogaValue getMinWidth();
|
||||||
void setMinWidth(float minWidth);
|
void setMinWidth(float minWidth);
|
||||||
float getMaxHeight();
|
void setMinWidthPercent(float percent);
|
||||||
|
YogaValue getMaxHeight();
|
||||||
void setMaxHeight(float maxHeight);
|
void setMaxHeight(float maxHeight);
|
||||||
float getMinHeight();
|
void setMaxHeightPercent(float percent);
|
||||||
|
YogaValue getMinHeight();
|
||||||
void setMinHeight(float minHeight);
|
void setMinHeight(float minHeight);
|
||||||
|
void setMinHeightPercent(float percent);
|
||||||
float getLayoutX();
|
float getLayoutX();
|
||||||
float getLayoutY();
|
float getLayoutY();
|
||||||
float getLayoutWidth();
|
float getLayoutWidth();
|
||||||
|
|||||||
38
ReactAndroid/src/main/java/com/facebook/yoga/YogaUnit.java
Normal file
38
ReactAndroid/src/main/java/com/facebook/yoga/YogaUnit.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.facebook.yoga;
|
||||||
|
|
||||||
|
import com.facebook.proguard.annotations.DoNotStrip;
|
||||||
|
|
||||||
|
@DoNotStrip
|
||||||
|
public enum YogaUnit {
|
||||||
|
UNDEFINED(0),
|
||||||
|
PIXEL(1),
|
||||||
|
PERCENT(2);
|
||||||
|
|
||||||
|
private int mIntValue;
|
||||||
|
|
||||||
|
YogaUnit(int intValue) {
|
||||||
|
mIntValue = intValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int intValue() {
|
||||||
|
return mIntValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static YogaUnit fromInt(int value) {
|
||||||
|
switch (value) {
|
||||||
|
case 0: return UNDEFINED;
|
||||||
|
case 1: return PIXEL;
|
||||||
|
case 2: return PERCENT;
|
||||||
|
default: throw new IllegalArgumentException("Unkown enum value: " + value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
45
ReactAndroid/src/main/java/com/facebook/yoga/YogaValue.java
Normal file
45
ReactAndroid/src/main/java/com/facebook/yoga/YogaValue.java
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.facebook.yoga;
|
||||||
|
|
||||||
|
import com.facebook.proguard.annotations.DoNotStrip;
|
||||||
|
|
||||||
|
@DoNotStrip
|
||||||
|
public class YogaValue {
|
||||||
|
static final YogaValue UNDEFINED = new YogaValue(YogaConstants.UNDEFINED, YogaUnit.UNDEFINED);
|
||||||
|
static final YogaValue ZERO = new YogaValue(0, YogaUnit.PIXEL);
|
||||||
|
|
||||||
|
public final float value;
|
||||||
|
public final YogaUnit unit;
|
||||||
|
|
||||||
|
YogaValue(float value, YogaUnit unit) {
|
||||||
|
this.value = value;
|
||||||
|
this.unit = unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
@DoNotStrip
|
||||||
|
YogaValue(float value, int unit) {
|
||||||
|
this(value, YogaUnit.fromInt(unit));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (other instanceof YogaValue) {
|
||||||
|
final YogaValue otherValue = (YogaValue) other;
|
||||||
|
return value == otherValue.value && unit == otherValue.unit;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Float.floatToIntBits(value) + unit.intValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,9 +7,9 @@
|
|||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <yoga/Yoga.h>
|
|
||||||
#include <fb/fbjni.h>
|
#include <fb/fbjni.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <yoga/Yoga.h>
|
||||||
|
|
||||||
using namespace facebook::jni;
|
using namespace facebook::jni;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -70,8 +70,8 @@ static YGSize YGJNIMeasureFunc(YGNodeRef node,
|
|||||||
int32_t wBits = 0xFFFFFFFF & (measureResult >> 32);
|
int32_t wBits = 0xFFFFFFFF & (measureResult >> 32);
|
||||||
int32_t hBits = 0xFFFFFFFF & measureResult;
|
int32_t hBits = 0xFFFFFFFF & measureResult;
|
||||||
|
|
||||||
const float *measuredWidth = reinterpret_cast<float*>(&wBits);
|
const float *measuredWidth = reinterpret_cast<float *>(&wBits);
|
||||||
const float *measuredHeight = reinterpret_cast<float*>(&hBits);
|
const float *measuredHeight = reinterpret_cast<float *>(&hBits);
|
||||||
|
|
||||||
return YGSize{*measuredWidth, *measuredHeight};
|
return YGSize{*measuredWidth, *measuredHeight};
|
||||||
} else {
|
} else {
|
||||||
@@ -204,6 +204,14 @@ void jni_YGNodeCopyStyle(alias_ref<jobject>, jlong dstNativePointer, jlong srcNa
|
|||||||
YGNodeCopyStyle(_jlong2YGNodeRef(dstNativePointer), _jlong2YGNodeRef(srcNativePointer));
|
YGNodeCopyStyle(_jlong2YGNodeRef(dstNativePointer), _jlong2YGNodeRef(srcNativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct JYogaValue : public JavaClass<JYogaValue> {
|
||||||
|
constexpr static auto kJavaDescriptor = "Lcom/facebook/yoga/YogaValue;";
|
||||||
|
|
||||||
|
static local_ref<javaobject> create(YGValue value) {
|
||||||
|
return newInstance(value.value, static_cast<int>(value.unit));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#define YG_NODE_JNI_STYLE_PROP(javatype, type, name) \
|
#define YG_NODE_JNI_STYLE_PROP(javatype, type, name) \
|
||||||
javatype jni_YGNodeStyleGet##name(alias_ref<jobject>, jlong nativePointer) { \
|
javatype jni_YGNodeStyleGet##name(alias_ref<jobject>, jlong nativePointer) { \
|
||||||
return (javatype) YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer)); \
|
return (javatype) YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer)); \
|
||||||
@@ -213,6 +221,19 @@ void jni_YGNodeCopyStyle(alias_ref<jobject>, jlong dstNativePointer, jlong srcNa
|
|||||||
YGNodeStyleSet##name(_jlong2YGNodeRef(nativePointer), static_cast<type>(value)); \
|
YGNodeStyleSet##name(_jlong2YGNodeRef(nativePointer), static_cast<type>(value)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define YG_NODE_JNI_STYLE_UNIT_PROP(name) \
|
||||||
|
local_ref<jobject> jni_YGNodeStyleGet##name(alias_ref<jobject>, jlong nativePointer) { \
|
||||||
|
return JYogaValue::create(YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer))); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
void jni_YGNodeStyleSet##name(alias_ref<jobject>, jlong nativePointer, jfloat value) { \
|
||||||
|
YGNodeStyleSet##name(_jlong2YGNodeRef(nativePointer), static_cast<float>(value)); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
void jni_YGNodeStyleSet##name##Percent(alias_ref<jobject>, jlong nativePointer, jfloat value) { \
|
||||||
|
YGNodeStyleSet##name##Percent(_jlong2YGNodeRef(nativePointer), static_cast<float>(value)); \
|
||||||
|
}
|
||||||
|
|
||||||
#define YG_NODE_JNI_STYLE_EDGE_PROP(javatype, type, name) \
|
#define YG_NODE_JNI_STYLE_EDGE_PROP(javatype, type, name) \
|
||||||
javatype jni_YGNodeStyleGet##name(alias_ref<jobject>, jlong nativePointer, jint edge) { \
|
javatype jni_YGNodeStyleGet##name(alias_ref<jobject>, jlong nativePointer, jint edge) { \
|
||||||
return (javatype) YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer), \
|
return (javatype) YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer), \
|
||||||
@@ -228,6 +249,29 @@ void jni_YGNodeCopyStyle(alias_ref<jobject>, jlong dstNativePointer, jlong srcNa
|
|||||||
static_cast<type>(value)); \
|
static_cast<type>(value)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \
|
||||||
|
local_ref<jobject> jni_YGNodeStyleGet##name(alias_ref<jobject>, \
|
||||||
|
jlong nativePointer, \
|
||||||
|
jint edge) { \
|
||||||
|
return JYogaValue::create( \
|
||||||
|
YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer), static_cast<YGEdge>(edge))); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
void jni_YGNodeStyleSet##name(alias_ref<jobject>, jlong nativePointer, jint edge, jfloat value) { \
|
||||||
|
YGNodeStyleSet##name(_jlong2YGNodeRef(nativePointer), \
|
||||||
|
static_cast<YGEdge>(edge), \
|
||||||
|
static_cast<float>(value)); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
void jni_YGNodeStyleSet##name##Percent(alias_ref<jobject>, \
|
||||||
|
jlong nativePointer, \
|
||||||
|
jint edge, \
|
||||||
|
jfloat value) { \
|
||||||
|
YGNodeStyleSet##name##Percent(_jlong2YGNodeRef(nativePointer), \
|
||||||
|
static_cast<YGEdge>(edge), \
|
||||||
|
static_cast<float>(value)); \
|
||||||
|
}
|
||||||
|
|
||||||
YG_NODE_JNI_STYLE_PROP(jint, YGDirection, Direction);
|
YG_NODE_JNI_STYLE_PROP(jint, YGDirection, Direction);
|
||||||
YG_NODE_JNI_STYLE_PROP(jint, YGFlexDirection, FlexDirection);
|
YG_NODE_JNI_STYLE_PROP(jint, YGFlexDirection, FlexDirection);
|
||||||
YG_NODE_JNI_STYLE_PROP(jint, YGJustify, JustifyContent);
|
YG_NODE_JNI_STYLE_PROP(jint, YGJustify, JustifyContent);
|
||||||
@@ -243,19 +287,19 @@ void jni_YGNodeStyleSetFlex(alias_ref<jobject>, jlong nativePointer, jfloat valu
|
|||||||
}
|
}
|
||||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexGrow);
|
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexGrow);
|
||||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexShrink);
|
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexShrink);
|
||||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexBasis);
|
YG_NODE_JNI_STYLE_UNIT_PROP(FlexBasis);
|
||||||
|
|
||||||
YG_NODE_JNI_STYLE_EDGE_PROP(jfloat, float, Position);
|
YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(Position);
|
||||||
YG_NODE_JNI_STYLE_EDGE_PROP(jfloat, float, Margin);
|
YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(Margin);
|
||||||
YG_NODE_JNI_STYLE_EDGE_PROP(jfloat, float, Padding);
|
YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(Padding);
|
||||||
YG_NODE_JNI_STYLE_EDGE_PROP(jfloat, float, Border);
|
YG_NODE_JNI_STYLE_EDGE_PROP(jfloat, float, Border);
|
||||||
|
|
||||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, Width);
|
YG_NODE_JNI_STYLE_UNIT_PROP(Width);
|
||||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, MinWidth);
|
YG_NODE_JNI_STYLE_UNIT_PROP(MinWidth);
|
||||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, MaxWidth);
|
YG_NODE_JNI_STYLE_UNIT_PROP(MaxWidth);
|
||||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, Height);
|
YG_NODE_JNI_STYLE_UNIT_PROP(Height);
|
||||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, MinHeight);
|
YG_NODE_JNI_STYLE_UNIT_PROP(MinHeight);
|
||||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, MaxHeight);
|
YG_NODE_JNI_STYLE_UNIT_PROP(MaxHeight);
|
||||||
|
|
||||||
// Yoga specific properties, not compatible with flexbox specification
|
// Yoga specific properties, not compatible with flexbox specification
|
||||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, AspectRatio);
|
YG_NODE_JNI_STYLE_PROP(jfloat, float, AspectRatio);
|
||||||
@@ -278,7 +322,6 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
|
|||||||
YGMakeNativeMethod(jni_YGNodeMarkLayoutSeen),
|
YGMakeNativeMethod(jni_YGNodeMarkLayoutSeen),
|
||||||
YGMakeNativeMethod(jni_YGNodeSetHasMeasureFunc),
|
YGMakeNativeMethod(jni_YGNodeSetHasMeasureFunc),
|
||||||
YGMakeNativeMethod(jni_YGNodeCopyStyle),
|
YGMakeNativeMethod(jni_YGNodeCopyStyle),
|
||||||
|
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetDirection),
|
YGMakeNativeMethod(jni_YGNodeStyleGetDirection),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetDirection),
|
YGMakeNativeMethod(jni_YGNodeStyleSetDirection),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetFlexDirection),
|
YGMakeNativeMethod(jni_YGNodeStyleGetFlexDirection),
|
||||||
@@ -303,29 +346,38 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
|
|||||||
YGMakeNativeMethod(jni_YGNodeStyleSetFlexShrink),
|
YGMakeNativeMethod(jni_YGNodeStyleSetFlexShrink),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetFlexBasis),
|
YGMakeNativeMethod(jni_YGNodeStyleGetFlexBasis),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetFlexBasis),
|
YGMakeNativeMethod(jni_YGNodeStyleSetFlexBasis),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeStyleSetFlexBasisPercent),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetMargin),
|
YGMakeNativeMethod(jni_YGNodeStyleGetMargin),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetMargin),
|
YGMakeNativeMethod(jni_YGNodeStyleSetMargin),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeStyleSetMarginPercent),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetPadding),
|
YGMakeNativeMethod(jni_YGNodeStyleGetPadding),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetPadding),
|
YGMakeNativeMethod(jni_YGNodeStyleSetPadding),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeStyleSetPaddingPercent),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetBorder),
|
YGMakeNativeMethod(jni_YGNodeStyleGetBorder),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetBorder),
|
YGMakeNativeMethod(jni_YGNodeStyleSetBorder),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetPosition),
|
YGMakeNativeMethod(jni_YGNodeStyleGetPosition),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetPosition),
|
YGMakeNativeMethod(jni_YGNodeStyleSetPosition),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeStyleSetPositionPercent),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetWidth),
|
YGMakeNativeMethod(jni_YGNodeStyleGetWidth),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetWidth),
|
YGMakeNativeMethod(jni_YGNodeStyleSetWidth),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeStyleSetWidthPercent),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetHeight),
|
YGMakeNativeMethod(jni_YGNodeStyleGetHeight),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetHeight),
|
YGMakeNativeMethod(jni_YGNodeStyleSetHeight),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeStyleSetHeightPercent),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetMinWidth),
|
YGMakeNativeMethod(jni_YGNodeStyleGetMinWidth),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetMinWidth),
|
YGMakeNativeMethod(jni_YGNodeStyleSetMinWidth),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeStyleSetMinWidthPercent),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetMinHeight),
|
YGMakeNativeMethod(jni_YGNodeStyleGetMinHeight),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetMinHeight),
|
YGMakeNativeMethod(jni_YGNodeStyleSetMinHeight),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeStyleSetMinHeightPercent),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetMaxWidth),
|
YGMakeNativeMethod(jni_YGNodeStyleGetMaxWidth),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetMaxWidth),
|
YGMakeNativeMethod(jni_YGNodeStyleSetMaxWidth),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeStyleSetMaxWidthPercent),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetMaxHeight),
|
YGMakeNativeMethod(jni_YGNodeStyleGetMaxHeight),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetMaxHeight),
|
YGMakeNativeMethod(jni_YGNodeStyleSetMaxHeight),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeStyleSetMaxHeightPercent),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleGetAspectRatio),
|
YGMakeNativeMethod(jni_YGNodeStyleGetAspectRatio),
|
||||||
YGMakeNativeMethod(jni_YGNodeStyleSetAspectRatio),
|
YGMakeNativeMethod(jni_YGNodeStyleSetAspectRatio),
|
||||||
|
|
||||||
YGMakeNativeMethod(jni_YGNodeGetInstanceCount),
|
YGMakeNativeMethod(jni_YGNodeGetInstanceCount),
|
||||||
YGMakeNativeMethod(jni_YGSetLogger),
|
YGMakeNativeMethod(jni_YGSetLogger),
|
||||||
YGMakeNativeMethod(jni_YGLog),
|
YGMakeNativeMethod(jni_YGLog),
|
||||||
|
|||||||
@@ -113,4 +113,11 @@ typedef enum YGAlign {
|
|||||||
YGAlignStretch,
|
YGAlignStretch,
|
||||||
} YGAlign;
|
} YGAlign;
|
||||||
|
|
||||||
|
#define YGUnitCount 3
|
||||||
|
typedef enum YGUnit {
|
||||||
|
YGUnitUndefined,
|
||||||
|
YGUnitPixel,
|
||||||
|
YGUnitPercent,
|
||||||
|
} YGUnit;
|
||||||
|
|
||||||
YG_EXTERN_C_END
|
YG_EXTERN_C_END
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -38,6 +38,11 @@ typedef struct YGSize {
|
|||||||
float height;
|
float height;
|
||||||
} YGSize;
|
} YGSize;
|
||||||
|
|
||||||
|
typedef struct YGValue {
|
||||||
|
float value;
|
||||||
|
YGUnit unit;
|
||||||
|
} YGValue;
|
||||||
|
|
||||||
typedef struct YGNode *YGNodeRef;
|
typedef struct YGNode *YGNodeRef;
|
||||||
typedef YGSize (*YGMeasureFunc)(YGNodeRef node,
|
typedef YGSize (*YGMeasureFunc)(YGNodeRef node,
|
||||||
float width,
|
float width,
|
||||||
@@ -83,7 +88,7 @@ WIN_EXPORT bool YGNodeIsDirty(const YGNodeRef node);
|
|||||||
|
|
||||||
WIN_EXPORT void YGNodePrint(const YGNodeRef node, const YGPrintOptions options);
|
WIN_EXPORT void YGNodePrint(const YGNodeRef node, const YGPrintOptions options);
|
||||||
|
|
||||||
WIN_EXPORT bool YGValueIsUndefined(const float value);
|
WIN_EXPORT bool YGFloatIsUndefined(const float value);
|
||||||
|
|
||||||
WIN_EXPORT bool YGNodeCanUseCachedMeasurement(const YGMeasureMode widthMode,
|
WIN_EXPORT bool YGNodeCanUseCachedMeasurement(const YGMeasureMode widthMode,
|
||||||
const float width,
|
const float width,
|
||||||
@@ -108,12 +113,26 @@ WIN_EXPORT void YGNodeCopyStyle(const YGNodeRef dstNode, const YGNodeRef srcNode
|
|||||||
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, const type paramName); \
|
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, const type paramName); \
|
||||||
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node);
|
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node);
|
||||||
|
|
||||||
|
#define YG_NODE_STYLE_PROPERTY_UNIT(type, name, paramName) \
|
||||||
|
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, const float paramName); \
|
||||||
|
WIN_EXPORT void YGNodeStyleSet##name##Percent(const YGNodeRef node, const float paramName); \
|
||||||
|
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node);
|
||||||
|
|
||||||
#define YG_NODE_STYLE_EDGE_PROPERTY(type, name, paramName) \
|
#define YG_NODE_STYLE_EDGE_PROPERTY(type, name, paramName) \
|
||||||
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, \
|
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, \
|
||||||
const YGEdge edge, \
|
const YGEdge edge, \
|
||||||
const type paramName); \
|
const type paramName); \
|
||||||
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge);
|
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge);
|
||||||
|
|
||||||
|
#define YG_NODE_STYLE_EDGE_PROPERTY_UNIT(type, name, paramName) \
|
||||||
|
WIN_EXPORT void YGNodeStyleSet##name(const YGNodeRef node, \
|
||||||
|
const YGEdge edge, \
|
||||||
|
const float paramName); \
|
||||||
|
WIN_EXPORT void YGNodeStyleSet##name##Percent(const YGNodeRef node, \
|
||||||
|
const YGEdge edge, \
|
||||||
|
const float paramName); \
|
||||||
|
WIN_EXPORT type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge);
|
||||||
|
|
||||||
#define YG_NODE_LAYOUT_PROPERTY(type, name) \
|
#define YG_NODE_LAYOUT_PROPERTY(type, name) \
|
||||||
WIN_EXPORT type YGNodeLayoutGet##name(const YGNodeRef node);
|
WIN_EXPORT type YGNodeLayoutGet##name(const YGNodeRef node);
|
||||||
|
|
||||||
@@ -135,19 +154,19 @@ YG_NODE_STYLE_PROPERTY(YGOverflow, Overflow, overflow);
|
|||||||
WIN_EXPORT void YGNodeStyleSetFlex(const YGNodeRef node, const float flex);
|
WIN_EXPORT void YGNodeStyleSetFlex(const YGNodeRef node, const float flex);
|
||||||
YG_NODE_STYLE_PROPERTY(float, FlexGrow, flexGrow);
|
YG_NODE_STYLE_PROPERTY(float, FlexGrow, flexGrow);
|
||||||
YG_NODE_STYLE_PROPERTY(float, FlexShrink, flexShrink);
|
YG_NODE_STYLE_PROPERTY(float, FlexShrink, flexShrink);
|
||||||
YG_NODE_STYLE_PROPERTY(float, FlexBasis, flexBasis);
|
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, FlexBasis, flexBasis);
|
||||||
|
|
||||||
YG_NODE_STYLE_EDGE_PROPERTY(float, Position, position);
|
YG_NODE_STYLE_EDGE_PROPERTY_UNIT(YGValue, Position, position);
|
||||||
YG_NODE_STYLE_EDGE_PROPERTY(float, Margin, margin);
|
YG_NODE_STYLE_EDGE_PROPERTY_UNIT(YGValue, Margin, margin);
|
||||||
YG_NODE_STYLE_EDGE_PROPERTY(float, Padding, padding);
|
YG_NODE_STYLE_EDGE_PROPERTY_UNIT(YGValue, Padding, padding);
|
||||||
YG_NODE_STYLE_EDGE_PROPERTY(float, Border, border);
|
YG_NODE_STYLE_EDGE_PROPERTY(float, Border, border);
|
||||||
|
|
||||||
YG_NODE_STYLE_PROPERTY(float, Width, width);
|
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, Width, width);
|
||||||
YG_NODE_STYLE_PROPERTY(float, Height, height);
|
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, Height, height);
|
||||||
YG_NODE_STYLE_PROPERTY(float, MinWidth, minWidth);
|
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, MinWidth, minWidth);
|
||||||
YG_NODE_STYLE_PROPERTY(float, MinHeight, minHeight);
|
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, MinHeight, minHeight);
|
||||||
YG_NODE_STYLE_PROPERTY(float, MaxWidth, maxWidth);
|
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, MaxWidth, maxWidth);
|
||||||
YG_NODE_STYLE_PROPERTY(float, MaxHeight, maxHeight);
|
YG_NODE_STYLE_PROPERTY_UNIT(YGValue, MaxHeight, maxHeight);
|
||||||
|
|
||||||
// Yoga specific properties, not compatible with flexbox specification
|
// Yoga specific properties, not compatible with flexbox specification
|
||||||
// Aspect ratio control the size of the undefined dimension of a node.
|
// Aspect ratio control the size of the undefined dimension of a node.
|
||||||
|
|||||||
Reference in New Issue
Block a user