Fix sizing of non strech items
Summary: Fixes the sizing of items so that under most scenarios it calcultes its height by it's content for non exact measurings. This introduces a new useLegacyStretchBehaviour flag on the config to opt out of this change as it is breaking. See facebook/yoga#505 Closes https://github.com/facebook/yoga/pull/506 Reviewed By: astreet Differential Revision: D4954016 Pulled By: emilsjolander fbshipit-source-id: d28bd5d174cd76951fb94df85e3b0cfab7f81ff7
This commit is contained in:
committed by
Facebook Github Bot
parent
e3dbef7cbd
commit
203577724e
@@ -12,6 +12,5 @@ namespace Facebook.Yoga
|
|||||||
public enum YogaExperimentalFeature
|
public enum YogaExperimentalFeature
|
||||||
{
|
{
|
||||||
WebFlexBasis,
|
WebFlexBasis,
|
||||||
MinFlexFix,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1815,5 +1815,148 @@ namespace Facebook.Yoga
|
|||||||
Assert.AreEqual(72f, root_child0_child0.LayoutHeight);
|
Assert.AreEqual(72f, root_child0_child0.LayoutHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_align_center_should_size_based_on_content()
|
||||||
|
{
|
||||||
|
YogaConfig config = new YogaConfig();
|
||||||
|
|
||||||
|
YogaNode root = new YogaNode(config);
|
||||||
|
root.AlignItems = YogaAlign.Center;
|
||||||
|
root.MarginTop = 20;
|
||||||
|
root.Width = 100;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode(config);
|
||||||
|
root_child0.JustifyContent = YogaJustify.Center;
|
||||||
|
root_child0.FlexShrink = 1;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
|
||||||
|
YogaNode root_child0_child0 = new YogaNode(config);
|
||||||
|
root_child0_child0.FlexGrow = 1;
|
||||||
|
root_child0_child0.FlexShrink = 1;
|
||||||
|
root_child0.Insert(0, root_child0_child0);
|
||||||
|
|
||||||
|
YogaNode root_child0_child0_child0 = new YogaNode(config);
|
||||||
|
root_child0_child0_child0.Width = 20;
|
||||||
|
root_child0_child0_child0.Height = 20;
|
||||||
|
root_child0_child0.Insert(0, root_child0_child0_child0);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(20f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(20f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(20f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0_child0.LayoutY);
|
||||||
|
Assert.AreEqual(20f, root_child0_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(20f, root_child0_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0_child0_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0_child0_child0.LayoutY);
|
||||||
|
Assert.AreEqual(20f, root_child0_child0_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(20f, root_child0_child0_child0.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(20f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(40f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(20f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(20f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0_child0.LayoutY);
|
||||||
|
Assert.AreEqual(20f, root_child0_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(20f, root_child0_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0_child0_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0_child0_child0.LayoutY);
|
||||||
|
Assert.AreEqual(20f, root_child0_child0_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(20f, root_child0_child0_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Test_align_strech_should_size_based_on_parent()
|
||||||
|
{
|
||||||
|
YogaConfig config = new YogaConfig();
|
||||||
|
|
||||||
|
YogaNode root = new YogaNode(config);
|
||||||
|
root.MarginTop = 20;
|
||||||
|
root.Width = 100;
|
||||||
|
root.Height = 100;
|
||||||
|
|
||||||
|
YogaNode root_child0 = new YogaNode(config);
|
||||||
|
root_child0.JustifyContent = YogaJustify.Center;
|
||||||
|
root_child0.FlexShrink = 1;
|
||||||
|
root.Insert(0, root_child0);
|
||||||
|
|
||||||
|
YogaNode root_child0_child0 = new YogaNode(config);
|
||||||
|
root_child0_child0.FlexGrow = 1;
|
||||||
|
root_child0_child0.FlexShrink = 1;
|
||||||
|
root_child0.Insert(0, root_child0_child0);
|
||||||
|
|
||||||
|
YogaNode root_child0_child0_child0 = new YogaNode(config);
|
||||||
|
root_child0_child0_child0.Width = 20;
|
||||||
|
root_child0_child0_child0.Height = 20;
|
||||||
|
root_child0_child0.Insert(0, root_child0_child0_child0);
|
||||||
|
root.StyleDirection = YogaDirection.LTR;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(20f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(20f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(20f, root_child0_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0_child0_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0_child0_child0.LayoutY);
|
||||||
|
Assert.AreEqual(20f, root_child0_child0_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(20f, root_child0_child0_child0.LayoutHeight);
|
||||||
|
|
||||||
|
root.StyleDirection = YogaDirection.RTL;
|
||||||
|
root.CalculateLayout();
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root.LayoutX);
|
||||||
|
Assert.AreEqual(20f, root.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root.LayoutWidth);
|
||||||
|
Assert.AreEqual(100f, root.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(20f, root_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(0f, root_child0_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0_child0.LayoutY);
|
||||||
|
Assert.AreEqual(100f, root_child0_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(20f, root_child0_child0.LayoutHeight);
|
||||||
|
|
||||||
|
Assert.AreEqual(80f, root_child0_child0_child0.LayoutX);
|
||||||
|
Assert.AreEqual(0f, root_child0_child0_child0.LayoutY);
|
||||||
|
Assert.AreEqual(20f, root_child0_child0_child0.LayoutWidth);
|
||||||
|
Assert.AreEqual(20f, root_child0_child0_child0.LayoutHeight);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -366,7 +366,6 @@ namespace Facebook.Yoga
|
|||||||
public void Test_flex_grow_to_min()
|
public void Test_flex_grow_to_min()
|
||||||
{
|
{
|
||||||
YogaConfig config = new YogaConfig();
|
YogaConfig config = new YogaConfig();
|
||||||
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.MinFlexFix, true);
|
|
||||||
|
|
||||||
YogaNode root = new YogaNode(config);
|
YogaNode root = new YogaNode(config);
|
||||||
root.Width = 100;
|
root.Width = 100;
|
||||||
@@ -422,7 +421,6 @@ namespace Facebook.Yoga
|
|||||||
public void Test_flex_grow_in_at_most_container()
|
public void Test_flex_grow_in_at_most_container()
|
||||||
{
|
{
|
||||||
YogaConfig config = new YogaConfig();
|
YogaConfig config = new YogaConfig();
|
||||||
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.MinFlexFix, true);
|
|
||||||
|
|
||||||
YogaNode root = new YogaNode(config);
|
YogaNode root = new YogaNode(config);
|
||||||
root.FlexDirection = YogaFlexDirection.Row;
|
root.FlexDirection = YogaFlexDirection.Row;
|
||||||
|
@@ -1047,7 +1047,6 @@ namespace Facebook.Yoga
|
|||||||
public void Test_percentage_container_in_wrapping_container()
|
public void Test_percentage_container_in_wrapping_container()
|
||||||
{
|
{
|
||||||
YogaConfig config = new YogaConfig();
|
YogaConfig config = new YogaConfig();
|
||||||
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.MinFlexFix, true);
|
|
||||||
|
|
||||||
YogaNode root = new YogaNode(config);
|
YogaNode root = new YogaNode(config);
|
||||||
root.JustifyContent = YogaJustify.Center;
|
root.JustifyContent = YogaJustify.Center;
|
||||||
|
1
enums.py
1
enums.py
@@ -94,7 +94,6 @@ ENUMS = {
|
|||||||
'ExperimentalFeature': [
|
'ExperimentalFeature': [
|
||||||
# Mimic web flex-basis behavior.
|
# Mimic web flex-basis behavior.
|
||||||
'WebFlexBasis',
|
'WebFlexBasis',
|
||||||
'MinFlexFix'
|
|
||||||
],
|
],
|
||||||
'PrintOptions': [
|
'PrintOptions': [
|
||||||
('Layout', 1),
|
('Layout', 1),
|
||||||
|
@@ -167,3 +167,20 @@
|
|||||||
<div style="width: 72px; height: 72px;"></div>
|
<div style="width: 72px; height: 72px;"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="align_center_should_size_based_on_content" style="width: 100px; height: 100px; align-items: center; margin-top: 20px;">
|
||||||
|
<div style="flex-grow: 0; flex-shrink: 1; justify-content: center;">
|
||||||
|
<div style="flex-grow: 1; flex-shrink: 1;">
|
||||||
|
<div style="width: 20px; height: 20px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="align_strech_should_size_based_on_parent" style="width: 100px; height: 100px; align-items: strech; margin-top: 20px;">
|
||||||
|
<div style="flex-grow: 0; flex-shrink: 1; justify-content: center;">
|
||||||
|
<div style="flex-grow: 1; flex-shrink: 1;">
|
||||||
|
<div style="width: 20px; height: 20px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@@ -30,12 +30,12 @@
|
|||||||
<div style="width: 50px; height: 50px;"></div>
|
<div style="width: 50px; height: 50px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="flex_grow_to_min" experiments="MinFlexFix" style="min-height: 100px; max-height: 500px; width: 100px;">
|
<div id="flex_grow_to_min" style="min-height: 100px; max-height: 500px; width: 100px;">
|
||||||
<div style="flex-grow: 1; flex-shrink: 1;"></div>
|
<div style="flex-grow: 1; flex-shrink: 1;"></div>
|
||||||
<div style="height: 50px;"></div>
|
<div style="height: 50px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="flex_grow_in_at_most_container" experiments="MinFlexFix" style="width: 100px; height: 100px; background-color: white; flex-direction: row; align-items: flex-start;">
|
<div id="flex_grow_in_at_most_container" style="width: 100px; height: 100px; background-color: white; flex-direction: row; align-items: flex-start;">
|
||||||
<div style="flex-direction: row;">
|
<div style="flex-direction: row;">
|
||||||
<div style="flex-grow: 1; flex-basis: 0px;"></div>
|
<div style="flex-grow: 1; flex-basis: 0px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -92,7 +92,7 @@
|
|||||||
<div style="width: 100px;"></div>
|
<div style="width: 100px;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="percentage_container_in_wrapping_container" experiments="MinFlexFix" style="align-items: center; width: 200px; height: 200px; justify-content: center;">
|
<div id="percentage_container_in_wrapping_container" style="align-items: center; width: 200px; height: 200px; justify-content: center;">
|
||||||
<div>
|
<div>
|
||||||
<div style="alignItems: center; flex-direction: row; justify-content: center; width: 100%;">
|
<div style="alignItems: center; flex-direction: row; justify-content: center; width: 100%;">
|
||||||
<div style="width: 50px; height: 50px;"></div>
|
<div style="width: 50px; height: 50px;"></div>
|
||||||
|
@@ -56,4 +56,15 @@ public class YogaConfig {
|
|||||||
public void setPointScaleFactor(float pixelsInPoint) {
|
public void setPointScaleFactor(float pixelsInPoint) {
|
||||||
jni_YGConfigSetPointScaleFactor(mNativePointer, pixelsInPoint);
|
jni_YGConfigSetPointScaleFactor(mNativePointer, pixelsInPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGConfigSetUseLegacyStretchBehaviour(long nativePointer, boolean useLegacyStretchBehaviour);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Yoga previously had an error where containers would take the maximum space possible instead of the minimum
|
||||||
|
* like they are supposed to. In practice this resulted in implicit behaviour similar to align-self: stretch;
|
||||||
|
* Because this was such a long-standing bug we must allow legacy users to switch back to this behaviour.
|
||||||
|
*/
|
||||||
|
public void setUseLegacyStretchBehaviour(boolean useLegacyStretchBehaviour) {
|
||||||
|
jni_YGConfigSetUseLegacyStretchBehaviour(mNativePointer, useLegacyStretchBehaviour);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,8 +13,7 @@ import com.facebook.proguard.annotations.DoNotStrip;
|
|||||||
|
|
||||||
@DoNotStrip
|
@DoNotStrip
|
||||||
public enum YogaExperimentalFeature {
|
public enum YogaExperimentalFeature {
|
||||||
WEB_FLEX_BASIS(0),
|
WEB_FLEX_BASIS(0);
|
||||||
MIN_FLEX_FIX(1);
|
|
||||||
|
|
||||||
private int mIntValue;
|
private int mIntValue;
|
||||||
|
|
||||||
@@ -29,7 +28,6 @@ public enum YogaExperimentalFeature {
|
|||||||
public static YogaExperimentalFeature fromInt(int value) {
|
public static YogaExperimentalFeature fromInt(int value) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 0: return WEB_FLEX_BASIS;
|
case 0: return WEB_FLEX_BASIS;
|
||||||
case 1: return MIN_FLEX_FIX;
|
|
||||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -408,6 +408,11 @@ void jni_YGConfigSetPointScaleFactor(alias_ref<jobject>, jlong nativePointer, jf
|
|||||||
YGConfigSetPointScaleFactor(config, pixelsInPoint);
|
YGConfigSetPointScaleFactor(config, pixelsInPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void jni_YGConfigSetUseLegacyStretchBehaviour(alias_ref<jobject>, jlong nativePointer, jboolean useLegacyStretchBehaviour) {
|
||||||
|
const YGConfigRef config = _jlong2YGConfigRef(nativePointer);
|
||||||
|
YGConfigSetUseLegacyStretchBehaviour(config, useLegacyStretchBehaviour);
|
||||||
|
}
|
||||||
|
|
||||||
jint jni_YGNodeGetInstanceCount(alias_ref<jclass> clazz) {
|
jint jni_YGNodeGetInstanceCount(alias_ref<jclass> clazz) {
|
||||||
return YGNodeGetInstanceCount();
|
return YGNodeGetInstanceCount();
|
||||||
}
|
}
|
||||||
@@ -504,6 +509,7 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
|
|||||||
YGMakeNativeMethod(jni_YGConfigSetExperimentalFeatureEnabled),
|
YGMakeNativeMethod(jni_YGConfigSetExperimentalFeatureEnabled),
|
||||||
YGMakeNativeMethod(jni_YGConfigSetUseWebDefaults),
|
YGMakeNativeMethod(jni_YGConfigSetUseWebDefaults),
|
||||||
YGMakeNativeMethod(jni_YGConfigSetPointScaleFactor),
|
YGMakeNativeMethod(jni_YGConfigSetPointScaleFactor),
|
||||||
|
YGMakeNativeMethod(jni_YGConfigSetUseLegacyStretchBehaviour),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -1791,4 +1791,145 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(72f, root_child0_child0.getLayoutHeight(), 0.0f);
|
assertEquals(72f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_align_center_should_size_based_on_content() {
|
||||||
|
YogaConfig config = new YogaConfig();
|
||||||
|
|
||||||
|
final YogaNode root = new YogaNode(config);
|
||||||
|
root.setAlignItems(YogaAlign.CENTER);
|
||||||
|
root.setMargin(YogaEdge.TOP, 20f);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode(config);
|
||||||
|
root_child0.setJustifyContent(YogaJustify.CENTER);
|
||||||
|
root_child0.setFlexShrink(1f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child0 = new YogaNode(config);
|
||||||
|
root_child0_child0.setFlexGrow(1f);
|
||||||
|
root_child0_child0.setFlexShrink(1f);
|
||||||
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child0_child0 = new YogaNode(config);
|
||||||
|
root_child0_child0_child0.setWidth(20f);
|
||||||
|
root_child0_child0_child0.setHeight(20f);
|
||||||
|
root_child0_child0.addChildAt(root_child0_child0_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(40f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(40f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_align_strech_should_size_based_on_parent() {
|
||||||
|
YogaConfig config = new YogaConfig();
|
||||||
|
|
||||||
|
final YogaNode root = new YogaNode(config);
|
||||||
|
root.setMargin(YogaEdge.TOP, 20f);
|
||||||
|
root.setWidth(100f);
|
||||||
|
root.setHeight(100f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = new YogaNode(config);
|
||||||
|
root_child0.setJustifyContent(YogaJustify.CENTER);
|
||||||
|
root_child0.setFlexShrink(1f);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child0 = new YogaNode(config);
|
||||||
|
root_child0_child0.setFlexGrow(1f);
|
||||||
|
root_child0_child0.setFlexShrink(1f);
|
||||||
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child0_child0 = new YogaNode(config);
|
||||||
|
root_child0_child0_child0.setWidth(20f);
|
||||||
|
root_child0_child0_child0.setHeight(20f);
|
||||||
|
root_child0_child0.addChildAt(root_child0_child0_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(20f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(100f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(100f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(80f, root_child0_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(20f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -357,7 +357,6 @@ public class YGMinMaxDimensionTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_flex_grow_to_min() {
|
public void test_flex_grow_to_min() {
|
||||||
YogaConfig config = new YogaConfig();
|
YogaConfig config = new YogaConfig();
|
||||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.MIN_FLEX_FIX, true);
|
|
||||||
|
|
||||||
final YogaNode root = new YogaNode(config);
|
final YogaNode root = new YogaNode(config);
|
||||||
root.setWidth(100f);
|
root.setWidth(100f);
|
||||||
@@ -412,7 +411,6 @@ public class YGMinMaxDimensionTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_flex_grow_in_at_most_container() {
|
public void test_flex_grow_in_at_most_container() {
|
||||||
YogaConfig config = new YogaConfig();
|
YogaConfig config = new YogaConfig();
|
||||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.MIN_FLEX_FIX, true);
|
|
||||||
|
|
||||||
final YogaNode root = new YogaNode(config);
|
final YogaNode root = new YogaNode(config);
|
||||||
root.setFlexDirection(YogaFlexDirection.ROW);
|
root.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
@@ -1027,7 +1027,6 @@ public class YGPercentageTest {
|
|||||||
@Test
|
@Test
|
||||||
public void test_percentage_container_in_wrapping_container() {
|
public void test_percentage_container_in_wrapping_container() {
|
||||||
YogaConfig config = new YogaConfig();
|
YogaConfig config = new YogaConfig();
|
||||||
config.setExperimentalFeatureEnabled(YogaExperimentalFeature.MIN_FLEX_FIX, true);
|
|
||||||
|
|
||||||
final YogaNode root = new YogaNode(config);
|
final YogaNode root = new YogaNode(config);
|
||||||
root.setJustifyContent(YogaJustify.CENTER);
|
root.setJustifyContent(YogaJustify.CENTER);
|
||||||
|
@@ -43,9 +43,8 @@ module.exports = {
|
|||||||
EDGE_VERTICAL: 7,
|
EDGE_VERTICAL: 7,
|
||||||
EDGE_ALL: 8,
|
EDGE_ALL: 8,
|
||||||
|
|
||||||
EXPERIMENTAL_FEATURE_COUNT: 2,
|
EXPERIMENTAL_FEATURE_COUNT: 1,
|
||||||
EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: 0,
|
EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: 0,
|
||||||
EXPERIMENTAL_FEATURE_MIN_FLEX_FIX: 1,
|
|
||||||
|
|
||||||
FLEX_DIRECTION_COUNT: 4,
|
FLEX_DIRECTION_COUNT: 4,
|
||||||
FLEX_DIRECTION_COLUMN: 0,
|
FLEX_DIRECTION_COLUMN: 0,
|
||||||
|
@@ -1878,3 +1878,152 @@ it("align_items_flex_end_child_without_margin_bigger_than_parent", function () {
|
|||||||
config.free();
|
config.free();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
it("align_center_should_size_based_on_content", function () {
|
||||||
|
var config = Yoga.Config.create();
|
||||||
|
|
||||||
|
try {
|
||||||
|
var root = Yoga.Node.create(config);
|
||||||
|
root.setAlignItems(Yoga.ALIGN_CENTER);
|
||||||
|
root.setMargin(Yoga.EDGE_TOP, 20);
|
||||||
|
root.setWidth(100);
|
||||||
|
root.setHeight(100);
|
||||||
|
|
||||||
|
var root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||||
|
root_child0.setFlexShrink(1);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
var root_child0_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0_child0.setFlexGrow(1);
|
||||||
|
root_child0_child0.setFlexShrink(1);
|
||||||
|
root_child0.insertChild(root_child0_child0, 0);
|
||||||
|
|
||||||
|
var root_child0_child0_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0_child0_child0.setWidth(20);
|
||||||
|
root_child0_child0_child0.setHeight(20);
|
||||||
|
root_child0_child0.insertChild(root_child0_child0_child0, 0);
|
||||||
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||||
|
|
||||||
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||||
|
console.assert(20 === root.getComputedTop(), "20 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||||
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||||
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(40 === root_child0.getComputedLeft(), "40 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
|
console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")");
|
||||||
|
console.assert(20 === root_child0_child0.getComputedWidth(), "20 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")");
|
||||||
|
console.assert(20 === root_child0_child0_child0.getComputedWidth(), "20 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(20 === root_child0_child0_child0.getComputedHeight(), "20 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||||
|
|
||||||
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||||
|
console.assert(20 === root.getComputedTop(), "20 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||||
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||||
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(40 === root_child0.getComputedLeft(), "40 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
|
console.assert(20 === root_child0.getComputedWidth(), "20 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")");
|
||||||
|
console.assert(20 === root_child0_child0.getComputedWidth(), "20 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")");
|
||||||
|
console.assert(20 === root_child0_child0_child0.getComputedWidth(), "20 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(20 === root_child0_child0_child0.getComputedHeight(), "20 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")");
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== "undefined") {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
it("align_strech_should_size_based_on_parent", function () {
|
||||||
|
var config = Yoga.Config.create();
|
||||||
|
|
||||||
|
try {
|
||||||
|
var root = Yoga.Node.create(config);
|
||||||
|
root.setMargin(Yoga.EDGE_TOP, 20);
|
||||||
|
root.setWidth(100);
|
||||||
|
root.setHeight(100);
|
||||||
|
|
||||||
|
var root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||||
|
root_child0.setFlexShrink(1);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
var root_child0_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0_child0.setFlexGrow(1);
|
||||||
|
root_child0_child0.setFlexShrink(1);
|
||||||
|
root_child0.insertChild(root_child0_child0, 0);
|
||||||
|
|
||||||
|
var root_child0_child0_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0_child0_child0.setWidth(20);
|
||||||
|
root_child0_child0_child0.setHeight(20);
|
||||||
|
root_child0_child0.insertChild(root_child0_child0_child0, 0);
|
||||||
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_LTR);
|
||||||
|
|
||||||
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||||
|
console.assert(20 === root.getComputedTop(), "20 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||||
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||||
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
|
console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")");
|
||||||
|
console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0_child0_child0.getComputedLeft(), "0 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")");
|
||||||
|
console.assert(20 === root_child0_child0_child0.getComputedWidth(), "20 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(20 === root_child0_child0_child0.getComputedHeight(), "20 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
root.calculateLayout(Yoga.UNDEFINED, Yoga.UNDEFINED, Yoga.DIRECTION_RTL);
|
||||||
|
|
||||||
|
console.assert(0 === root.getComputedLeft(), "0 === root.getComputedLeft() (" + root.getComputedLeft() + ")");
|
||||||
|
console.assert(20 === root.getComputedTop(), "20 === root.getComputedTop() (" + root.getComputedTop() + ")");
|
||||||
|
console.assert(100 === root.getComputedWidth(), "100 === root.getComputedWidth() (" + root.getComputedWidth() + ")");
|
||||||
|
console.assert(100 === root.getComputedHeight(), "100 === root.getComputedHeight() (" + root.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0.getComputedLeft(), "0 === root_child0.getComputedLeft() (" + root_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0.getComputedTop(), "0 === root_child0.getComputedTop() (" + root_child0.getComputedTop() + ")");
|
||||||
|
console.assert(100 === root_child0.getComputedWidth(), "100 === root_child0.getComputedWidth() (" + root_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(20 === root_child0.getComputedHeight(), "20 === root_child0.getComputedHeight() (" + root_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(0 === root_child0_child0.getComputedLeft(), "0 === root_child0_child0.getComputedLeft() (" + root_child0_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0_child0.getComputedTop(), "0 === root_child0_child0.getComputedTop() (" + root_child0_child0.getComputedTop() + ")");
|
||||||
|
console.assert(100 === root_child0_child0.getComputedWidth(), "100 === root_child0_child0.getComputedWidth() (" + root_child0_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(20 === root_child0_child0.getComputedHeight(), "20 === root_child0_child0.getComputedHeight() (" + root_child0_child0.getComputedHeight() + ")");
|
||||||
|
|
||||||
|
console.assert(80 === root_child0_child0_child0.getComputedLeft(), "80 === root_child0_child0_child0.getComputedLeft() (" + root_child0_child0_child0.getComputedLeft() + ")");
|
||||||
|
console.assert(0 === root_child0_child0_child0.getComputedTop(), "0 === root_child0_child0_child0.getComputedTop() (" + root_child0_child0_child0.getComputedTop() + ")");
|
||||||
|
console.assert(20 === root_child0_child0_child0.getComputedWidth(), "20 === root_child0_child0_child0.getComputedWidth() (" + root_child0_child0_child0.getComputedWidth() + ")");
|
||||||
|
console.assert(20 === root_child0_child0_child0.getComputedHeight(), "20 === root_child0_child0_child0.getComputedHeight() (" + root_child0_child0_child0.getComputedHeight() + ")");
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== "undefined") {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@@ -380,8 +380,6 @@ it("justify_content_overflow_min_max", function () {
|
|||||||
it("flex_grow_to_min", function () {
|
it("flex_grow_to_min", function () {
|
||||||
var config = Yoga.Config.create();
|
var config = Yoga.Config.create();
|
||||||
|
|
||||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_MIN_FLEX_FIX, true);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var root = Yoga.Node.create(config);
|
var root = Yoga.Node.create(config);
|
||||||
root.setWidth(100);
|
root.setWidth(100);
|
||||||
@@ -440,8 +438,6 @@ it("flex_grow_to_min", function () {
|
|||||||
it("flex_grow_in_at_most_container", function () {
|
it("flex_grow_in_at_most_container", function () {
|
||||||
var config = Yoga.Config.create();
|
var config = Yoga.Config.create();
|
||||||
|
|
||||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_MIN_FLEX_FIX, true);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var root = Yoga.Node.create(config);
|
var root = Yoga.Node.create(config);
|
||||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||||
|
@@ -1094,8 +1094,6 @@ it("percent_within_flex_grow", function () {
|
|||||||
it("percentage_container_in_wrapping_container", function () {
|
it("percentage_container_in_wrapping_container", function () {
|
||||||
var config = Yoga.Config.create();
|
var config = Yoga.Config.create();
|
||||||
|
|
||||||
config.setExperimentalFeatureEnabled(Yoga.EXPERIMENTAL_FEATURE_MIN_FLEX_FIX, true);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var root = Yoga.Node.create(config);
|
var root = Yoga.Node.create(config);
|
||||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||||
|
@@ -1809,3 +1809,146 @@ TEST(YogaTest, align_items_flex_end_child_without_margin_bigger_than_parent) {
|
|||||||
|
|
||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, align_center_should_size_based_on_content) {
|
||||||
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetAlignItems(root, YGAlignCenter);
|
||||||
|
YGNodeStyleSetMargin(root, YGEdgeTop, 20);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetJustifyContent(root_child0, YGJustifyCenter);
|
||||||
|
YGNodeStyleSetFlexShrink(root_child0, 1);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexGrow(root_child0_child0, 1);
|
||||||
|
YGNodeStyleSetFlexShrink(root_child0_child0, 1);
|
||||||
|
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child0_child0_child0, 20);
|
||||||
|
YGNodeStyleSetHeight(root_child0_child0_child0, 20);
|
||||||
|
YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, align_strech_should_size_based_on_parent) {
|
||||||
|
const YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetMargin(root, YGEdgeTop, 20);
|
||||||
|
YGNodeStyleSetWidth(root, 100);
|
||||||
|
YGNodeStyleSetHeight(root, 100);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetJustifyContent(root_child0, YGJustifyCenter);
|
||||||
|
YGNodeStyleSetFlexShrink(root_child0, 1);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexGrow(root_child0_child0, 1);
|
||||||
|
YGNodeStyleSetFlexShrink(root_child0_child0, 1);
|
||||||
|
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||||
|
|
||||||
|
const YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root_child0_child0_child0, 20);
|
||||||
|
YGNodeStyleSetHeight(root_child0_child0_child0, 20);
|
||||||
|
YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(80, YGNodeLayoutGetLeft(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetWidth(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child0_child0_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
@@ -359,7 +359,6 @@ TEST(YogaTest, justify_content_overflow_min_max) {
|
|||||||
|
|
||||||
TEST(YogaTest, flex_grow_to_min) {
|
TEST(YogaTest, flex_grow_to_min) {
|
||||||
const YGConfigRef config = YGConfigNew();
|
const YGConfigRef config = YGConfigNew();
|
||||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureMinFlexFix, true);
|
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetWidth(root, 100);
|
YGNodeStyleSetWidth(root, 100);
|
||||||
@@ -415,7 +414,6 @@ TEST(YogaTest, flex_grow_to_min) {
|
|||||||
|
|
||||||
TEST(YogaTest, flex_grow_in_at_most_container) {
|
TEST(YogaTest, flex_grow_in_at_most_container) {
|
||||||
const YGConfigRef config = YGConfigNew();
|
const YGConfigRef config = YGConfigNew();
|
||||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureMinFlexFix, true);
|
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
|
||||||
|
@@ -1040,7 +1040,6 @@ TEST(YogaTest, percent_within_flex_grow) {
|
|||||||
|
|
||||||
TEST(YogaTest, percentage_container_in_wrapping_container) {
|
TEST(YogaTest, percentage_container_in_wrapping_container) {
|
||||||
const YGConfigRef config = YGConfigNew();
|
const YGConfigRef config = YGConfigNew();
|
||||||
YGConfigSetExperimentalFeatureEnabled(config, YGExperimentalFeatureMinFlexFix, true);
|
|
||||||
|
|
||||||
const YGNodeRef root = YGNodeNewWithConfig(config);
|
const YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
YGNodeStyleSetJustifyContent(root, YGJustifyCenter);
|
||||||
|
@@ -91,8 +91,6 @@ const char *YGExperimentalFeatureToString(const YGExperimentalFeature value){
|
|||||||
switch(value){
|
switch(value){
|
||||||
case YGExperimentalFeatureWebFlexBasis:
|
case YGExperimentalFeatureWebFlexBasis:
|
||||||
return "web-flex-basis";
|
return "web-flex-basis";
|
||||||
case YGExperimentalFeatureMinFlexFix:
|
|
||||||
return "min-flex-fix";
|
|
||||||
}
|
}
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
@@ -62,10 +62,9 @@ typedef YG_ENUM_BEGIN(YGEdge) {
|
|||||||
} YG_ENUM_END(YGEdge);
|
} YG_ENUM_END(YGEdge);
|
||||||
WIN_EXPORT const char *YGEdgeToString(const YGEdge value);
|
WIN_EXPORT const char *YGEdgeToString(const YGEdge value);
|
||||||
|
|
||||||
#define YGExperimentalFeatureCount 2
|
#define YGExperimentalFeatureCount 1
|
||||||
typedef YG_ENUM_BEGIN(YGExperimentalFeature) {
|
typedef YG_ENUM_BEGIN(YGExperimentalFeature) {
|
||||||
YGExperimentalFeatureWebFlexBasis,
|
YGExperimentalFeatureWebFlexBasis,
|
||||||
YGExperimentalFeatureMinFlexFix,
|
|
||||||
} YG_ENUM_END(YGExperimentalFeature);
|
} YG_ENUM_END(YGExperimentalFeature);
|
||||||
WIN_EXPORT const char *YGExperimentalFeatureToString(const YGExperimentalFeature value);
|
WIN_EXPORT const char *YGExperimentalFeatureToString(const YGExperimentalFeature value);
|
||||||
|
|
||||||
|
16
yoga/Yoga.c
16
yoga/Yoga.c
@@ -97,6 +97,7 @@ typedef struct YGStyle {
|
|||||||
typedef struct YGConfig {
|
typedef struct YGConfig {
|
||||||
bool experimentalFeatures[YGExperimentalFeatureCount + 1];
|
bool experimentalFeatures[YGExperimentalFeatureCount + 1];
|
||||||
bool useWebDefaults;
|
bool useWebDefaults;
|
||||||
|
bool useLegacyStretchBehaviour;
|
||||||
float pointScaleFactor;
|
float pointScaleFactor;
|
||||||
} YGConfig;
|
} YGConfig;
|
||||||
|
|
||||||
@@ -202,7 +203,6 @@ static YGNode gYGNodeDefaults = {
|
|||||||
static YGConfig gYGConfigDefaults = {
|
static YGConfig gYGConfigDefaults = {
|
||||||
.experimentalFeatures =
|
.experimentalFeatures =
|
||||||
{
|
{
|
||||||
[YGExperimentalFeatureMinFlexFix] = false,
|
|
||||||
[YGExperimentalFeatureWebFlexBasis] = false,
|
[YGExperimentalFeatureWebFlexBasis] = false,
|
||||||
},
|
},
|
||||||
.useWebDefaults = false,
|
.useWebDefaults = false,
|
||||||
@@ -2199,23 +2199,25 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
// If the main dimension size isn't known, it is computed based on
|
// If the main dimension size isn't known, it is computed based on
|
||||||
// the line length, so there's no more space left to distribute.
|
// the line length, so there's no more space left to distribute.
|
||||||
|
|
||||||
|
bool sizeBasedOnContent = false;
|
||||||
// If we don't measure with exact main dimension we want to ensure we don't violate min and max
|
// If we don't measure with exact main dimension we want to ensure we don't violate min and max
|
||||||
if (measureModeMainDim != YGMeasureModeExactly) {
|
if (measureModeMainDim != YGMeasureModeExactly) {
|
||||||
if (!YGFloatIsUndefined(minInnerMainDim) && sizeConsumedOnCurrentLine < minInnerMainDim) {
|
if (!YGFloatIsUndefined(minInnerMainDim) && sizeConsumedOnCurrentLine < minInnerMainDim) {
|
||||||
availableInnerMainDim = minInnerMainDim;
|
availableInnerMainDim = minInnerMainDim;
|
||||||
} else if (!YGFloatIsUndefined(maxInnerMainDim) && sizeConsumedOnCurrentLine > maxInnerMainDim) {
|
} else if (!YGFloatIsUndefined(maxInnerMainDim) && sizeConsumedOnCurrentLine > maxInnerMainDim) {
|
||||||
availableInnerMainDim = maxInnerMainDim;
|
availableInnerMainDim = maxInnerMainDim;
|
||||||
} else if (YGConfigIsExperimentalFeatureEnabled(node->config, YGExperimentalFeatureMinFlexFix) &&
|
} else {
|
||||||
(totalFlexGrowFactors == 0 || YGResolveFlexGrow(node) == 0)) {
|
if (!node->config->useLegacyStretchBehaviour && (totalFlexGrowFactors == 0 || YGResolveFlexGrow(node) == 0)) {
|
||||||
// TODO: this needs to be moved out of experimental feature, as this is legitimate fix
|
|
||||||
// If we don't have any children to flex or we can't flex the node itself,
|
// If we don't have any children to flex or we can't flex the node itself,
|
||||||
// space we've used is all space we need
|
// space we've used is all space we need
|
||||||
availableInnerMainDim = sizeConsumedOnCurrentLine;
|
availableInnerMainDim = sizeConsumedOnCurrentLine;
|
||||||
}
|
}
|
||||||
|
sizeBasedOnContent = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float remainingFreeSpace = 0;
|
float remainingFreeSpace = 0;
|
||||||
if (!YGFloatIsUndefined(availableInnerMainDim)) {
|
if ((!sizeBasedOnContent || node->config->useLegacyStretchBehaviour) && !YGFloatIsUndefined(availableInnerMainDim)) {
|
||||||
remainingFreeSpace = availableInnerMainDim - sizeConsumedOnCurrentLine;
|
remainingFreeSpace = availableInnerMainDim - sizeConsumedOnCurrentLine;
|
||||||
} else if (sizeConsumedOnCurrentLine < 0) {
|
} else if (sizeConsumedOnCurrentLine < 0) {
|
||||||
// availableInnerMainDim is indefinite which means the node is being sized
|
// availableInnerMainDim is indefinite which means the node is being sized
|
||||||
@@ -3427,6 +3429,10 @@ void YGConfigSetUseWebDefaults(const YGConfigRef config, const bool enabled) {
|
|||||||
config->useWebDefaults = enabled;
|
config->useWebDefaults = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void YGConfigSetUseLegacyStretchBehaviour(const YGConfigRef config, const bool useLegacyStretchBehaviour) {
|
||||||
|
config->useLegacyStretchBehaviour = useLegacyStretchBehaviour;
|
||||||
|
}
|
||||||
|
|
||||||
bool YGConfigGetUseWebDefaults(const YGConfigRef config) {
|
bool YGConfigGetUseWebDefaults(const YGConfigRef config) {
|
||||||
return config->useWebDefaults;
|
return config->useWebDefaults;
|
||||||
}
|
}
|
||||||
|
@@ -225,6 +225,11 @@ WIN_EXPORT void YGLog(YGLogLevel level, const char *message, ...);
|
|||||||
// If you want to avoid rounding - set PointScaleFactor to 0
|
// If you want to avoid rounding - set PointScaleFactor to 0
|
||||||
WIN_EXPORT void YGConfigSetPointScaleFactor(const YGConfigRef config, const float pixelsInPoint);
|
WIN_EXPORT void YGConfigSetPointScaleFactor(const YGConfigRef config, const float pixelsInPoint);
|
||||||
|
|
||||||
|
// Yoga previously had an error where containers would take the maximum space possible instead of the minimum
|
||||||
|
// like they are supposed to. In practice this resulted in implicit behaviour similar to align-self: stretch;
|
||||||
|
// Because this was such a long-standing bug we must allow legacy users to switch back to this behaviour.
|
||||||
|
WIN_EXPORT void YGConfigSetUseLegacyStretchBehaviour(const YGConfigRef config, const bool useLegacyStretchBehaviour);
|
||||||
|
|
||||||
// YGConfig
|
// YGConfig
|
||||||
WIN_EXPORT YGConfigRef YGConfigNew(void);
|
WIN_EXPORT YGConfigRef YGConfigNew(void);
|
||||||
WIN_EXPORT void YGConfigFree(const YGConfigRef config);
|
WIN_EXPORT void YGConfigFree(const YGConfigRef config);
|
||||||
|
Reference in New Issue
Block a user