Expose a function which marks all descendants dirty
Reviewed By: emilsjolander Differential Revision: D6911869 fbshipit-source-id: e0a3abcf5653f921297edfdca473d83b947cc627
This commit is contained in:
Родитель
af0c863570
Коммит
528bbacf6b
|
@ -9,13 +9,11 @@
|
||||||
|
|
||||||
package com.facebook.yoga;
|
package com.facebook.yoga;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
import com.facebook.proguard.annotations.DoNotStrip;
|
import com.facebook.proguard.annotations.DoNotStrip;
|
||||||
import com.facebook.soloader.SoLoader;
|
import com.facebook.soloader.SoLoader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
@DoNotStrip
|
@DoNotStrip
|
||||||
public class YogaNode {
|
public class YogaNode {
|
||||||
|
@ -195,6 +193,12 @@ public class YogaNode {
|
||||||
jni_YGNodeMarkDirty(mNativePointer);
|
jni_YGNodeMarkDirty(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void jni_YGNodeMarkDirtyAndPropogateToDescendants(long nativePointer);
|
||||||
|
|
||||||
|
public void dirtyAllDescendants() {
|
||||||
|
jni_YGNodeMarkDirtyAndPropogateToDescendants(mNativePointer);
|
||||||
|
}
|
||||||
|
|
||||||
private native boolean jni_YGNodeIsDirty(long nativePointer);
|
private native boolean jni_YGNodeIsDirty(long nativePointer);
|
||||||
public boolean isDirty() {
|
public boolean isDirty() {
|
||||||
return jni_YGNodeIsDirty(mNativePointer);
|
return jni_YGNodeIsDirty(mNativePointer);
|
||||||
|
|
|
@ -251,6 +251,12 @@ void jni_YGNodeMarkDirty(alias_ref<jobject>, jlong nativePointer) {
|
||||||
YGNodeMarkDirty(_jlong2YGNodeRef(nativePointer));
|
YGNodeMarkDirty(_jlong2YGNodeRef(nativePointer));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void jni_YGNodeMarkDirtyAndPropogateToDescendants(
|
||||||
|
alias_ref<jobject>,
|
||||||
|
jlong nativePointer) {
|
||||||
|
YGNodeMarkDirtyAndPropogateToDescendants(_jlong2YGNodeRef(nativePointer));
|
||||||
|
}
|
||||||
|
|
||||||
jboolean jni_YGNodeIsDirty(alias_ref<jobject>, jlong nativePointer) {
|
jboolean jni_YGNodeIsDirty(alias_ref<jobject>, jlong nativePointer) {
|
||||||
return (jboolean)_jlong2YGNodeRef(nativePointer)->isDirty();
|
return (jboolean)_jlong2YGNodeRef(nativePointer)->isDirty();
|
||||||
}
|
}
|
||||||
|
@ -449,7 +455,8 @@ jint jni_YGNodeGetInstanceCount(alias_ref<jclass> clazz) {
|
||||||
|
|
||||||
jint JNI_OnLoad(JavaVM *vm, void *) {
|
jint JNI_OnLoad(JavaVM *vm, void *) {
|
||||||
return initialize(vm, [] {
|
return initialize(vm, [] {
|
||||||
registerNatives("com/facebook/yoga/YogaNode",
|
registerNatives(
|
||||||
|
"com/facebook/yoga/YogaNode",
|
||||||
{
|
{
|
||||||
YGMakeNativeMethod(jni_YGNodeNew),
|
YGMakeNativeMethod(jni_YGNodeNew),
|
||||||
YGMakeNativeMethod(jni_YGNodeNewWithConfig),
|
YGMakeNativeMethod(jni_YGNodeNewWithConfig),
|
||||||
|
@ -459,6 +466,7 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
|
||||||
YGMakeNativeMethod(jni_YGNodeRemoveChild),
|
YGMakeNativeMethod(jni_YGNodeRemoveChild),
|
||||||
YGMakeNativeMethod(jni_YGNodeCalculateLayout),
|
YGMakeNativeMethod(jni_YGNodeCalculateLayout),
|
||||||
YGMakeNativeMethod(jni_YGNodeMarkDirty),
|
YGMakeNativeMethod(jni_YGNodeMarkDirty),
|
||||||
|
YGMakeNativeMethod(jni_YGNodeMarkDirtyAndPropogateToDescendants),
|
||||||
YGMakeNativeMethod(jni_YGNodeIsDirty),
|
YGMakeNativeMethod(jni_YGNodeIsDirty),
|
||||||
YGMakeNativeMethod(jni_YGNodeSetHasMeasureFunc),
|
YGMakeNativeMethod(jni_YGNodeSetHasMeasureFunc),
|
||||||
YGMakeNativeMethod(jni_YGNodeSetHasBaselineFunc),
|
YGMakeNativeMethod(jni_YGNodeSetHasBaselineFunc),
|
||||||
|
|
|
@ -215,6 +215,10 @@ bool YGNodeLayoutGetDidUseLegacyFlag(const YGNodeRef node) {
|
||||||
return node->didUseLegacyFlag();
|
return node->didUseLegacyFlag();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void YGNodeMarkDirtyAndPropogateToDescendants(const YGNodeRef node) {
|
||||||
|
return node->markDirtyAndPropogateDownwards();
|
||||||
|
}
|
||||||
|
|
||||||
int32_t gNodeInstanceCount = 0;
|
int32_t gNodeInstanceCount = 0;
|
||||||
int32_t gConfigInstanceCount = 0;
|
int32_t gConfigInstanceCount = 0;
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,10 @@ WIN_EXPORT void YGNodeCalculateLayout(const YGNodeRef node,
|
||||||
// marking manually.
|
// marking manually.
|
||||||
WIN_EXPORT void YGNodeMarkDirty(const YGNodeRef node);
|
WIN_EXPORT void YGNodeMarkDirty(const YGNodeRef node);
|
||||||
|
|
||||||
|
// This function marks the current node and all its descendants as dirty. This function is added to test yoga benchmarks.
|
||||||
|
// This function is not expected to be used in production as calling `YGCalculateLayout` will cause the recalculation of each and every node.
|
||||||
|
WIN_EXPORT void YGNodeMarkDirtyAndPropogateToDescendants(const YGNodeRef node);
|
||||||
|
|
||||||
WIN_EXPORT void YGNodePrint(const YGNodeRef node, const YGPrintOptions options);
|
WIN_EXPORT void YGNodePrint(const YGNodeRef node, const YGPrintOptions options);
|
||||||
|
|
||||||
WIN_EXPORT bool YGFloatIsUndefined(const float value);
|
WIN_EXPORT bool YGFloatIsUndefined(const float value);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче