Compare commits
1 Commits
mateoguzma
...
export-D80
Author | SHA1 | Date | |
---|---|---|---|
|
4e75c24b99 |
29
java/com/facebook/yoga/YogaConfig.java
Normal file
29
java/com/facebook/yoga/YogaConfig.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.facebook.yoga;
|
||||||
|
|
||||||
|
public abstract class YogaConfig {
|
||||||
|
|
||||||
|
public static int SPACING_TYPE = 1;
|
||||||
|
|
||||||
|
public abstract void setExperimentalFeatureEnabled(YogaExperimentalFeature feature, boolean enabled);
|
||||||
|
|
||||||
|
public abstract void setUseWebDefaults(boolean useWebDefaults);
|
||||||
|
|
||||||
|
public abstract void setPointScaleFactor(float pixelsInPoint);
|
||||||
|
|
||||||
|
public abstract void setErrata(YogaErrata errata);
|
||||||
|
|
||||||
|
public abstract YogaErrata getErrata();
|
||||||
|
|
||||||
|
public abstract void setLogger(YogaLogger logger);
|
||||||
|
|
||||||
|
public abstract YogaLogger getLogger();
|
||||||
|
|
||||||
|
protected abstract long getNativePointer();
|
||||||
|
}
|
@@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.facebook.yoga
|
|
||||||
|
|
||||||
public abstract class YogaConfig {
|
|
||||||
public abstract fun setExperimentalFeatureEnabled(
|
|
||||||
feature: YogaExperimentalFeature,
|
|
||||||
enabled: Boolean
|
|
||||||
)
|
|
||||||
|
|
||||||
public abstract fun setUseWebDefaults(useWebDefaults: Boolean)
|
|
||||||
|
|
||||||
public abstract fun setPointScaleFactor(pixelsInPoint: Float)
|
|
||||||
|
|
||||||
public abstract fun setErrata(errata: YogaErrata)
|
|
||||||
|
|
||||||
public abstract fun getErrata(): YogaErrata
|
|
||||||
|
|
||||||
public abstract fun setLogger(logger: YogaLogger)
|
|
||||||
|
|
||||||
public abstract fun getLogger(): YogaLogger
|
|
||||||
|
|
||||||
protected abstract fun getNativePointer(): Long
|
|
||||||
|
|
||||||
public companion object {
|
|
||||||
public var SPACING_TYPE: Int = 1
|
|
||||||
}
|
|
||||||
}
|
|
197
java/com/facebook/yoga/YogaProps.java
Normal file
197
java/com/facebook/yoga/YogaProps.java
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.facebook.yoga;
|
||||||
|
|
||||||
|
public interface YogaProps {
|
||||||
|
|
||||||
|
/* Width properties */
|
||||||
|
|
||||||
|
void setWidth(float width);
|
||||||
|
|
||||||
|
void setWidthPercent(float percent);
|
||||||
|
|
||||||
|
void setWidthAuto();
|
||||||
|
|
||||||
|
void setWidthMaxContent();
|
||||||
|
|
||||||
|
void setWidthFitContent();
|
||||||
|
|
||||||
|
void setWidthStretch();
|
||||||
|
|
||||||
|
void setMinWidth(float minWidth);
|
||||||
|
|
||||||
|
void setMinWidthPercent(float percent);
|
||||||
|
|
||||||
|
void setMinWidthMaxContent();
|
||||||
|
|
||||||
|
void setMinWidthFitContent();
|
||||||
|
|
||||||
|
void setMinWidthStretch();
|
||||||
|
|
||||||
|
void setMaxWidth(float maxWidth);
|
||||||
|
|
||||||
|
void setMaxWidthPercent(float percent);
|
||||||
|
|
||||||
|
void setMaxWidthMaxContent();
|
||||||
|
|
||||||
|
void setMaxWidthFitContent();
|
||||||
|
|
||||||
|
void setMaxWidthStretch();
|
||||||
|
|
||||||
|
/* Height properties */
|
||||||
|
|
||||||
|
void setHeight(float height);
|
||||||
|
|
||||||
|
void setHeightPercent(float percent);
|
||||||
|
|
||||||
|
void setHeightAuto();
|
||||||
|
|
||||||
|
void setHeightMaxContent();
|
||||||
|
|
||||||
|
void setHeightFitContent();
|
||||||
|
|
||||||
|
void setHeightStretch();
|
||||||
|
|
||||||
|
void setMinHeight(float minHeight);
|
||||||
|
|
||||||
|
void setMinHeightPercent(float percent);
|
||||||
|
|
||||||
|
void setMinHeightMaxContent();
|
||||||
|
|
||||||
|
void setMinHeightFitContent();
|
||||||
|
|
||||||
|
void setMinHeightStretch();
|
||||||
|
|
||||||
|
void setMaxHeight(float maxHeight);
|
||||||
|
|
||||||
|
void setMaxHeightPercent(float percent);
|
||||||
|
|
||||||
|
void setMaxHeightMaxContent();
|
||||||
|
|
||||||
|
void setMaxHeightFitContent();
|
||||||
|
|
||||||
|
void setMaxHeightStretch();
|
||||||
|
|
||||||
|
/* Margin properties */
|
||||||
|
|
||||||
|
void setMargin(YogaEdge edge, float margin);
|
||||||
|
|
||||||
|
void setMarginPercent(YogaEdge edge, float percent);
|
||||||
|
|
||||||
|
void setMarginAuto(YogaEdge edge);
|
||||||
|
|
||||||
|
/* Padding properties */
|
||||||
|
|
||||||
|
void setPadding(YogaEdge edge, float padding);
|
||||||
|
|
||||||
|
void setPaddingPercent(YogaEdge edge, float percent);
|
||||||
|
|
||||||
|
/* Position properties */
|
||||||
|
|
||||||
|
void setPositionType(YogaPositionType positionType);
|
||||||
|
|
||||||
|
void setPosition(YogaEdge edge, float position);
|
||||||
|
|
||||||
|
void setPositionPercent(YogaEdge edge, float percent);
|
||||||
|
|
||||||
|
/* Alignment properties */
|
||||||
|
|
||||||
|
void setAlignContent(YogaAlign alignContent);
|
||||||
|
|
||||||
|
void setAlignItems(YogaAlign alignItems);
|
||||||
|
|
||||||
|
void setAlignSelf(YogaAlign alignSelf);
|
||||||
|
|
||||||
|
/* Flex properties */
|
||||||
|
|
||||||
|
void setFlex(float flex);
|
||||||
|
|
||||||
|
void setFlexBasisAuto();
|
||||||
|
|
||||||
|
void setFlexBasisPercent(float percent);
|
||||||
|
|
||||||
|
void setFlexBasis(float flexBasis);
|
||||||
|
|
||||||
|
void setFlexBasisMaxContent();
|
||||||
|
|
||||||
|
void setFlexBasisFitContent();
|
||||||
|
|
||||||
|
void setFlexBasisStretch();
|
||||||
|
|
||||||
|
void setFlexDirection(YogaFlexDirection direction);
|
||||||
|
|
||||||
|
void setFlexGrow(float flexGrow);
|
||||||
|
|
||||||
|
void setFlexShrink(float flexShrink);
|
||||||
|
|
||||||
|
/* Other properties */
|
||||||
|
|
||||||
|
void setJustifyContent(YogaJustify justifyContent);
|
||||||
|
|
||||||
|
void setDirection(YogaDirection direction);
|
||||||
|
|
||||||
|
void setBorder(YogaEdge edge, float value);
|
||||||
|
|
||||||
|
void setWrap(YogaWrap wrap);
|
||||||
|
|
||||||
|
void setAspectRatio(float aspectRatio);
|
||||||
|
|
||||||
|
void setIsReferenceBaseline(boolean isReferenceBaseline);
|
||||||
|
|
||||||
|
void setMeasureFunction(YogaMeasureFunction measureFunction);
|
||||||
|
|
||||||
|
void setBaselineFunction(YogaBaselineFunction yogaBaselineFunction);
|
||||||
|
|
||||||
|
void setBoxSizing(YogaBoxSizing boxSizing);
|
||||||
|
|
||||||
|
/* Getters */
|
||||||
|
|
||||||
|
YogaValue getWidth();
|
||||||
|
|
||||||
|
YogaValue getMinWidth();
|
||||||
|
|
||||||
|
YogaValue getMaxWidth();
|
||||||
|
|
||||||
|
YogaValue getHeight();
|
||||||
|
|
||||||
|
YogaValue getMinHeight();
|
||||||
|
|
||||||
|
YogaValue getMaxHeight();
|
||||||
|
|
||||||
|
YogaDirection getStyleDirection();
|
||||||
|
|
||||||
|
YogaFlexDirection getFlexDirection();
|
||||||
|
|
||||||
|
YogaJustify getJustifyContent();
|
||||||
|
|
||||||
|
YogaAlign getAlignItems();
|
||||||
|
|
||||||
|
YogaAlign getAlignSelf();
|
||||||
|
|
||||||
|
YogaAlign getAlignContent();
|
||||||
|
|
||||||
|
YogaPositionType getPositionType();
|
||||||
|
|
||||||
|
float getFlexGrow();
|
||||||
|
|
||||||
|
float getFlexShrink();
|
||||||
|
|
||||||
|
YogaValue getFlexBasis();
|
||||||
|
|
||||||
|
float getAspectRatio();
|
||||||
|
|
||||||
|
YogaValue getMargin(YogaEdge edge);
|
||||||
|
|
||||||
|
YogaValue getPadding(YogaEdge edge);
|
||||||
|
|
||||||
|
YogaValue getPosition(YogaEdge edge);
|
||||||
|
|
||||||
|
float getBorder(YogaEdge edge);
|
||||||
|
|
||||||
|
YogaBoxSizing getBoxSizing();
|
||||||
|
}
|
@@ -1,197 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.facebook.yoga
|
|
||||||
|
|
||||||
public interface YogaProps {
|
|
||||||
|
|
||||||
/* Width properties */
|
|
||||||
|
|
||||||
public fun setWidth(width: Float)
|
|
||||||
|
|
||||||
public fun setWidthPercent(percent: Float)
|
|
||||||
|
|
||||||
public fun setWidthAuto()
|
|
||||||
|
|
||||||
public fun setWidthMaxContent()
|
|
||||||
|
|
||||||
public fun setWidthFitContent()
|
|
||||||
|
|
||||||
public fun setWidthStretch()
|
|
||||||
|
|
||||||
public fun setMinWidth(minWidth: Float)
|
|
||||||
|
|
||||||
public fun setMinWidthPercent(percent: Float)
|
|
||||||
|
|
||||||
public fun setMinWidthMaxContent()
|
|
||||||
|
|
||||||
public fun setMinWidthFitContent()
|
|
||||||
|
|
||||||
public fun setMinWidthStretch()
|
|
||||||
|
|
||||||
public fun setMaxWidth(maxWidth: Float)
|
|
||||||
|
|
||||||
public fun setMaxWidthPercent(percent: Float)
|
|
||||||
|
|
||||||
public fun setMaxWidthMaxContent()
|
|
||||||
|
|
||||||
public fun setMaxWidthFitContent()
|
|
||||||
|
|
||||||
public fun setMaxWidthStretch()
|
|
||||||
|
|
||||||
/* Height properties */
|
|
||||||
|
|
||||||
public fun setHeight(height: Float)
|
|
||||||
|
|
||||||
public fun setHeightPercent(percent: Float)
|
|
||||||
|
|
||||||
public fun setHeightAuto()
|
|
||||||
|
|
||||||
public fun setHeightMaxContent()
|
|
||||||
|
|
||||||
public fun setHeightFitContent()
|
|
||||||
|
|
||||||
public fun setHeightStretch()
|
|
||||||
|
|
||||||
public fun setMinHeight(minHeight: Float)
|
|
||||||
|
|
||||||
public fun setMinHeightPercent(percent: Float)
|
|
||||||
|
|
||||||
public fun setMinHeightMaxContent()
|
|
||||||
|
|
||||||
public fun setMinHeightFitContent()
|
|
||||||
|
|
||||||
public fun setMinHeightStretch()
|
|
||||||
|
|
||||||
public fun setMaxHeight(maxHeight: Float)
|
|
||||||
|
|
||||||
public fun setMaxHeightPercent(percent: Float)
|
|
||||||
|
|
||||||
public fun setMaxHeightMaxContent()
|
|
||||||
|
|
||||||
public fun setMaxHeightFitContent()
|
|
||||||
|
|
||||||
public fun setMaxHeightStretch()
|
|
||||||
|
|
||||||
/* Margin properties */
|
|
||||||
|
|
||||||
public fun setMargin(edge: YogaEdge, margin: Float)
|
|
||||||
|
|
||||||
public fun setMarginPercent(edge: YogaEdge, percent: Float)
|
|
||||||
|
|
||||||
public fun setMarginAuto(edge: YogaEdge)
|
|
||||||
|
|
||||||
/* Padding properties */
|
|
||||||
|
|
||||||
public fun setPadding(edge: YogaEdge, padding: Float)
|
|
||||||
|
|
||||||
public fun setPaddingPercent(edge: YogaEdge, percent: Float)
|
|
||||||
|
|
||||||
/* Position properties */
|
|
||||||
|
|
||||||
public fun setPositionType(positionType: YogaPositionType)
|
|
||||||
|
|
||||||
public fun setPosition(edge: YogaEdge, position: Float)
|
|
||||||
|
|
||||||
public fun setPositionPercent(edge: YogaEdge, percent: Float)
|
|
||||||
|
|
||||||
/* Alignment properties */
|
|
||||||
|
|
||||||
public fun setAlignContent(alignContent: YogaAlign)
|
|
||||||
|
|
||||||
public fun setAlignItems(alignItems: YogaAlign)
|
|
||||||
|
|
||||||
public fun setAlignSelf(alignSelf: YogaAlign)
|
|
||||||
|
|
||||||
/* Flex properties */
|
|
||||||
|
|
||||||
public fun setFlex(flex: Float)
|
|
||||||
|
|
||||||
public fun setFlexBasisAuto()
|
|
||||||
|
|
||||||
public fun setFlexBasisPercent(percent: Float)
|
|
||||||
|
|
||||||
public fun setFlexBasis(flexBasis: Float)
|
|
||||||
|
|
||||||
public fun setFlexBasisMaxContent()
|
|
||||||
|
|
||||||
public fun setFlexBasisFitContent()
|
|
||||||
|
|
||||||
public fun setFlexBasisStretch()
|
|
||||||
|
|
||||||
public fun setFlexDirection(direction: YogaFlexDirection)
|
|
||||||
|
|
||||||
public fun setFlexGrow(flexGrow: Float)
|
|
||||||
|
|
||||||
public fun setFlexShrink(flexShrink: Float)
|
|
||||||
|
|
||||||
/* Other properties */
|
|
||||||
|
|
||||||
public fun setJustifyContent(justifyContent: YogaJustify)
|
|
||||||
|
|
||||||
public fun setDirection(direction: YogaDirection)
|
|
||||||
|
|
||||||
public fun setBorder(edge: YogaEdge, value: Float)
|
|
||||||
|
|
||||||
public fun setWrap(wrap: YogaWrap)
|
|
||||||
|
|
||||||
public fun setAspectRatio(aspectRatio: Float)
|
|
||||||
|
|
||||||
public fun setIsReferenceBaseline(isReferenceBaseline: Boolean)
|
|
||||||
|
|
||||||
public fun setMeasureFunction(measureFunction: YogaMeasureFunction)
|
|
||||||
|
|
||||||
public fun setBaselineFunction(yogaBaselineFunction: YogaBaselineFunction)
|
|
||||||
|
|
||||||
public fun setBoxSizing(boxSizing: YogaBoxSizing)
|
|
||||||
|
|
||||||
/* Getters */
|
|
||||||
|
|
||||||
public val width: YogaValue
|
|
||||||
|
|
||||||
public val minWidth: YogaValue
|
|
||||||
|
|
||||||
public val maxWidth: YogaValue
|
|
||||||
|
|
||||||
public val height: YogaValue
|
|
||||||
|
|
||||||
public val minHeight: YogaValue
|
|
||||||
|
|
||||||
public val maxHeight: YogaValue
|
|
||||||
|
|
||||||
public val styleDirection: YogaDirection
|
|
||||||
|
|
||||||
public val flexDirection: YogaFlexDirection
|
|
||||||
|
|
||||||
public val justifyContent: YogaJustify
|
|
||||||
|
|
||||||
public val alignItems: YogaAlign
|
|
||||||
|
|
||||||
public val alignSelf: YogaAlign
|
|
||||||
|
|
||||||
public val alignContent: YogaAlign
|
|
||||||
|
|
||||||
public val positionType: YogaPositionType
|
|
||||||
|
|
||||||
public val flexGrow: Float
|
|
||||||
|
|
||||||
public val flexShrink: Float
|
|
||||||
|
|
||||||
public val flexBasis: YogaValue
|
|
||||||
|
|
||||||
public val aspectRatio: Float
|
|
||||||
|
|
||||||
public fun getMargin(edge: YogaEdge): YogaValue
|
|
||||||
|
|
||||||
public fun getPadding(edge: YogaEdge): YogaValue
|
|
||||||
|
|
||||||
public fun getPosition(edge: YogaEdge): YogaValue
|
|
||||||
|
|
||||||
public fun getBorder(edge: YogaEdge): Float
|
|
||||||
|
|
||||||
public val boxSizing: YogaBoxSizing
|
|
||||||
}
|
|
80
java/com/facebook/yoga/YogaValue.java
Normal file
80
java/com/facebook/yoga/YogaValue.java
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.facebook.yoga;
|
||||||
|
|
||||||
|
public class YogaValue {
|
||||||
|
static final YogaValue UNDEFINED = new YogaValue(YogaConstants.UNDEFINED, YogaUnit.UNDEFINED);
|
||||||
|
static final YogaValue ZERO = new YogaValue(0, YogaUnit.POINT);
|
||||||
|
static final YogaValue AUTO = new YogaValue(YogaConstants.UNDEFINED, YogaUnit.AUTO);
|
||||||
|
|
||||||
|
public final float value;
|
||||||
|
public final YogaUnit unit;
|
||||||
|
|
||||||
|
public YogaValue(float value, YogaUnit unit) {
|
||||||
|
this.value = value;
|
||||||
|
this.unit = unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
if (unit == otherValue.unit) {
|
||||||
|
return unit == YogaUnit.UNDEFINED
|
||||||
|
|| unit == YogaUnit.AUTO
|
||||||
|
|| Float.compare(value, otherValue.value) == 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Float.floatToIntBits(value) + unit.intValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
switch (unit) {
|
||||||
|
case UNDEFINED:
|
||||||
|
return "undefined";
|
||||||
|
case POINT:
|
||||||
|
return Float.toString(value);
|
||||||
|
case PERCENT:
|
||||||
|
return value + "%";
|
||||||
|
case AUTO:
|
||||||
|
return "auto";
|
||||||
|
default:
|
||||||
|
throw new IllegalStateException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static YogaValue parse(String s) {
|
||||||
|
if (s == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("undefined".equals(s)) {
|
||||||
|
return UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("auto".equals(s)) {
|
||||||
|
return AUTO;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s.endsWith("%")) {
|
||||||
|
return new YogaValue(Float.parseFloat(s.substring(0, s.length() - 1)), YogaUnit.PERCENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new YogaValue(Float.parseFloat(s), YogaUnit.POINT);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,66 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.facebook.yoga
|
|
||||||
|
|
||||||
public class YogaValue
|
|
||||||
public constructor(@JvmField public val value: Float, @JvmField public val unit: YogaUnit) {
|
|
||||||
internal constructor(value: Float, unit: Int) : this(value, YogaUnit.fromInt(unit))
|
|
||||||
|
|
||||||
override fun equals(other: Any?): Boolean {
|
|
||||||
if (other is YogaValue) {
|
|
||||||
val otherValue = other
|
|
||||||
if (unit == otherValue.unit) {
|
|
||||||
return unit == YogaUnit.UNDEFINED ||
|
|
||||||
unit == YogaUnit.AUTO ||
|
|
||||||
value.compareTo(otherValue.value) == 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun hashCode(): Int = java.lang.Float.floatToIntBits(value) + unit.intValue()
|
|
||||||
|
|
||||||
override fun toString(): String =
|
|
||||||
when (unit) {
|
|
||||||
YogaUnit.UNDEFINED -> "undefined"
|
|
||||||
YogaUnit.POINT -> value.toString()
|
|
||||||
YogaUnit.PERCENT -> "$value%"
|
|
||||||
YogaUnit.AUTO -> "auto"
|
|
||||||
else -> throw IllegalStateException()
|
|
||||||
}
|
|
||||||
|
|
||||||
public companion object {
|
|
||||||
@JvmField
|
|
||||||
public val UNDEFINED: YogaValue = YogaValue(YogaConstants.UNDEFINED, YogaUnit.UNDEFINED)
|
|
||||||
|
|
||||||
@JvmField public val ZERO: YogaValue = YogaValue(0f, YogaUnit.POINT)
|
|
||||||
|
|
||||||
@JvmField public val AUTO: YogaValue = YogaValue(YogaConstants.UNDEFINED, YogaUnit.AUTO)
|
|
||||||
|
|
||||||
@JvmStatic
|
|
||||||
public fun parse(s: String?): YogaValue? {
|
|
||||||
if (s == null) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("undefined" == s) {
|
|
||||||
return UNDEFINED
|
|
||||||
}
|
|
||||||
|
|
||||||
if ("auto" == s) {
|
|
||||||
return AUTO
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s.endsWith("%")) {
|
|
||||||
return YogaValue(s.substring(0, s.length - 1).toFloat(), YogaUnit.PERCENT)
|
|
||||||
}
|
|
||||||
|
|
||||||
return YogaValue(s.toFloat(), YogaUnit.POINT)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user