Compare commits
30 Commits
export-D70
...
export-D80
Author | SHA1 | Date | |
---|---|---|---|
|
0ef6192b16 | ||
|
c582f7caa6 | ||
|
bf1cbd29c0 | ||
|
499a825836 | ||
|
8087edaafe | ||
|
c90aecbdfe | ||
|
c54215fd77 | ||
|
cf50bc9adf | ||
|
d1037226c0 | ||
|
714d4b2ebe | ||
|
d4b5220e6c | ||
|
da5ba7f7c6 | ||
|
8bf7a34d02 | ||
|
82671c0132 | ||
|
9f2a9476e5 | ||
|
c7c85621fc | ||
|
73980a3cf8 | ||
|
4b5ca50117 | ||
|
30291398f3 | ||
|
27d632c697 | ||
|
117fa494f7 | ||
|
073c136117 | ||
|
1232761571 | ||
|
c935fd5e10 | ||
|
624325302c | ||
|
37a94a86de | ||
|
4abc1a7d5f | ||
|
51e6095005 | ||
|
79cef614ce | ||
|
6455a848a7 |
@@ -24,7 +24,7 @@ jobs:
|
|||||||
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
|
ORG_GRADLE_PROJECT_SIGNING_PWD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNING_PWD }}
|
||||||
|
|
||||||
- name: Upload Build Artifacts
|
- name: Upload Build Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: 'snapshot-artifacts'
|
name: 'snapshot-artifacts'
|
||||||
path: '~/.m2/repository/'
|
path: '~/.m2/repository/'
|
||||||
|
@@ -23,7 +23,7 @@ jobs:
|
|||||||
ORG_GRADLE_PROJECT_USE_SNAPSHOT: true
|
ORG_GRADLE_PROJECT_USE_SNAPSHOT: true
|
||||||
|
|
||||||
- name: Upload Build Artifacts
|
- name: Upload Build Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: 'snapshot-artifacts'
|
name: 'snapshot-artifacts'
|
||||||
path: '~/.m2/repository/'
|
path: '~/.m2/repository/'
|
||||||
|
2
.github/workflows/validate-js.yml
vendored
2
.github/workflows/validate-js.yml
vendored
@@ -110,7 +110,7 @@ jobs:
|
|||||||
run: yarn pack --filename yoga-layout.tar.gz
|
run: yarn pack --filename yoga-layout.tar.gz
|
||||||
working-directory: javascript
|
working-directory: javascript
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: npm-package
|
name: npm-package
|
||||||
path: javascript/yoga-layout.tar.gz
|
path: javascript/yoga-layout.tar.gz
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@@ -73,3 +73,6 @@ local.properties
|
|||||||
|
|
||||||
# Docusarus build
|
# Docusarus build
|
||||||
.docusaurus
|
.docusaurus
|
||||||
|
|
||||||
|
# Android Studio
|
||||||
|
.idea
|
||||||
|
@@ -9,6 +9,7 @@ plugins {
|
|||||||
id("com.android.library") version "8.7.1" apply false
|
id("com.android.library") version "8.7.1" apply false
|
||||||
id("com.android.application") version "8.7.1" apply false
|
id("com.android.application") version "8.7.1" apply false
|
||||||
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
|
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
|
||||||
|
id 'org.jetbrains.kotlin.android' version '2.1.20' apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
@@ -34,6 +35,8 @@ nexusPublishing {
|
|||||||
sonatype {
|
sonatype {
|
||||||
username.set(sonatypeUsername)
|
username.set(sonatypeUsername)
|
||||||
password.set(sonatypePassword)
|
password.set(sonatypePassword)
|
||||||
|
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
|
||||||
|
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -240,3 +240,14 @@
|
|||||||
<div style="position:relative; width:50px; height:50px;">
|
<div style="position:relative; width:50px; height:50px;">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="align_items_non_stretch_s526008"
|
||||||
|
style="flex-direction: column; width: 400px; height: 400px;">
|
||||||
|
<div style="flex-direction: row;">
|
||||||
|
<div style="flex-direction: column; align-items: flex-start;">
|
||||||
|
<div>
|
||||||
|
<div style="width: 0; height: 10px;"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@@ -1,17 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// You can use this script to configure the gradleEnterprise{} block in your build.
|
|
||||||
// You need to rename this file to ./gradle/gradle-enterprise.gradle.kts in order for
|
|
||||||
// this to be processed.
|
|
||||||
extensions.getByName("gradleEnterprise").withGroovyBuilder {
|
|
||||||
setProperty("server", "https://your-gradle-enterprise-instance.example.com")
|
|
||||||
getProperty("buildScan").withGroovyBuilder {
|
|
||||||
"publishAlways"()
|
|
||||||
"tag"(if(System.getenv("CI") != null) "CI" else "Local")
|
|
||||||
}
|
|
||||||
}
|
|
@@ -9,6 +9,7 @@ plugins {
|
|||||||
id("com.android.library")
|
id("com.android.library")
|
||||||
id("maven-publish")
|
id("maven-publish")
|
||||||
id("signing")
|
id("signing")
|
||||||
|
id("org.jetbrains.kotlin.android")
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "com.facebook.yoga"
|
group = "com.facebook.yoga"
|
||||||
@@ -48,6 +49,8 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
kotlinOptions { jvmTarget = "1.8" }
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
multipleVariants {
|
multipleVariants {
|
||||||
withSourcesJar()
|
withSourcesJar()
|
||||||
@@ -60,6 +63,7 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation("com.google.code.findbugs:jsr305:3.0.2")
|
implementation("com.google.code.findbugs:jsr305:3.0.2")
|
||||||
implementation("com.facebook.soloader:soloader:0.10.5")
|
implementation("com.facebook.soloader:soloader:0.10.5")
|
||||||
|
implementation("androidx.core:core-ktx:1.16.0")
|
||||||
testImplementation("junit:junit:4.12")
|
testImplementation("junit:junit:4.12")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,43 +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 enum LayoutPassReason {
|
|
||||||
INITIAL(0),
|
|
||||||
ABS_LAYOUT(1),
|
|
||||||
STRETCH(2),
|
|
||||||
MULTILINE_STRETCH(3),
|
|
||||||
FLEX_LAYOUT(4),
|
|
||||||
MEASURE(5),
|
|
||||||
ABS_MEASURE(6),
|
|
||||||
FLEX_MEASURE(7);
|
|
||||||
|
|
||||||
private final int mIntValue;
|
|
||||||
|
|
||||||
LayoutPassReason(int intValue) {
|
|
||||||
mIntValue = intValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int intValue() {
|
|
||||||
return mIntValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LayoutPassReason fromInt(int value) {
|
|
||||||
switch (value) {
|
|
||||||
case 0: return INITIAL;
|
|
||||||
case 1: return ABS_LAYOUT;
|
|
||||||
case 2: return STRETCH;
|
|
||||||
case 3: return MULTILINE_STRETCH;
|
|
||||||
case 4: return FLEX_LAYOUT;
|
|
||||||
case 5: return MEASURE;
|
|
||||||
case 6: return ABS_MEASURE;
|
|
||||||
case 7: return FLEX_MEASURE;
|
|
||||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
35
java/com/facebook/yoga/LayoutPassReason.kt
Normal file
35
java/com/facebook/yoga/LayoutPassReason.kt
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* 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 enum class LayoutPassReason(public val intValue: Int) {
|
||||||
|
INITIAL(0),
|
||||||
|
ABS_LAYOUT(1),
|
||||||
|
STRETCH(2),
|
||||||
|
MULTILINE_STRETCH(3),
|
||||||
|
FLEX_LAYOUT(4),
|
||||||
|
MEASURE(5),
|
||||||
|
ABS_MEASURE(6),
|
||||||
|
FLEX_MEASURE(7);
|
||||||
|
|
||||||
|
public companion object {
|
||||||
|
@JvmStatic
|
||||||
|
public fun fromInt(value: Int): LayoutPassReason =
|
||||||
|
when (value) {
|
||||||
|
0 -> INITIAL
|
||||||
|
1 -> ABS_LAYOUT
|
||||||
|
2 -> STRETCH
|
||||||
|
3 -> MULTILINE_STRETCH
|
||||||
|
4 -> FLEX_LAYOUT
|
||||||
|
5 -> MEASURE
|
||||||
|
6 -> ABS_MEASURE
|
||||||
|
7 -> FLEX_MEASURE
|
||||||
|
else -> throw IllegalArgumentException("Unknown enum value: $value")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -5,12 +5,12 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga
|
||||||
|
|
||||||
public interface YogaBaselineFunction {
|
public fun interface YogaBaselineFunction {
|
||||||
/**
|
/**
|
||||||
* Return the baseline of the node in points. When no baseline function is set the baseline
|
* Return the baseline of the node in points. When no baseline function is set the baseline
|
||||||
* default to the computed height of the node.
|
* default to the computed height of the node.
|
||||||
*/
|
*/
|
||||||
float baseline(YogaNode node, float width, float height);
|
public fun baseline(node: YogaNode, width: Float, height: Float): Float
|
||||||
}
|
}
|
@@ -5,10 +5,8 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga
|
||||||
|
|
||||||
public abstract class YogaConfigFactory {
|
public object YogaConfigFactory {
|
||||||
public static YogaConfig create() {
|
@JvmStatic public fun create(): YogaConfig = YogaConfigJNIFinalizer()
|
||||||
return new YogaConfigJNIFinalizer();
|
|
||||||
}
|
|
||||||
}
|
}
|
@@ -1,25 +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 YogaConstants {
|
|
||||||
|
|
||||||
public static final float UNDEFINED = Float.NaN;
|
|
||||||
|
|
||||||
public static boolean isUndefined(float value) {
|
|
||||||
return Float.compare(value, UNDEFINED) == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isUndefined(YogaValue value) {
|
|
||||||
return value.unit == YogaUnit.UNDEFINED;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getUndefined() {
|
|
||||||
return UNDEFINED;
|
|
||||||
}
|
|
||||||
}
|
|
18
java/com/facebook/yoga/YogaConstants.kt
Normal file
18
java/com/facebook/yoga/YogaConstants.kt
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* 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 object YogaConstants {
|
||||||
|
@JvmField public val UNDEFINED: Float = Float.NaN
|
||||||
|
|
||||||
|
@JvmStatic public fun isUndefined(value: Float): Boolean = value.compareTo(UNDEFINED) == 0
|
||||||
|
|
||||||
|
@JvmStatic public fun isUndefined(value: YogaValue): Boolean = value.unit == YogaUnit.UNDEFINED
|
||||||
|
|
||||||
|
@JvmStatic public fun getUndefined(): Float = UNDEFINED
|
||||||
|
}
|
@@ -1,35 +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 enum YogaLayoutType {
|
|
||||||
LAYOUT(0),
|
|
||||||
MEASURE(1),
|
|
||||||
CACHED_LAYOUT(2),
|
|
||||||
CACHED_MEASURE(3);
|
|
||||||
|
|
||||||
private final int mIntValue;
|
|
||||||
|
|
||||||
YogaLayoutType(int intValue) {
|
|
||||||
mIntValue = intValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int intValue() {
|
|
||||||
return mIntValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static YogaLayoutType fromInt(int value) {
|
|
||||||
switch (value) {
|
|
||||||
case 0: return LAYOUT;
|
|
||||||
case 1: return MEASURE;
|
|
||||||
case 2: return CACHED_LAYOUT;
|
|
||||||
case 3: return CACHED_MEASURE;
|
|
||||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
27
java/com/facebook/yoga/YogaLayoutType.kt
Normal file
27
java/com/facebook/yoga/YogaLayoutType.kt
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* 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 enum class YogaLayoutType(public val intValue: Int) {
|
||||||
|
LAYOUT(0),
|
||||||
|
MEASURE(1),
|
||||||
|
CACHED_LAYOUT(2),
|
||||||
|
CACHED_MEASURE(3);
|
||||||
|
|
||||||
|
public companion object {
|
||||||
|
@JvmStatic
|
||||||
|
public fun fromInt(value: Int): YogaLayoutType =
|
||||||
|
when (value) {
|
||||||
|
0 -> LAYOUT
|
||||||
|
1 -> MEASURE
|
||||||
|
2 -> CACHED_LAYOUT
|
||||||
|
3 -> CACHED_MEASURE
|
||||||
|
else -> throw IllegalArgumentException("Unknown enum value: $value")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -5,16 +5,15 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga
|
||||||
|
|
||||||
import com.facebook.yoga.annotations.DoNotStrip;
|
import com.facebook.yoga.annotations.DoNotStrip
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for receiving logs from native layer. Use by setting YogaNode.setLogger(myLogger);
|
* Interface for receiving logs from native layer. Use by setting YogaNode.setLogger(myLogger); See
|
||||||
* See YogaLogLevel for the different log levels.
|
* YogaLogLevel for the different log levels.
|
||||||
*/
|
*/
|
||||||
@DoNotStrip
|
@DoNotStrip
|
||||||
public interface YogaLogger {
|
public fun interface YogaLogger {
|
||||||
@DoNotStrip
|
@DoNotStrip public fun log(level: YogaLogLevel, message: String)
|
||||||
void log(YogaLogLevel level, String message);
|
|
||||||
}
|
}
|
@@ -1,20 +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 YogaMeasureFunction {
|
|
||||||
/**
|
|
||||||
* Return a value created by YogaMeasureOutput.make(width, height);
|
|
||||||
*/
|
|
||||||
long measure(
|
|
||||||
YogaNode node,
|
|
||||||
float width,
|
|
||||||
YogaMeasureMode widthMode,
|
|
||||||
float height,
|
|
||||||
YogaMeasureMode heightMode);
|
|
||||||
}
|
|
19
java/com/facebook/yoga/YogaMeasureFunction.kt
Normal file
19
java/com/facebook/yoga/YogaMeasureFunction.kt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* 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 fun interface YogaMeasureFunction {
|
||||||
|
/** Return a value created by YogaMeasureOutput.make(width, height); */
|
||||||
|
public fun measure(
|
||||||
|
node: YogaNode,
|
||||||
|
width: Float,
|
||||||
|
widthMode: YogaMeasureMode,
|
||||||
|
height: Float,
|
||||||
|
heightMode: YogaMeasureMode
|
||||||
|
): Long
|
||||||
|
}
|
@@ -1,32 +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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helpers for building measure output value.
|
|
||||||
*/
|
|
||||||
public class YogaMeasureOutput {
|
|
||||||
|
|
||||||
public static long make(float width, float height) {
|
|
||||||
final int wBits = Float.floatToRawIntBits(width);
|
|
||||||
final int hBits = Float.floatToRawIntBits(height);
|
|
||||||
return ((long) wBits) << 32 | ((long) hBits);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long make(int width, int height) {
|
|
||||||
return make((float) width, (float) height);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getWidth(long measureOutput) {
|
|
||||||
return Float.intBitsToFloat((int) (0xFFFFFFFF & (measureOutput >> 32)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float getHeight(long measureOutput) {
|
|
||||||
return Float.intBitsToFloat((int) (0xFFFFFFFF & measureOutput));
|
|
||||||
}
|
|
||||||
}
|
|
29
java/com/facebook/yoga/YogaMeasureOutput.kt
Normal file
29
java/com/facebook/yoga/YogaMeasureOutput.kt
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
|
||||||
|
|
||||||
|
/** Helpers for building measure output value. */
|
||||||
|
public object YogaMeasureOutput {
|
||||||
|
@JvmStatic
|
||||||
|
public fun make(width: Float, height: Float): Long {
|
||||||
|
val wBits = java.lang.Float.floatToRawIntBits(width)
|
||||||
|
val hBits = java.lang.Float.floatToRawIntBits(height)
|
||||||
|
return (wBits.toLong()) shl 32 or (hBits.toLong())
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public fun make(width: Int, height: Int): Long = make(width.toFloat(), height.toFloat())
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public fun getWidth(measureOutput: Long): Float =
|
||||||
|
java.lang.Float.intBitsToFloat((0xFFFFFFFFL and (measureOutput shr 32)).toInt())
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public fun getHeight(measureOutput: Long): Float =
|
||||||
|
java.lang.Float.intBitsToFloat((0xFFFFFFFFL and measureOutput).toInt())
|
||||||
|
}
|
@@ -1,141 +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;
|
|
||||||
|
|
||||||
import com.facebook.yoga.annotations.DoNotStrip;
|
|
||||||
import com.facebook.soloader.SoLoader;
|
|
||||||
|
|
||||||
@DoNotStrip
|
|
||||||
public class YogaNative {
|
|
||||||
static {
|
|
||||||
SoLoader.loadLibrary("yoga");
|
|
||||||
}
|
|
||||||
|
|
||||||
// JNI methods that use Vanilla JNI
|
|
||||||
// YGConfig related
|
|
||||||
static native long jni_YGConfigNewJNI();
|
|
||||||
static native void jni_YGConfigFreeJNI(long nativePointer);
|
|
||||||
static native void jni_YGConfigSetExperimentalFeatureEnabledJNI(long nativePointer, int feature, boolean enabled);
|
|
||||||
static native void jni_YGConfigSetUseWebDefaultsJNI(long nativePointer, boolean useWebDefaults);
|
|
||||||
static native void jni_YGConfigSetPointScaleFactorJNI(long nativePointer, float pixelsInPoint);
|
|
||||||
static native void jni_YGConfigSetErrataJNI(long nativePointer, int errata);
|
|
||||||
static native int jni_YGConfigGetErrataJNI(long nativePointer);
|
|
||||||
static native void jni_YGConfigSetLoggerJNI(long nativePointer, YogaLogger logger);
|
|
||||||
|
|
||||||
// YGNode related
|
|
||||||
static native long jni_YGNodeNewJNI();
|
|
||||||
static native long jni_YGNodeNewWithConfigJNI(long configPointer);
|
|
||||||
static native void jni_YGNodeFinalizeJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeResetJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeInsertChildJNI(long nativePointer, long childPointer, int index);
|
|
||||||
static native void jni_YGNodeSwapChildJNI(long nativePointer, long childPointer, int index);
|
|
||||||
static native void jni_YGNodeSetIsReferenceBaselineJNI(long nativePointer, boolean isReferenceBaseline);
|
|
||||||
static native boolean jni_YGNodeIsReferenceBaselineJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeRemoveAllChildrenJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeRemoveChildJNI(long nativePointer, long childPointer);
|
|
||||||
static native void jni_YGNodeCalculateLayoutJNI(long nativePointer, float width, float height, long[] nativePointers, YogaNodeJNIBase[] nodes);
|
|
||||||
static native void jni_YGNodeMarkDirtyJNI(long nativePointer);
|
|
||||||
static native boolean jni_YGNodeIsDirtyJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeCopyStyleJNI(long dstNativePointer, long srcNativePointer);
|
|
||||||
static native int jni_YGNodeStyleGetDirectionJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetDirectionJNI(long nativePointer, int direction);
|
|
||||||
static native int jni_YGNodeStyleGetFlexDirectionJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetFlexDirectionJNI(long nativePointer, int flexDirection);
|
|
||||||
static native int jni_YGNodeStyleGetJustifyContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetJustifyContentJNI(long nativePointer, int justifyContent);
|
|
||||||
static native int jni_YGNodeStyleGetAlignItemsJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetAlignItemsJNI(long nativePointer, int alignItems);
|
|
||||||
static native int jni_YGNodeStyleGetAlignSelfJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetAlignSelfJNI(long nativePointer, int alignSelf);
|
|
||||||
static native int jni_YGNodeStyleGetAlignContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetAlignContentJNI(long nativePointer, int alignContent);
|
|
||||||
static native int jni_YGNodeStyleGetPositionTypeJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetPositionTypeJNI(long nativePointer, int positionType);
|
|
||||||
static native int jni_YGNodeStyleGetBoxSizingJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetBoxSizingJNI(long nativePointer, int boxSizing);
|
|
||||||
static native int jni_YGNodeStyleGetFlexWrapJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetFlexWrapJNI(long nativePointer, int wrapType);
|
|
||||||
static native int jni_YGNodeStyleGetOverflowJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetOverflowJNI(long nativePointer, int overflow);
|
|
||||||
static native int jni_YGNodeStyleGetDisplayJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetDisplayJNI(long nativePointer, int display);
|
|
||||||
static native float jni_YGNodeStyleGetFlexJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetFlexJNI(long nativePointer, float flex);
|
|
||||||
static native float jni_YGNodeStyleGetFlexGrowJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetFlexGrowJNI(long nativePointer, float flexGrow);
|
|
||||||
static native float jni_YGNodeStyleGetFlexShrinkJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetFlexShrinkJNI(long nativePointer, float flexShrink);
|
|
||||||
static native long jni_YGNodeStyleGetFlexBasisJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetFlexBasisJNI(long nativePointer, float flexBasis);
|
|
||||||
static native void jni_YGNodeStyleSetFlexBasisPercentJNI(long nativePointer, float percent);
|
|
||||||
static native void jni_YGNodeStyleSetFlexBasisAutoJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetFlexBasisMaxContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetFlexBasisFitContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetFlexBasisStretchJNI(long nativePointer);
|
|
||||||
static native long jni_YGNodeStyleGetMarginJNI(long nativePointer, int edge);
|
|
||||||
static native void jni_YGNodeStyleSetMarginJNI(long nativePointer, int edge, float margin);
|
|
||||||
static native void jni_YGNodeStyleSetMarginPercentJNI(long nativePointer, int edge, float percent);
|
|
||||||
static native void jni_YGNodeStyleSetMarginAutoJNI(long nativePointer, int edge);
|
|
||||||
static native long jni_YGNodeStyleGetPaddingJNI(long nativePointer, int edge);
|
|
||||||
static native void jni_YGNodeStyleSetPaddingJNI(long nativePointer, int edge, float padding);
|
|
||||||
static native void jni_YGNodeStyleSetPaddingPercentJNI(long nativePointer, int edge, float percent);
|
|
||||||
static native float jni_YGNodeStyleGetBorderJNI(long nativePointer, int edge);
|
|
||||||
static native void jni_YGNodeStyleSetBorderJNI(long nativePointer, int edge, float border);
|
|
||||||
static native long jni_YGNodeStyleGetPositionJNI(long nativePointer, int edge);
|
|
||||||
static native void jni_YGNodeStyleSetPositionJNI(long nativePointer, int edge, float position);
|
|
||||||
static native void jni_YGNodeStyleSetPositionPercentJNI(long nativePointer, int edge, float percent);
|
|
||||||
static native void jni_YGNodeStyleSetPositionAutoJNI(long nativePointer, int edge);
|
|
||||||
static native long jni_YGNodeStyleGetWidthJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetWidthJNI(long nativePointer, float width);
|
|
||||||
static native void jni_YGNodeStyleSetWidthPercentJNI(long nativePointer, float percent);
|
|
||||||
static native void jni_YGNodeStyleSetWidthAutoJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetWidthMaxContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetWidthFitContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetWidthStretchJNI(long nativePointer);
|
|
||||||
static native long jni_YGNodeStyleGetHeightJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetHeightJNI(long nativePointer, float height);
|
|
||||||
static native void jni_YGNodeStyleSetHeightPercentJNI(long nativePointer, float percent);
|
|
||||||
static native void jni_YGNodeStyleSetHeightAutoJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetHeightMaxContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetHeightFitContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetHeightStretchJNI(long nativePointer);
|
|
||||||
static native long jni_YGNodeStyleGetMinWidthJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMinWidthJNI(long nativePointer, float minWidth);
|
|
||||||
static native void jni_YGNodeStyleSetMinWidthPercentJNI(long nativePointer, float percent);
|
|
||||||
static native void jni_YGNodeStyleSetMinWidthMaxContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMinWidthFitContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMinWidthStretchJNI(long nativePointer);
|
|
||||||
static native long jni_YGNodeStyleGetMinHeightJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMinHeightJNI(long nativePointer, float minHeight);
|
|
||||||
static native void jni_YGNodeStyleSetMinHeightPercentJNI(long nativePointer, float percent);
|
|
||||||
static native void jni_YGNodeStyleSetMinHeightMaxContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMinHeightFitContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMinHeightStretchJNI(long nativePointer);
|
|
||||||
static native long jni_YGNodeStyleGetMaxWidthJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMaxWidthJNI(long nativePointer, float maxWidth);
|
|
||||||
static native void jni_YGNodeStyleSetMaxWidthPercentJNI(long nativePointer, float percent);
|
|
||||||
static native void jni_YGNodeStyleSetMaxWidthMaxContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMaxWidthFitContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMaxWidthStretchJNI(long nativePointer);
|
|
||||||
static native long jni_YGNodeStyleGetMaxHeightJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMaxHeightJNI(long nativePointer, float maxheight);
|
|
||||||
static native void jni_YGNodeStyleSetMaxHeightPercentJNI(long nativePointer, float percent);
|
|
||||||
static native void jni_YGNodeStyleSetMaxHeightMaxContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMaxHeightFitContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMaxHeightStretchJNI(long nativePointer);
|
|
||||||
static native float jni_YGNodeStyleGetAspectRatioJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetAspectRatioJNI(long nativePointer, float aspectRatio);
|
|
||||||
static native long jni_YGNodeStyleGetGapJNI(long nativePointer, int gutter);
|
|
||||||
static native void jni_YGNodeStyleSetGapJNI(long nativePointer, int gutter, float gapLength);
|
|
||||||
static native void jni_YGNodeStyleSetGapPercentJNI(long nativePointer, int gutter, float gapLength);
|
|
||||||
static native void jni_YGNodeSetHasMeasureFuncJNI(long nativePointer, boolean hasMeasureFunc);
|
|
||||||
static native void jni_YGNodeSetHasBaselineFuncJNI(long nativePointer, boolean hasMeasureFunc);
|
|
||||||
static native void jni_YGNodeSetStyleInputsJNI(long nativePointer, float[] styleInputsArray, int size);
|
|
||||||
static native long jni_YGNodeCloneJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeSetAlwaysFormsContainingBlockJNI(long nativePointer, boolean alwaysFormContainingBlock);
|
|
||||||
}
|
|
331
java/com/facebook/yoga/YogaNative.kt
Normal file
331
java/com/facebook/yoga/YogaNative.kt
Normal file
@@ -0,0 +1,331 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
|
||||||
|
import com.facebook.soloader.SoLoader
|
||||||
|
import com.facebook.yoga.annotations.DoNotStrip
|
||||||
|
|
||||||
|
@DoNotStrip
|
||||||
|
public object YogaNative {
|
||||||
|
init {
|
||||||
|
SoLoader.loadLibrary("yoga")
|
||||||
|
}
|
||||||
|
|
||||||
|
// JNI methods that use Vanilla JNI
|
||||||
|
// YGConfig related
|
||||||
|
@JvmStatic public external fun jni_YGConfigNewJNI(): Long
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGConfigFreeJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGConfigSetExperimentalFeatureEnabledJNI(
|
||||||
|
nativePointer: Long,
|
||||||
|
feature: Int,
|
||||||
|
enabled: Boolean
|
||||||
|
)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGConfigSetUseWebDefaultsJNI(nativePointer: Long, useWebDefaults: Boolean)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGConfigSetPointScaleFactorJNI(nativePointer: Long, pixelsInPoint: Float)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGConfigSetErrataJNI(nativePointer: Long, errata: Int)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGConfigGetErrataJNI(nativePointer: Long): Int
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGConfigSetLoggerJNI(nativePointer: Long, logger: YogaLogger)
|
||||||
|
|
||||||
|
// YGNode related
|
||||||
|
@JvmStatic public external fun jni_YGNodeNewJNI(): Long
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeNewWithConfigJNI(configPointer: Long): Long
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeFinalizeJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeResetJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeInsertChildJNI(nativePointer: Long, childPointer: Long, index: Int)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeSwapChildJNI(nativePointer: Long, childPointer: Long, index: Int)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeSetIsReferenceBaselineJNI(
|
||||||
|
nativePointer: Long,
|
||||||
|
isReferenceBaseline: Boolean
|
||||||
|
)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeIsReferenceBaselineJNI(nativePointer: Long): Boolean
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeRemoveAllChildrenJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeRemoveChildJNI(nativePointer: Long, childPointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeCalculateLayoutJNI(
|
||||||
|
nativePointer: Long,
|
||||||
|
width: Float,
|
||||||
|
height: Float,
|
||||||
|
nativePointers: LongArray,
|
||||||
|
nodes: Array<YogaNodeJNIBase>
|
||||||
|
)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeMarkDirtyJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeIsDirtyJNI(nativePointer: Long): Boolean
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeCopyStyleJNI(dstNativePointer: Long, srcNativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetDirectionJNI(nativePointer: Long): Int
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetDirectionJNI(nativePointer: Long, direction: Int)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetFlexDirectionJNI(nativePointer: Long): Int
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetFlexDirectionJNI(nativePointer: Long, flexDirection: Int)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetJustifyContentJNI(nativePointer: Long): Int
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetJustifyContentJNI(nativePointer: Long, justifyContent: Int)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetAlignItemsJNI(nativePointer: Long): Int
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetAlignItemsJNI(nativePointer: Long, alignItems: Int)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetAlignSelfJNI(nativePointer: Long): Int
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetAlignSelfJNI(nativePointer: Long, alignSelf: Int)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetAlignContentJNI(nativePointer: Long): Int
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetAlignContentJNI(nativePointer: Long, alignContent: Int)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetPositionTypeJNI(nativePointer: Long): Int
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetPositionTypeJNI(nativePointer: Long, positionType: Int)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetBoxSizingJNI(nativePointer: Long): Int
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetBoxSizingJNI(nativePointer: Long, boxSizing: Int)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetFlexWrapJNI(nativePointer: Long): Int
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetFlexWrapJNI(nativePointer: Long, wrapType: Int)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetOverflowJNI(nativePointer: Long): Int
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetOverflowJNI(nativePointer: Long, overflow: Int)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetDisplayJNI(nativePointer: Long): Int
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetDisplayJNI(nativePointer: Long, display: Int)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetFlexJNI(nativePointer: Long): Float
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetFlexJNI(nativePointer: Long, flex: Float)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetFlexGrowJNI(nativePointer: Long): Float
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetFlexGrowJNI(nativePointer: Long, flexGrow: Float)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetFlexShrinkJNI(nativePointer: Long): Float
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetFlexShrinkJNI(nativePointer: Long, flexShrink: Float)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetFlexBasisJNI(nativePointer: Long): Long
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetFlexBasisJNI(nativePointer: Long, flexBasis: Float)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetFlexBasisPercentJNI(nativePointer: Long, percent: Float)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetFlexBasisAutoJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetFlexBasisMaxContentJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetFlexBasisFitContentJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetFlexBasisStretchJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetMarginJNI(nativePointer: Long, edge: Int): Long
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetMarginJNI(nativePointer: Long, edge: Int, margin: Float)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetMarginPercentJNI(
|
||||||
|
nativePointer: Long,
|
||||||
|
edge: Int,
|
||||||
|
percent: Float
|
||||||
|
)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMarginAutoJNI(nativePointer: Long, edge: Int)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetPaddingJNI(nativePointer: Long, edge: Int): Long
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetPaddingJNI(nativePointer: Long, edge: Int, padding: Float)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetPaddingPercentJNI(
|
||||||
|
nativePointer: Long,
|
||||||
|
edge: Int,
|
||||||
|
percent: Float
|
||||||
|
)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetBorderJNI(nativePointer: Long, edge: Int): Float
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetBorderJNI(nativePointer: Long, edge: Int, border: Float)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetPositionJNI(nativePointer: Long, edge: Int): Long
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetPositionJNI(nativePointer: Long, edge: Int, position: Float)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetPositionPercentJNI(
|
||||||
|
nativePointer: Long,
|
||||||
|
edge: Int,
|
||||||
|
percent: Float
|
||||||
|
)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetPositionAutoJNI(nativePointer: Long, edge: Int)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetWidthJNI(nativePointer: Long): Long
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetWidthJNI(nativePointer: Long, width: Float)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetWidthPercentJNI(nativePointer: Long, percent: Float)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetWidthAutoJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetWidthMaxContentJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetWidthFitContentJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetWidthStretchJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetHeightJNI(nativePointer: Long): Long
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetHeightJNI(nativePointer: Long, height: Float)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetHeightPercentJNI(nativePointer: Long, percent: Float)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetHeightAutoJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetHeightMaxContentJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetHeightFitContentJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetHeightStretchJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetMinWidthJNI(nativePointer: Long): Long
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMinWidthJNI(nativePointer: Long, minWidth: Float)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetMinWidthPercentJNI(nativePointer: Long, percent: Float)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMinWidthMaxContentJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMinWidthFitContentJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMinWidthStretchJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetMinHeightJNI(nativePointer: Long): Long
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetMinHeightJNI(nativePointer: Long, minHeight: Float)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetMinHeightPercentJNI(nativePointer: Long, percent: Float)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMinHeightMaxContentJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMinHeightFitContentJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMinHeightStretchJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetMaxWidthJNI(nativePointer: Long): Long
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMaxWidthJNI(nativePointer: Long, maxWidth: Float)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetMaxWidthPercentJNI(nativePointer: Long, percent: Float)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMaxWidthMaxContentJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMaxWidthFitContentJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMaxWidthStretchJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetMaxHeightJNI(nativePointer: Long): Long
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetMaxHeightJNI(nativePointer: Long, maxheight: Float)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetMaxHeightPercentJNI(nativePointer: Long, percent: Float)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMaxHeightMaxContentJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMaxHeightFitContentJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleSetMaxHeightStretchJNI(nativePointer: Long)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetAspectRatioJNI(nativePointer: Long): Float
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetAspectRatioJNI(nativePointer: Long, aspectRatio: Float)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeStyleGetGapJNI(nativePointer: Long, gutter: Int): Long
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetGapJNI(nativePointer: Long, gutter: Int, gapLength: Float)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeStyleSetGapPercentJNI(
|
||||||
|
nativePointer: Long,
|
||||||
|
gutter: Int,
|
||||||
|
gapLength: Float
|
||||||
|
)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeSetHasMeasureFuncJNI(nativePointer: Long, hasMeasureFunc: Boolean)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeSetHasBaselineFuncJNI(nativePointer: Long, hasMeasureFunc: Boolean)
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeSetStyleInputsJNI(
|
||||||
|
nativePointer: Long,
|
||||||
|
styleInputsArray: FloatArray,
|
||||||
|
size: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
@JvmStatic public external fun jni_YGNodeCloneJNI(nativePointer: Long): Long
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
public external fun jni_YGNodeSetAlwaysFormsContainingBlockJNI(
|
||||||
|
nativePointer: Long,
|
||||||
|
alwaysFormContainingBlock: Boolean
|
||||||
|
)
|
||||||
|
}
|
@@ -1,18 +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 YogaNodeFactory {
|
|
||||||
public static YogaNode create() {
|
|
||||||
return new YogaNodeJNIFinalizer();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static YogaNode create(YogaConfig config) {
|
|
||||||
return new YogaNodeJNIFinalizer(config);
|
|
||||||
}
|
|
||||||
}
|
|
14
java/com/facebook/yoga/YogaNodeFactory.kt
Normal file
14
java/com/facebook/yoga/YogaNodeFactory.kt
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* 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 object YogaNodeFactory {
|
||||||
|
@JvmStatic public fun create(): YogaNode = YogaNodeJNIFinalizer()
|
||||||
|
|
||||||
|
@JvmStatic public fun create(config: YogaConfig): YogaNode = YogaNodeJNIFinalizer(config)
|
||||||
|
}
|
@@ -1,51 +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 YogaStyleInputs {
|
|
||||||
public static final short LAYOUT_DIRECTION = 0;
|
|
||||||
public static final short FLEX_DIRECTION = 1;
|
|
||||||
public static final short FLEX = 2;
|
|
||||||
public static final short FLEX_GROW = 3;
|
|
||||||
public static final short FLEX_SHRINK = 4;
|
|
||||||
public static final short FLEX_BASIS = 5;
|
|
||||||
public static final short FLEX_BASIS_PERCENT = 6;
|
|
||||||
public static final short FLEX_BASIS_AUTO = 7;
|
|
||||||
public static final short FLEX_WRAP = 8;
|
|
||||||
public static final short WIDTH = 9;
|
|
||||||
public static final short WIDTH_PERCENT = 10;
|
|
||||||
public static final short WIDTH_AUTO = 11;
|
|
||||||
public static final short MIN_WIDTH = 12;
|
|
||||||
public static final short MIN_WIDTH_PERCENT = 13;
|
|
||||||
public static final short MAX_WIDTH = 14;
|
|
||||||
public static final short MAX_WIDTH_PERCENT = 15;
|
|
||||||
public static final short HEIGHT = 16;
|
|
||||||
public static final short HEIGHT_PERCENT = 17;
|
|
||||||
public static final short HEIGHT_AUTO = 18;
|
|
||||||
public static final short MIN_HEIGHT = 19;
|
|
||||||
public static final short MIN_HEIGHT_PERCENT = 20;
|
|
||||||
public static final short MAX_HEIGHT = 21;
|
|
||||||
public static final short MAX_HEIGHT_PERCENT = 22;
|
|
||||||
public static final short JUSTIFY_CONTENT = 23;
|
|
||||||
public static final short ALIGN_ITEMS = 24;
|
|
||||||
public static final short ALIGN_SELF = 25;
|
|
||||||
public static final short ALIGN_CONTENT = 26;
|
|
||||||
public static final short POSITION_TYPE = 27;
|
|
||||||
public static final short ASPECT_RATIO = 28;
|
|
||||||
public static final short OVERFLOW = 29;
|
|
||||||
public static final short DISPLAY = 30;
|
|
||||||
public static final short MARGIN = 31;
|
|
||||||
public static final short MARGIN_PERCENT = 32;
|
|
||||||
public static final short MARGIN_AUTO = 33;
|
|
||||||
public static final short PADDING = 34;
|
|
||||||
public static final short PADDING_PERCENT = 35;
|
|
||||||
public static final short BORDER = 36;
|
|
||||||
public static final short POSITION = 37;
|
|
||||||
public static final short POSITION_PERCENT = 38;
|
|
||||||
public static final short IS_REFERENCE_BASELINE = 39;
|
|
||||||
}
|
|
51
java/com/facebook/yoga/YogaStyleInputs.kt
Normal file
51
java/com/facebook/yoga/YogaStyleInputs.kt
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* 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 object YogaStyleInputs {
|
||||||
|
public const val LAYOUT_DIRECTION: Short = 0
|
||||||
|
public const val FLEX_DIRECTION: Short = 1
|
||||||
|
public const val FLEX: Short = 2
|
||||||
|
public const val FLEX_GROW: Short = 3
|
||||||
|
public const val FLEX_SHRINK: Short = 4
|
||||||
|
public const val FLEX_BASIS: Short = 5
|
||||||
|
public const val FLEX_BASIS_PERCENT: Short = 6
|
||||||
|
public const val FLEX_BASIS_AUTO: Short = 7
|
||||||
|
public const val FLEX_WRAP: Short = 8
|
||||||
|
public const val WIDTH: Short = 9
|
||||||
|
public const val WIDTH_PERCENT: Short = 10
|
||||||
|
public const val WIDTH_AUTO: Short = 11
|
||||||
|
public const val MIN_WIDTH: Short = 12
|
||||||
|
public const val MIN_WIDTH_PERCENT: Short = 13
|
||||||
|
public const val MAX_WIDTH: Short = 14
|
||||||
|
public const val MAX_WIDTH_PERCENT: Short = 15
|
||||||
|
public const val HEIGHT: Short = 16
|
||||||
|
public const val HEIGHT_PERCENT: Short = 17
|
||||||
|
public const val HEIGHT_AUTO: Short = 18
|
||||||
|
public const val MIN_HEIGHT: Short = 19
|
||||||
|
public const val MIN_HEIGHT_PERCENT: Short = 20
|
||||||
|
public const val MAX_HEIGHT: Short = 21
|
||||||
|
public const val MAX_HEIGHT_PERCENT: Short = 22
|
||||||
|
public const val JUSTIFY_CONTENT: Short = 23
|
||||||
|
public const val ALIGN_ITEMS: Short = 24
|
||||||
|
public const val ALIGN_SELF: Short = 25
|
||||||
|
public const val ALIGN_CONTENT: Short = 26
|
||||||
|
public const val POSITION_TYPE: Short = 27
|
||||||
|
public const val ASPECT_RATIO: Short = 28
|
||||||
|
public const val OVERFLOW: Short = 29
|
||||||
|
public const val DISPLAY: Short = 30
|
||||||
|
public const val MARGIN: Short = 31
|
||||||
|
public const val MARGIN_PERCENT: Short = 32
|
||||||
|
public const val MARGIN_AUTO: Short = 33
|
||||||
|
public const val PADDING: Short = 34
|
||||||
|
public const val PADDING_PERCENT: Short = 35
|
||||||
|
public const val BORDER: Short = 36
|
||||||
|
public const val POSITION: Short = 37
|
||||||
|
public const val POSITION_PERCENT: Short = 38
|
||||||
|
public const val IS_REFERENCE_BASELINE: Short = 39
|
||||||
|
}
|
@@ -1,18 +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.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import static java.lang.annotation.RetentionPolicy.CLASS;
|
|
||||||
|
|
||||||
@Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.CONSTRUCTOR })
|
|
||||||
@Retention(CLASS)
|
|
||||||
public @interface DoNotStrip { }
|
|
19
java/com/facebook/yoga/annotations/DoNotStrip.kt
Normal file
19
java/com/facebook/yoga/annotations/DoNotStrip.kt
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* 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.annotations
|
||||||
|
|
||||||
|
@Target(
|
||||||
|
AnnotationTarget.CLASS,
|
||||||
|
AnnotationTarget.FIELD,
|
||||||
|
AnnotationTarget.FUNCTION,
|
||||||
|
AnnotationTarget.PROPERTY_GETTER,
|
||||||
|
AnnotationTarget.PROPERTY_SETTER,
|
||||||
|
AnnotationTarget.CONSTRUCTOR,
|
||||||
|
)
|
||||||
|
@Retention(AnnotationRetention.BINARY)
|
||||||
|
public annotation class DoNotStrip
|
@@ -4,7 +4,7 @@
|
|||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*
|
*
|
||||||
* @generated SignedSource<<e8d11c0e97041bb2f1487f0d87363fdc>>
|
* @generated SignedSource<<84597dd8b2c4f3aac1f21abe68f25308>>
|
||||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignItemsTest.html
|
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignItemsTest.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -2293,6 +2293,86 @@ public class YGAlignItemsTest {
|
|||||||
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
assertEquals(50f, root_child1.getLayoutHeight(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_align_items_non_stretch_s526008() {
|
||||||
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
|
|
||||||
|
final YogaNode root = createNode(config);
|
||||||
|
root.setPositionType(YogaPositionType.ABSOLUTE);
|
||||||
|
root.setWidth(400f);
|
||||||
|
root.setHeight(400f);
|
||||||
|
|
||||||
|
final YogaNode root_child0 = createNode(config);
|
||||||
|
root_child0.setFlexDirection(YogaFlexDirection.ROW);
|
||||||
|
root.addChildAt(root_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child0 = createNode(config);
|
||||||
|
root_child0_child0.setAlignItems(YogaAlign.FLEX_START);
|
||||||
|
root_child0.addChildAt(root_child0_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child0_child0 = createNode(config);
|
||||||
|
root_child0_child0.addChildAt(root_child0_child0_child0, 0);
|
||||||
|
|
||||||
|
final YogaNode root_child0_child0_child0_child0 = createNode(config);
|
||||||
|
root_child0_child0_child0_child0.setHeight(10f);
|
||||||
|
root_child0_child0_child0.addChildAt(root_child0_child0_child0_child0, 0);
|
||||||
|
root.setDirection(YogaDirection.LTR);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(400f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(400f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, 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(0f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child0_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
root.setDirection(YogaDirection.RTL);
|
||||||
|
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
|
||||||
|
|
||||||
|
assertEquals(0f, root.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(400f, root.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(400f, root.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(400f, root_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(400f, root_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, 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(0f, root_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
|
||||||
|
assertEquals(0f, root_child0_child0_child0_child0.getLayoutX(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0_child0_child0.getLayoutY(), 0.0f);
|
||||||
|
assertEquals(0f, root_child0_child0_child0_child0.getLayoutWidth(), 0.0f);
|
||||||
|
assertEquals(10f, root_child0_child0_child0_child0.getLayoutHeight(), 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
private YogaNode createNode(YogaConfig config) {
|
private YogaNode createNode(YogaConfig config) {
|
||||||
return mNodeFactory.create(config);
|
return mNodeFactory.create(config);
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
* This source code is licensed under the MIT license found in the
|
* This source code is licensed under the MIT license found in the
|
||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*
|
*
|
||||||
* @generated SignedSource<<075a0b67003e5c4a1f51bd99da71c700>>
|
* @generated SignedSource<<fd80af208d8635435f86ffa8f3810b39>>
|
||||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignItemsTest.html
|
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignItemsTest.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -2442,3 +2442,88 @@ test('align_stretch_with_row_reverse', () => {
|
|||||||
config.free();
|
config.free();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
test('align_items_non_stretch_s526008', () => {
|
||||||
|
const config = Yoga.Config.create();
|
||||||
|
let root;
|
||||||
|
|
||||||
|
try {
|
||||||
|
root = Yoga.Node.create(config);
|
||||||
|
root.setPositionType(PositionType.Absolute);
|
||||||
|
root.setWidth(400);
|
||||||
|
root.setHeight(400);
|
||||||
|
|
||||||
|
const root_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0.setFlexDirection(FlexDirection.Row);
|
||||||
|
root.insertChild(root_child0, 0);
|
||||||
|
|
||||||
|
const root_child0_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0_child0.setAlignItems(Align.FlexStart);
|
||||||
|
root_child0.insertChild(root_child0_child0, 0);
|
||||||
|
|
||||||
|
const root_child0_child0_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0_child0.insertChild(root_child0_child0_child0, 0);
|
||||||
|
|
||||||
|
const root_child0_child0_child0_child0 = Yoga.Node.create(config);
|
||||||
|
root_child0_child0_child0_child0.setHeight(10);
|
||||||
|
root_child0_child0_child0.insertChild(root_child0_child0_child0_child0, 0);
|
||||||
|
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||||
|
|
||||||
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
|
expect(root.getComputedTop()).toBe(0);
|
||||||
|
expect(root.getComputedWidth()).toBe(400);
|
||||||
|
expect(root.getComputedHeight()).toBe(400);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(400);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(10);
|
||||||
|
|
||||||
|
expect(root_child0_child0.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0_child0.getComputedWidth()).toBe(0);
|
||||||
|
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||||
|
|
||||||
|
expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child0_child0_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0_child0_child0.getComputedWidth()).toBe(0);
|
||||||
|
expect(root_child0_child0_child0.getComputedHeight()).toBe(10);
|
||||||
|
|
||||||
|
expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child0_child0_child0_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(0);
|
||||||
|
expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(10);
|
||||||
|
|
||||||
|
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||||
|
|
||||||
|
expect(root.getComputedLeft()).toBe(0);
|
||||||
|
expect(root.getComputedTop()).toBe(0);
|
||||||
|
expect(root.getComputedWidth()).toBe(400);
|
||||||
|
expect(root.getComputedHeight()).toBe(400);
|
||||||
|
|
||||||
|
expect(root_child0.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0.getComputedWidth()).toBe(400);
|
||||||
|
expect(root_child0.getComputedHeight()).toBe(10);
|
||||||
|
|
||||||
|
expect(root_child0_child0.getComputedLeft()).toBe(400);
|
||||||
|
expect(root_child0_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0_child0.getComputedWidth()).toBe(0);
|
||||||
|
expect(root_child0_child0.getComputedHeight()).toBe(10);
|
||||||
|
|
||||||
|
expect(root_child0_child0_child0.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child0_child0_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0_child0_child0.getComputedWidth()).toBe(0);
|
||||||
|
expect(root_child0_child0_child0.getComputedHeight()).toBe(10);
|
||||||
|
|
||||||
|
expect(root_child0_child0_child0_child0.getComputedLeft()).toBe(0);
|
||||||
|
expect(root_child0_child0_child0_child0.getComputedTop()).toBe(0);
|
||||||
|
expect(root_child0_child0_child0_child0.getComputedWidth()).toBe(0);
|
||||||
|
expect(root_child0_child0_child0_child0.getComputedHeight()).toBe(10);
|
||||||
|
} finally {
|
||||||
|
if (typeof root !== 'undefined') {
|
||||||
|
root.freeRecursive();
|
||||||
|
}
|
||||||
|
|
||||||
|
config.free();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@@ -19,10 +19,11 @@ include(":yoga")
|
|||||||
|
|
||||||
project(":yoga").projectDir = file("java")
|
project(":yoga").projectDir = file("java")
|
||||||
|
|
||||||
rootProject.name = "yoga-github"
|
gradleEnterprise {
|
||||||
|
buildScan {
|
||||||
// If you specify a file inside gradle/gradle-enterprise.gradle.kts
|
termsOfServiceUrl = "https://gradle.com/terms-of-service"
|
||||||
// you can configure your custom Gradle Enterprise instance
|
termsOfServiceAgree = "yes"
|
||||||
if (file("./gradle/gradle-enterprise.gradle.kts").exists()) {
|
}
|
||||||
apply(from = "./gradle/gradle-enterprise.gradle.kts")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rootProject.name = "yoga-github"
|
||||||
|
7
tests/.clang-tidy
Normal file
7
tests/.clang-tidy
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
InheritParentConfig: true
|
||||||
|
Checks: '
|
||||||
|
-facebook-hte-CArray,
|
||||||
|
-modernize-avoid-c-arrays,
|
||||||
|
'
|
||||||
|
...
|
214
tests/YGPersistentNodeCloningTest.cpp
Normal file
214
tests/YGPersistentNodeCloningTest.cpp
Normal file
@@ -0,0 +1,214 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
#include <yoga/Yoga.h>
|
||||||
|
#include <yoga/config/Config.h>
|
||||||
|
#include <yoga/node/Node.h>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace facebook::yoga {
|
||||||
|
|
||||||
|
struct YGPersistentNodeCloningTest : public ::testing::Test {
|
||||||
|
struct NodeWrapper {
|
||||||
|
explicit NodeWrapper(
|
||||||
|
YGConfigRef config,
|
||||||
|
std::vector<std::shared_ptr<NodeWrapper>> children = {})
|
||||||
|
: node{YGNodeNewWithConfig(config)}, children{std::move(children)} {
|
||||||
|
YGNodeSetContext(node, this);
|
||||||
|
|
||||||
|
auto privateNode = resolveRef(node);
|
||||||
|
for (const auto& child : this->children) {
|
||||||
|
auto privateChild = resolveRef(child->node);
|
||||||
|
// Claim first ownership of not yet owned nodes, to avoid immediately
|
||||||
|
// cloning them
|
||||||
|
if (YGNodeGetOwner(child->node) == nullptr) {
|
||||||
|
privateChild->setOwner(privateNode);
|
||||||
|
}
|
||||||
|
privateNode->insertChild(privateChild, privateNode->getChildCount());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clone, with current children, for mutation
|
||||||
|
NodeWrapper(const NodeWrapper& other)
|
||||||
|
: node{YGNodeClone(other.node)}, children{other.children} {
|
||||||
|
YGNodeSetContext(node, this);
|
||||||
|
|
||||||
|
auto privateNode = resolveRef(node);
|
||||||
|
privateNode->setOwner(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clone, with new children
|
||||||
|
NodeWrapper(
|
||||||
|
const NodeWrapper& other,
|
||||||
|
std::vector<std::shared_ptr<NodeWrapper>> children)
|
||||||
|
: node{YGNodeClone(other.node)}, children{std::move(children)} {
|
||||||
|
YGNodeSetContext(node, this);
|
||||||
|
|
||||||
|
auto privateNode = resolveRef(node);
|
||||||
|
privateNode->setOwner(nullptr);
|
||||||
|
privateNode->setChildren({});
|
||||||
|
privateNode->setDirty(true);
|
||||||
|
|
||||||
|
for (const auto& child : this->children) {
|
||||||
|
auto privateChild = resolveRef(child->node);
|
||||||
|
// Claim first ownership of not yet owned nodes, to avoid immediately
|
||||||
|
// cloning them
|
||||||
|
if (YGNodeGetOwner(child->node) == nullptr) {
|
||||||
|
privateChild->setOwner(privateNode);
|
||||||
|
}
|
||||||
|
privateNode->insertChild(privateChild, privateNode->getChildCount());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeWrapper(NodeWrapper&&) = delete;
|
||||||
|
|
||||||
|
~NodeWrapper() {
|
||||||
|
YGNodeFree(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
NodeWrapper& operator=(const NodeWrapper& other) = delete;
|
||||||
|
NodeWrapper& operator=(NodeWrapper&& other) = delete;
|
||||||
|
|
||||||
|
YGNodeRef node;
|
||||||
|
std::vector<std::shared_ptr<NodeWrapper>> children;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ConfigWrapper {
|
||||||
|
ConfigWrapper() {
|
||||||
|
YGConfigSetCloneNodeFunc(
|
||||||
|
config,
|
||||||
|
[](YGNodeConstRef oldNode, YGNodeConstRef owner, size_t childIndex) {
|
||||||
|
onClone(oldNode, owner, childIndex);
|
||||||
|
auto wrapper = static_cast<NodeWrapper*>(YGNodeGetContext(owner));
|
||||||
|
auto old = static_cast<NodeWrapper*>(YGNodeGetContext(oldNode));
|
||||||
|
|
||||||
|
wrapper->children[childIndex] = std::make_shared<NodeWrapper>(*old);
|
||||||
|
return wrapper->children[childIndex]->node;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigWrapper(const ConfigWrapper&) = delete;
|
||||||
|
ConfigWrapper(ConfigWrapper&&) = delete;
|
||||||
|
|
||||||
|
~ConfigWrapper() {
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigWrapper& operator=(const ConfigWrapper&) = delete;
|
||||||
|
ConfigWrapper& operator=(ConfigWrapper&&) = delete;
|
||||||
|
|
||||||
|
YGConfigRef config{YGConfigNew()};
|
||||||
|
};
|
||||||
|
|
||||||
|
ConfigWrapper configWrapper;
|
||||||
|
YGConfigRef config{configWrapper.config};
|
||||||
|
|
||||||
|
void SetUp() override {
|
||||||
|
onClone = [](...) {};
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||||
|
static inline std::function<void(YGNodeConstRef, YGNodeConstRef, size_t)>
|
||||||
|
onClone;
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(
|
||||||
|
YGPersistentNodeCloningTest,
|
||||||
|
changing_sibling_height_does_not_clone_neighbors) {
|
||||||
|
// <ScrollView>
|
||||||
|
// <View id="Sibling" style={{ height: 1 }} />
|
||||||
|
// <View id="A" style={{ height: 1 }}>
|
||||||
|
// <View id="B">
|
||||||
|
// <View id="C">
|
||||||
|
// <View id="D"/>
|
||||||
|
// </View>
|
||||||
|
// </View>
|
||||||
|
// </View>
|
||||||
|
// </ScrollView>
|
||||||
|
|
||||||
|
auto sibling = std::make_shared<NodeWrapper>(config);
|
||||||
|
YGNodeStyleSetHeight(sibling->node, 1);
|
||||||
|
|
||||||
|
auto d = std::make_shared<NodeWrapper>(config);
|
||||||
|
auto c = std::make_shared<NodeWrapper>(config, std::vector{d});
|
||||||
|
auto b = std::make_shared<NodeWrapper>(config, std::vector{c});
|
||||||
|
auto a = std::make_shared<NodeWrapper>(config, std::vector{b});
|
||||||
|
YGNodeStyleSetHeight(a->node, 1);
|
||||||
|
|
||||||
|
auto scrollContentView =
|
||||||
|
std::make_shared<NodeWrapper>(config, std::vector{sibling, a});
|
||||||
|
YGNodeStyleSetPositionType(scrollContentView->node, YGPositionTypeAbsolute);
|
||||||
|
|
||||||
|
auto scrollView =
|
||||||
|
std::make_shared<NodeWrapper>(config, std::vector{scrollContentView});
|
||||||
|
YGNodeStyleSetWidth(scrollView->node, 100);
|
||||||
|
YGNodeStyleSetHeight(scrollView->node, 100);
|
||||||
|
|
||||||
|
// We don't expect any cloning during the first layout
|
||||||
|
onClone = [](...) { FAIL(); };
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(
|
||||||
|
scrollView->node, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
auto siblingPrime = std::make_shared<NodeWrapper>(config);
|
||||||
|
YGNodeStyleSetHeight(siblingPrime->node, 2);
|
||||||
|
|
||||||
|
auto scrollContentViewPrime = std::make_shared<NodeWrapper>(
|
||||||
|
*scrollContentView, std::vector{siblingPrime, a});
|
||||||
|
auto scrollViewPrime = std::make_shared<NodeWrapper>(
|
||||||
|
*scrollView, std::vector{scrollContentViewPrime});
|
||||||
|
|
||||||
|
std::vector<NodeWrapper*> nodesCloned;
|
||||||
|
// We should only need to clone "A"
|
||||||
|
onClone = [&](YGNodeConstRef oldNode,
|
||||||
|
YGNodeConstRef /*owner*/,
|
||||||
|
size_t /*childIndex*/) {
|
||||||
|
nodesCloned.push_back(static_cast<NodeWrapper*>(YGNodeGetContext(oldNode)));
|
||||||
|
};
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(
|
||||||
|
scrollViewPrime->node, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
EXPECT_EQ(nodesCloned.size(), 1);
|
||||||
|
EXPECT_EQ(nodesCloned[0], a.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(YGPersistentNodeCloningTest, clone_leaf_display_contents_node) {
|
||||||
|
// <View id="A">
|
||||||
|
// <View id="B" style={{ display: 'contents' }} />
|
||||||
|
// </View>
|
||||||
|
|
||||||
|
auto b = std::make_shared<NodeWrapper>(config);
|
||||||
|
auto a = std::make_shared<NodeWrapper>(config, std::vector{b});
|
||||||
|
YGNodeStyleSetDisplay(b->node, YGDisplayContents);
|
||||||
|
|
||||||
|
// We don't expect any cloning during the first layout
|
||||||
|
onClone = [](...) { FAIL(); };
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(a->node, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
auto aPrime = std::make_shared<NodeWrapper>(config, std::vector{b});
|
||||||
|
|
||||||
|
std::vector<NodeWrapper*> nodesCloned;
|
||||||
|
// We should clone "C"
|
||||||
|
onClone = [&](YGNodeConstRef oldNode,
|
||||||
|
YGNodeConstRef /*owner*/,
|
||||||
|
size_t /*childIndex*/) {
|
||||||
|
nodesCloned.push_back(static_cast<NodeWrapper*>(YGNodeGetContext(oldNode)));
|
||||||
|
};
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(aPrime->node, 100, 100, YGDirectionLTR);
|
||||||
|
|
||||||
|
EXPECT_EQ(nodesCloned.size(), 1);
|
||||||
|
EXPECT_EQ(nodesCloned[0], b.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace facebook::yoga
|
@@ -161,3 +161,23 @@ TEST(YogaTest, per_node_point_scale_factor) {
|
|||||||
YGConfigFree(config2);
|
YGConfigFree(config2);
|
||||||
YGConfigFree(config3);
|
YGConfigFree(config3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, raw_layout_dimensions) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
YGConfigSetPointScaleFactor(config, 0.5f);
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetWidth(root, 11.5f);
|
||||||
|
YGNodeStyleSetHeight(root, 9.5f);
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_EQ(YGNodeLayoutGetWidth(root), 12.0f);
|
||||||
|
ASSERT_EQ(YGNodeLayoutGetHeight(root), 10.0f);
|
||||||
|
ASSERT_EQ(YGNodeLayoutGetRawWidth(root), 11.5f);
|
||||||
|
ASSERT_EQ(YGNodeLayoutGetRawHeight(root), 9.5f);
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
* LICENSE file in the root directory of this source tree.
|
* LICENSE file in the root directory of this source tree.
|
||||||
*
|
*
|
||||||
* clang-format off
|
* clang-format off
|
||||||
* @generated SignedSource<<71295a398c89ea424490884a05e2c77c>>
|
* @generated SignedSource<<1db57b05babb408c08efcec7dbdf16fb>>
|
||||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignItemsTest.html
|
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignItemsTest.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -2310,3 +2310,84 @@ TEST(YogaTest, align_stretch_with_row_reverse) {
|
|||||||
|
|
||||||
YGConfigFree(config);
|
YGConfigFree(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(YogaTest, align_items_non_stretch_s526008) {
|
||||||
|
YGConfigRef config = YGConfigNew();
|
||||||
|
|
||||||
|
YGNodeRef root = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
|
||||||
|
YGNodeStyleSetWidth(root, 400);
|
||||||
|
YGNodeStyleSetHeight(root, 400);
|
||||||
|
|
||||||
|
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetFlexDirection(root_child0, YGFlexDirectionRow);
|
||||||
|
YGNodeInsertChild(root, root_child0, 0);
|
||||||
|
|
||||||
|
YGNodeRef root_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetAlignItems(root_child0_child0, YGAlignFlexStart);
|
||||||
|
YGNodeInsertChild(root_child0, root_child0_child0, 0);
|
||||||
|
|
||||||
|
YGNodeRef root_child0_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeInsertChild(root_child0_child0, root_child0_child0_child0, 0);
|
||||||
|
|
||||||
|
YGNodeRef root_child0_child0_child0_child0 = YGNodeNewWithConfig(config);
|
||||||
|
YGNodeStyleSetHeight(root_child0_child0_child0_child0, 10);
|
||||||
|
YGNodeInsertChild(root_child0_child0_child0, root_child0_child0_child0_child0, 0);
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, 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(0, YGNodeLayoutGetWidth(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0_child0_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0_child0_child0_child0));
|
||||||
|
|
||||||
|
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
|
||||||
|
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root));
|
||||||
|
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetHeight(root));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetWidth(root_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(400, YGNodeLayoutGetLeft(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, 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(0, YGNodeLayoutGetWidth(root_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0_child0_child0));
|
||||||
|
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetWidth(root_child0_child0_child0_child0));
|
||||||
|
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child0_child0_child0_child0));
|
||||||
|
|
||||||
|
YGNodeFreeRecursive(root);
|
||||||
|
|
||||||
|
YGConfigFree(config);
|
||||||
|
}
|
||||||
|
@@ -17,15 +17,15 @@ has effect when items are wrapped to multiple lines using [flex wrap](/docs/styl
|
|||||||
|
|
||||||
**Center**: Align wrapped lines in the center of the container's cross axis.
|
**Center**: Align wrapped lines in the center of the container's cross axis.
|
||||||
|
|
||||||
**Space between**: Evenly space wrapped lines across the container's main axis, distributing
|
**Space between**: Evenly space wrapped lines across the container's cross axis, distributing
|
||||||
remaining space between the lines.
|
remaining space between the lines.
|
||||||
|
|
||||||
**Space around**: Evenly space wrapped lines across the container's main axis, distributing
|
**Space around**: Evenly space wrapped lines across the container's cross axis, distributing
|
||||||
remaining space around the lines. Compared to space between using
|
remaining space around the lines. Compared to space between using
|
||||||
space around will result in space being distributed to the beginning of
|
space around will result in space being distributed to the beginning of
|
||||||
the first lines and end of the last line.
|
the first lines and end of the last line.
|
||||||
|
|
||||||
**Space evenly**: Evenly space wrapped lines across the container's main axis, distributing
|
**Space evenly**: Evenly space wrapped lines across the container's cross axis, distributing
|
||||||
remaining space around the lines. Compared to space around, space evenly will not
|
remaining space around the lines. Compared to space around, space evenly will not
|
||||||
double the gaps between children. The size of gaps between children and between
|
double the gaps between children. The size of gaps between children and between
|
||||||
the parent's edges and the first/last child will all be equal.
|
the parent's edges and the first/last child will all be equal.
|
||||||
|
@@ -90,3 +90,11 @@ float YGNodeLayoutGetPadding(YGNodeConstRef node, YGEdge edge) {
|
|||||||
return getResolvedLayoutProperty<&LayoutResults::padding>(
|
return getResolvedLayoutProperty<&LayoutResults::padding>(
|
||||||
node, scopedEnum(edge));
|
node, scopedEnum(edge));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float YGNodeLayoutGetRawHeight(YGNodeConstRef node) {
|
||||||
|
return resolveRef(node)->getLayout().rawDimension(Dimension::Height);
|
||||||
|
}
|
||||||
|
|
||||||
|
float YGNodeLayoutGetRawWidth(YGNodeConstRef node) {
|
||||||
|
return resolveRef(node)->getLayout().rawDimension(Dimension::Width);
|
||||||
|
}
|
||||||
|
@@ -32,4 +32,14 @@ YG_EXPORT float YGNodeLayoutGetMargin(YGNodeConstRef node, YGEdge edge);
|
|||||||
YG_EXPORT float YGNodeLayoutGetBorder(YGNodeConstRef node, YGEdge edge);
|
YG_EXPORT float YGNodeLayoutGetBorder(YGNodeConstRef node, YGEdge edge);
|
||||||
YG_EXPORT float YGNodeLayoutGetPadding(YGNodeConstRef node, YGEdge edge);
|
YG_EXPORT float YGNodeLayoutGetPadding(YGNodeConstRef node, YGEdge edge);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the measured height of the node, before layout rounding
|
||||||
|
*/
|
||||||
|
YG_EXPORT float YGNodeLayoutGetRawHeight(YGNodeConstRef node);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the measured width of the node, before layout rounding
|
||||||
|
*/
|
||||||
|
YG_EXPORT float YGNodeLayoutGetRawWidth(YGNodeConstRef node);
|
||||||
|
|
||||||
YG_EXTERN_C_END
|
YG_EXTERN_C_END
|
||||||
|
@@ -72,9 +72,9 @@ inline bool operator==(const YGValue& lhs, const YGValue& rhs) {
|
|||||||
case YGUnitPoint:
|
case YGUnitPoint:
|
||||||
case YGUnitPercent:
|
case YGUnitPercent:
|
||||||
return lhs.value == rhs.value;
|
return lhs.value == rhs.value;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool operator!=(const YGValue& lhs, const YGValue& rhs) {
|
inline bool operator!=(const YGValue& lhs, const YGValue& rhs) {
|
||||||
|
16
yoga/Yoga.h
16
yoga/Yoga.h
@@ -11,11 +11,11 @@
|
|||||||
* `#include <yoga/Yoga.h>` includes all of Yoga's public headers.
|
* `#include <yoga/Yoga.h>` includes all of Yoga's public headers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <yoga/YGConfig.h>
|
#include <yoga/YGConfig.h> // IWYU pragma: export
|
||||||
#include <yoga/YGEnums.h>
|
#include <yoga/YGEnums.h> // IWYU pragma: export
|
||||||
#include <yoga/YGMacros.h>
|
#include <yoga/YGMacros.h> // IWYU pragma: export
|
||||||
#include <yoga/YGNode.h>
|
#include <yoga/YGNode.h> // IWYU pragma: export
|
||||||
#include <yoga/YGNodeLayout.h>
|
#include <yoga/YGNodeLayout.h> // IWYU pragma: export
|
||||||
#include <yoga/YGNodeStyle.h>
|
#include <yoga/YGNodeStyle.h> // IWYU pragma: export
|
||||||
#include <yoga/YGPixelGrid.h>
|
#include <yoga/YGPixelGrid.h> // IWYU pragma: export
|
||||||
#include <yoga/YGValue.h>
|
#include <yoga/YGValue.h> // IWYU pragma: export
|
||||||
|
@@ -415,6 +415,12 @@ static void measureNodeWithoutChildren(
|
|||||||
Dimension::Height);
|
Dimension::Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool isFixedSize(float dim, SizingMode sizingMode) {
|
||||||
|
return sizingMode == SizingMode::StretchFit ||
|
||||||
|
(yoga::isDefined(dim) && sizingMode == SizingMode::FitContent &&
|
||||||
|
dim <= 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
static bool measureNodeWithFixedSize(
|
static bool measureNodeWithFixedSize(
|
||||||
yoga::Node* const node,
|
yoga::Node* const node,
|
||||||
const Direction direction,
|
const Direction direction,
|
||||||
@@ -424,12 +430,8 @@ static bool measureNodeWithFixedSize(
|
|||||||
const SizingMode heightSizingMode,
|
const SizingMode heightSizingMode,
|
||||||
const float ownerWidth,
|
const float ownerWidth,
|
||||||
const float ownerHeight) {
|
const float ownerHeight) {
|
||||||
if ((yoga::isDefined(availableWidth) &&
|
if (isFixedSize(availableWidth, widthSizingMode) &&
|
||||||
widthSizingMode == SizingMode::FitContent && availableWidth <= 0.0f) ||
|
isFixedSize(availableHeight, heightSizingMode)) {
|
||||||
(yoga::isDefined(availableHeight) &&
|
|
||||||
heightSizingMode == SizingMode::FitContent && availableHeight <= 0.0f) ||
|
|
||||||
(widthSizingMode == SizingMode::StretchFit &&
|
|
||||||
heightSizingMode == SizingMode::StretchFit)) {
|
|
||||||
node->setLayoutMeasuredDimension(
|
node->setLayoutMeasuredDimension(
|
||||||
boundAxis(
|
boundAxis(
|
||||||
node,
|
node,
|
||||||
@@ -476,16 +478,19 @@ static void zeroOutLayoutRecursively(yoga::Node* const node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void cleanupContentsNodesRecursively(yoga::Node* const node) {
|
static void cleanupContentsNodesRecursively(yoga::Node* const node) {
|
||||||
for (auto child : node->getChildren()) {
|
if (node->hasContentsChildren()) [[unlikely]] {
|
||||||
if (child->style().display() == Display::Contents) {
|
node->cloneContentsChildrenIfNeeded();
|
||||||
child->getLayout() = {};
|
for (auto child : node->getChildren()) {
|
||||||
child->setLayoutDimension(0, Dimension::Width);
|
if (child->style().display() == Display::Contents) {
|
||||||
child->setLayoutDimension(0, Dimension::Height);
|
child->getLayout() = {};
|
||||||
child->setHasNewLayout(true);
|
child->setLayoutDimension(0, Dimension::Width);
|
||||||
child->setDirty(false);
|
child->setLayoutDimension(0, Dimension::Height);
|
||||||
child->cloneChildrenIfNeeded();
|
child->setHasNewLayout(true);
|
||||||
|
child->setDirty(false);
|
||||||
|
child->cloneChildrenIfNeeded();
|
||||||
|
|
||||||
cleanupContentsNodesRecursively(child);
|
cleanupContentsNodesRecursively(child);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -106,25 +106,25 @@ void roundLayoutResultsToPixelGrid(
|
|||||||
const bool hasFractionalHeight =
|
const bool hasFractionalHeight =
|
||||||
!yoga::inexactEquals(round(scaledNodeHeight), scaledNodeHeight);
|
!yoga::inexactEquals(round(scaledNodeHeight), scaledNodeHeight);
|
||||||
|
|
||||||
node->setLayoutDimension(
|
node->getLayout().setDimension(
|
||||||
|
Dimension::Width,
|
||||||
roundValueToPixelGrid(
|
roundValueToPixelGrid(
|
||||||
absoluteNodeRight,
|
absoluteNodeRight,
|
||||||
pointScaleFactor,
|
pointScaleFactor,
|
||||||
(textRounding && hasFractionalWidth),
|
(textRounding && hasFractionalWidth),
|
||||||
(textRounding && !hasFractionalWidth)) -
|
(textRounding && !hasFractionalWidth)) -
|
||||||
roundValueToPixelGrid(
|
roundValueToPixelGrid(
|
||||||
absoluteNodeLeft, pointScaleFactor, false, textRounding),
|
absoluteNodeLeft, pointScaleFactor, false, textRounding));
|
||||||
Dimension::Width);
|
|
||||||
|
|
||||||
node->setLayoutDimension(
|
node->getLayout().setDimension(
|
||||||
|
Dimension::Height,
|
||||||
roundValueToPixelGrid(
|
roundValueToPixelGrid(
|
||||||
absoluteNodeBottom,
|
absoluteNodeBottom,
|
||||||
pointScaleFactor,
|
pointScaleFactor,
|
||||||
(textRounding && hasFractionalHeight),
|
(textRounding && hasFractionalHeight),
|
||||||
(textRounding && !hasFractionalHeight)) -
|
(textRounding && !hasFractionalHeight)) -
|
||||||
roundValueToPixelGrid(
|
roundValueToPixelGrid(
|
||||||
absoluteNodeTop, pointScaleFactor, false, textRounding),
|
absoluteNodeTop, pointScaleFactor, false, textRounding));
|
||||||
Dimension::Height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (yoga::Node* child : node->getChildren()) {
|
for (yoga::Node* child : node->getChildren()) {
|
||||||
|
@@ -19,6 +19,7 @@ namespace facebook::yoga {
|
|||||||
#if defined(__cpp_exceptions)
|
#if defined(__cpp_exceptions)
|
||||||
throw std::logic_error(message);
|
throw std::logic_error(message);
|
||||||
#else
|
#else
|
||||||
|
static_cast<void>(message); // Unused
|
||||||
std::terminate();
|
std::terminate();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -36,12 +36,12 @@ enum struct LayoutPassReason : int {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct LayoutData {
|
struct LayoutData {
|
||||||
int layouts;
|
int layouts = 0;
|
||||||
int measures;
|
int measures = 0;
|
||||||
uint32_t maxMeasureCache;
|
uint32_t maxMeasureCache = 0;
|
||||||
int cachedLayouts;
|
int cachedLayouts = 0;
|
||||||
int cachedMeasures;
|
int cachedMeasures = 0;
|
||||||
int measureCallbacks;
|
int measureCallbacks = 0;
|
||||||
std::array<int, static_cast<uint8_t>(LayoutPassReason::COUNT)>
|
std::array<int, static_cast<uint8_t>(LayoutPassReason::COUNT)>
|
||||||
measureCallbackReasonsCount;
|
measureCallbackReasonsCount;
|
||||||
};
|
};
|
||||||
|
@@ -66,10 +66,18 @@ struct LayoutResults {
|
|||||||
return measuredDimensions_[yoga::to_underlying(axis)];
|
return measuredDimensions_[yoga::to_underlying(axis)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float rawDimension(Dimension axis) const {
|
||||||
|
return rawDimensions_[yoga::to_underlying(axis)];
|
||||||
|
}
|
||||||
|
|
||||||
void setMeasuredDimension(Dimension axis, float dimension) {
|
void setMeasuredDimension(Dimension axis, float dimension) {
|
||||||
measuredDimensions_[yoga::to_underlying(axis)] = dimension;
|
measuredDimensions_[yoga::to_underlying(axis)] = dimension;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setRawDimension(Dimension axis, float dimension) {
|
||||||
|
rawDimensions_[yoga::to_underlying(axis)] = dimension;
|
||||||
|
}
|
||||||
|
|
||||||
float position(PhysicalEdge physicalEdge) const {
|
float position(PhysicalEdge physicalEdge) const {
|
||||||
return position_[yoga::to_underlying(physicalEdge)];
|
return position_[yoga::to_underlying(physicalEdge)];
|
||||||
}
|
}
|
||||||
@@ -113,6 +121,7 @@ struct LayoutResults {
|
|||||||
|
|
||||||
std::array<float, 2> dimensions_ = {{YGUndefined, YGUndefined}};
|
std::array<float, 2> dimensions_ = {{YGUndefined, YGUndefined}};
|
||||||
std::array<float, 2> measuredDimensions_ = {{YGUndefined, YGUndefined}};
|
std::array<float, 2> measuredDimensions_ = {{YGUndefined, YGUndefined}};
|
||||||
|
std::array<float, 2> rawDimensions_ = {{YGUndefined, YGUndefined}};
|
||||||
std::array<float, 4> position_ = {};
|
std::array<float, 4> position_ = {};
|
||||||
std::array<float, 4> margin_ = {};
|
std::array<float, 4> margin_ = {};
|
||||||
std::array<float, 4> border_ = {};
|
std::array<float, 4> border_ = {};
|
||||||
|
@@ -181,6 +181,17 @@ void Node::setDirty(bool isDirty) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Node::setChildren(const std::vector<Node*>& children) {
|
||||||
|
children_ = children;
|
||||||
|
|
||||||
|
contentsChildrenCount_ = 0;
|
||||||
|
for (const auto& child : children) {
|
||||||
|
if (child->style().display() == Display::Contents) {
|
||||||
|
contentsChildrenCount_++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Node::removeChild(Node* child) {
|
bool Node::removeChild(Node* child) {
|
||||||
auto p = std::find(children_.begin(), children_.end(), child);
|
auto p = std::find(children_.begin(), children_.end(), child);
|
||||||
if (p != children_.end()) {
|
if (p != children_.end()) {
|
||||||
@@ -247,6 +258,7 @@ void Node::setLayoutHadOverflow(bool hadOverflow) {
|
|||||||
|
|
||||||
void Node::setLayoutDimension(float lengthValue, Dimension dimension) {
|
void Node::setLayoutDimension(float lengthValue, Dimension dimension) {
|
||||||
layout_.setDimension(dimension, lengthValue);
|
layout_.setDimension(dimension, lengthValue);
|
||||||
|
layout_.setRawDimension(dimension, lengthValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If both left and right are defined, then use left. Otherwise return +left or
|
// If both left and right are defined, then use left. Otherwise return +left or
|
||||||
@@ -379,6 +391,23 @@ void Node::cloneChildrenIfNeeded() {
|
|||||||
if (child->getOwner() != this) {
|
if (child->getOwner() != this) {
|
||||||
child = resolveRef(config_->cloneNode(child, this, i));
|
child = resolveRef(config_->cloneNode(child, this, i));
|
||||||
child->setOwner(this);
|
child->setOwner(this);
|
||||||
|
|
||||||
|
if (child->hasContentsChildren()) [[unlikely]] {
|
||||||
|
child->cloneContentsChildrenIfNeeded();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Node::cloneContentsChildrenIfNeeded() {
|
||||||
|
size_t i = 0;
|
||||||
|
for (Node*& child : children_) {
|
||||||
|
if (child->style().display() == Display::Contents &&
|
||||||
|
child->getOwner() != this) {
|
||||||
|
child = resolveRef(config_->cloneNode(child, this, i));
|
||||||
|
child->setOwner(this);
|
||||||
|
child->cloneChildrenIfNeeded();
|
||||||
}
|
}
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
@@ -96,6 +96,10 @@ class YG_EXPORT Node : public ::YGNode {
|
|||||||
return config_->hasErrata(errata);
|
return config_->hasErrata(errata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasContentsChildren() const {
|
||||||
|
return contentsChildrenCount_ != 0;
|
||||||
|
}
|
||||||
|
|
||||||
YGDirtiedFunc getDirtiedFunc() const {
|
YGDirtiedFunc getDirtiedFunc() const {
|
||||||
return dirtiedFunc_;
|
return dirtiedFunc_;
|
||||||
}
|
}
|
||||||
@@ -244,15 +248,12 @@ class YG_EXPORT Node : public ::YGNode {
|
|||||||
owner_ = owner;
|
owner_ = owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setChildren(const std::vector<Node*>& children) {
|
|
||||||
children_ = children;
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: rvalue override for setChildren
|
// TODO: rvalue override for setChildren
|
||||||
|
|
||||||
void setConfig(Config* config);
|
void setConfig(Config* config);
|
||||||
|
|
||||||
void setDirty(bool isDirty);
|
void setDirty(bool isDirty);
|
||||||
|
void setChildren(const std::vector<Node*>& children);
|
||||||
void setLayoutLastOwnerDirection(Direction direction);
|
void setLayoutLastOwnerDirection(Direction direction);
|
||||||
void setLayoutComputedFlexBasis(FloatOptional computedFlexBasis);
|
void setLayoutComputedFlexBasis(FloatOptional computedFlexBasis);
|
||||||
void setLayoutComputedFlexBasisGeneration(
|
void setLayoutComputedFlexBasisGeneration(
|
||||||
@@ -286,6 +287,7 @@ class YG_EXPORT Node : public ::YGNode {
|
|||||||
void removeChild(size_t index);
|
void removeChild(size_t index);
|
||||||
|
|
||||||
void cloneChildrenIfNeeded();
|
void cloneChildrenIfNeeded();
|
||||||
|
void cloneContentsChildrenIfNeeded();
|
||||||
void markDirtyAndPropagate();
|
void markDirtyAndPropagate();
|
||||||
float resolveFlexGrow() const;
|
float resolveFlexGrow() const;
|
||||||
float resolveFlexShrink() const;
|
float resolveFlexShrink() const;
|
||||||
|
Reference in New Issue
Block a user