From dbc34be8237b763f13a9cd62b7bfa8f81317464c Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Sun, 10 Sep 2023 03:30:05 -0700 Subject: [PATCH] Breaking: Remove "UseLegacyStretchBehaviour" functions (#1368) Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1368 X-link: https://github.com/facebook/react-native/pull/39372 These were marked as deprecated as part of the public Yoga 2.0 release, and were alredy emitting deprecation warnings. Remove them. Differential Revision: D49131250 fbshipit-source-id: f3addeaa4984914993ba57633c85b7aad7cecac7 --- java/com/facebook/yoga/YogaConfig.java | 12 ----------- java/com/facebook/yoga/YogaConfigJNIBase.java | 9 -------- java/com/facebook/yoga/YogaNative.java | 1 - java/jni/YGJNIVanilla.cpp | 15 ------------- .../tests/com/facebook/yoga/YogaNodeTest.java | 2 +- javascript/src/Config.cpp | 14 ------------- javascript/src/Config.h | 2 -- javascript/src/embind.cpp | 3 --- javascript/src/wrapAssembly.d.ts | 12 ----------- yoga/Yoga.cpp | 15 ------------- yoga/Yoga.h | 21 ------------------- 11 files changed, 1 insertion(+), 105 deletions(-) diff --git a/java/com/facebook/yoga/YogaConfig.java b/java/com/facebook/yoga/YogaConfig.java index 931313594b..bd7b2998ce 100644 --- a/java/com/facebook/yoga/YogaConfig.java +++ b/java/com/facebook/yoga/YogaConfig.java @@ -18,18 +18,6 @@ public abstract class YogaConfig { public abstract void setPrintTreeFlag(boolean enable); public abstract void setPointScaleFactor(float pixelsInPoint); - /** - * Yoga previously had an error where containers would take the maximum space possible instead of the minimum - * like they are supposed to. In practice this resulted in implicit behaviour similar to align-self: stretch; - * Because this was such a long-standing bug we must allow legacy users to switch back to this behaviour. - * - * @deprecated "setUseLegacyStretchBehaviour" will be removed in the next release. Usage should be replaced with - * "setErrata(YogaErrata.ALL)" to opt out of all future breaking conformance fixes, or - * "setErrata(YogaErrata.STRETCH_FLEX_BASIS)" to opt out of the specific conformance fix previously disabled by - * "UseLegacyStretchBehaviour". - */ - @Deprecated - public abstract void setUseLegacyStretchBehaviour(boolean useLegacyStretchBehaviour); public abstract void setErrata(YogaErrata errata); diff --git a/java/com/facebook/yoga/YogaConfigJNIBase.java b/java/com/facebook/yoga/YogaConfigJNIBase.java index bbe526d700..8e7c94921c 100644 --- a/java/com/facebook/yoga/YogaConfigJNIBase.java +++ b/java/com/facebook/yoga/YogaConfigJNIBase.java @@ -43,15 +43,6 @@ public void setPointScaleFactor(float pixelsInPoint) { YogaNative.jni_YGConfigSetPointScaleFactorJNI(mNativePointer, pixelsInPoint); } - /** - * Yoga previously had an error where containers would take the maximum space possible instead of the minimum - * like they are supposed to. In practice this resulted in implicit behaviour similar to align-self: stretch; - * Because this was such a long-standing bug we must allow legacy users to switch back to this behaviour. - */ - public void setUseLegacyStretchBehaviour(boolean useLegacyStretchBehaviour) { - YogaNative.jni_YGConfigSetUseLegacyStretchBehaviourJNI(mNativePointer, useLegacyStretchBehaviour); - } - public void setErrata(YogaErrata errata) { YogaNative.jni_YGConfigSetErrataJNI(mNativePointer, errata.intValue()); } diff --git a/java/com/facebook/yoga/YogaNative.java b/java/com/facebook/yoga/YogaNative.java index 74f4a98cb4..89e3cde6b0 100644 --- a/java/com/facebook/yoga/YogaNative.java +++ b/java/com/facebook/yoga/YogaNative.java @@ -24,7 +24,6 @@ public class YogaNative { static native void jni_YGConfigSetUseWebDefaultsJNI(long nativePointer, boolean useWebDefaults); static native void jni_YGConfigSetPrintTreeFlagJNI(long nativePointer, boolean enable); static native void jni_YGConfigSetPointScaleFactorJNI(long nativePointer, float pixelsInPoint); - static native void jni_YGConfigSetUseLegacyStretchBehaviourJNI(long nativePointer, boolean useLegacyStretchBehaviour); 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); diff --git a/java/jni/YGJNIVanilla.cpp b/java/jni/YGJNIVanilla.cpp index a95a00340d..86f740e1f5 100644 --- a/java/jni/YGJNIVanilla.cpp +++ b/java/jni/YGJNIVanilla.cpp @@ -93,18 +93,6 @@ static void jni_YGConfigSetPointScaleFactorJNI( YGConfigSetPointScaleFactor(config, pixelsInPoint); } -static void jni_YGConfigSetUseLegacyStretchBehaviourJNI( - JNIEnv* /*env*/, - jobject /*obj*/, - jlong nativePointer, - jboolean useLegacyStretchBehaviour) { - const YGConfigRef config = _jlong2YGConfigRef(nativePointer); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" - YGConfigSetUseLegacyStretchBehaviour(config, useLegacyStretchBehaviour); -#pragma clang diagnostic pop -} - static void jni_YGConfigSetErrataJNI( JNIEnv* /*env*/, jobject /*obj*/, @@ -790,9 +778,6 @@ static JNINativeMethod methods[] = { {"jni_YGConfigSetPointScaleFactorJNI", "(JF)V", (void*) jni_YGConfigSetPointScaleFactorJNI}, - {"jni_YGConfigSetUseLegacyStretchBehaviourJNI", - "(JZ)V", - (void*) jni_YGConfigSetUseLegacyStretchBehaviourJNI}, {"jni_YGConfigSetErrataJNI", "(JI)V", (void*) jni_YGConfigSetErrataJNI}, {"jni_YGConfigGetErrataJNI", "(J)I", (void*) jni_YGConfigGetErrataJNI}, {"jni_YGConfigSetLoggerJNI", diff --git a/java/tests/com/facebook/yoga/YogaNodeTest.java b/java/tests/com/facebook/yoga/YogaNodeTest.java index 3dfdd81e1a..8341d1cf5f 100644 --- a/java/tests/com/facebook/yoga/YogaNodeTest.java +++ b/java/tests/com/facebook/yoga/YogaNodeTest.java @@ -292,7 +292,7 @@ public void directionIsPassedThrough() { @Test public void testResetApiShouldResetAllLayoutOutputs() { YogaConfig config = YogaConfigFactory.create(); - config.setUseLegacyStretchBehaviour(true); + config.setErrata(YogaErrata.STRETCH_FLEX_BASIS); YogaNode node = createNode(config); node.setWidth(100); node.setHeight(100); diff --git a/javascript/src/Config.cpp b/javascript/src/Config.cpp index 986e553e2b..d9313d8e38 100644 --- a/javascript/src/Config.cpp +++ b/javascript/src/Config.cpp @@ -32,13 +32,6 @@ void Config::setPointScaleFactor(float pixelsInPoint) { YGConfigSetPointScaleFactor(m_config, pixelsInPoint); } -void Config::setUseLegacyStretchBehaviour(bool useLegacyStretchBehaviour) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" - YGConfigSetUseLegacyStretchBehaviour(m_config, useLegacyStretchBehaviour); -#pragma clang diagnostic pop -} - void Config::setErrata(int errata) { YGConfigSetErrata(m_config, static_cast(errata)); } @@ -52,13 +45,6 @@ bool Config::isExperimentalFeatureEnabled(int feature) const { m_config, static_cast(feature)); } -bool Config::useLegacyStretchBehaviour() const { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated" - return YGConfigGetUseLegacyStretchBehaviour(m_config); -#pragma clang diagnostic pop -} - int Config::getErrata() const { return static_cast(YGConfigGetErrata(m_config)); } diff --git a/javascript/src/Config.h b/javascript/src/Config.h index 5abfdd5b40..5a15bd450d 100644 --- a/javascript/src/Config.h +++ b/javascript/src/Config.h @@ -32,13 +32,11 @@ class Config { public: // Setters void setExperimentalFeatureEnabled(int feature, bool enabled); void setPointScaleFactor(float pixelsInPoint); - void setUseLegacyStretchBehaviour(bool useLegacyStretchBehaviour); void setErrata(int errata); void setUseWebDefaults(bool useWebDefaults); public: // Getters bool isExperimentalFeatureEnabled(int feature) const; - bool useLegacyStretchBehaviour() const; int getErrata() const; bool useWebDefaults() const; diff --git a/javascript/src/embind.cpp b/javascript/src/embind.cpp index d30094e978..e9b79c8f76 100644 --- a/javascript/src/embind.cpp +++ b/javascript/src/embind.cpp @@ -32,13 +32,10 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) { "setExperimentalFeatureEnabled", &Config::setExperimentalFeatureEnabled) .function("setPointScaleFactor", &Config::setPointScaleFactor) - .function( - "setUseLegacyStretchBehaviour", &Config::setUseLegacyStretchBehaviour) .function("setErrata", &Config::setErrata) .function("setUseWebDefaults", &Config::setUseWebDefaults) .function( "isExperimentalFeatureEnabled", &Config::isExperimentalFeatureEnabled) - .function("useLegacyStretchBehaviour", &Config::useLegacyStretchBehaviour) .function("getErrata", &Config::getErrata) .function("useWebDefaults", &Config::useWebDefaults); diff --git a/javascript/src/wrapAssembly.d.ts b/javascript/src/wrapAssembly.d.ts index 4e3cbb2bc9..b6e2cbab3c 100644 --- a/javascript/src/wrapAssembly.d.ts +++ b/javascript/src/wrapAssembly.d.ts @@ -53,18 +53,6 @@ export type Config = { enabled: boolean, ): void; setPointScaleFactor(factor: number): void; - /** - * @deprecated Please use "getErrata()" - */ - useLegacyStretchBehaviour(): boolean; - /** - * @deprecated "setUseLegacyStretchBehaviour" will be removed in the next - * release. Usage should be replaced with "setErrata(ERRATA_ALL)" to opt out - * of all future breaking conformance fixes, or - * "setErrata(ERRATA_STRETCH_FLEX_BASIS)" to opt out of the specific - * conformance fix previously disabled by "UseLegacyStretchBehaviour". - */ - setUseLegacyStretchBehaviour(useLegacyStretchBehaviour: boolean): void; getErrata(): Errata; setErrata(errata: Errata): void; useWebDefaults(): boolean; diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index b9a5961d44..0a50aa84a4 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -1017,21 +1017,6 @@ YOGA_EXPORT void YGConfigSetUseWebDefaults( resolveRef(config)->setUseWebDefaults(enabled); } -YOGA_EXPORT bool YGConfigGetUseLegacyStretchBehaviour( - const YGConfigConstRef config) { - return resolveRef(config)->hasErrata(YGErrataStretchFlexBasis); -} - -YOGA_EXPORT void YGConfigSetUseLegacyStretchBehaviour( - const YGConfigRef config, - const bool useLegacyStretchBehaviour) { - if (useLegacyStretchBehaviour) { - resolveRef(config)->addErrata(YGErrataStretchFlexBasis); - } else { - resolveRef(config)->removeErrata(YGErrataStretchFlexBasis); - } -} - bool YGConfigGetUseWebDefaults(const YGConfigConstRef config) { return resolveRef(config)->useWebDefaults(); } diff --git a/yoga/Yoga.h b/yoga/Yoga.h index c9efb85fd8..2697bb40ef 100644 --- a/yoga/Yoga.h +++ b/yoga/Yoga.h @@ -306,27 +306,6 @@ WIN_EXPORT void YGConfigSetPointScaleFactor( float pixelsInPoint); WIN_EXPORT float YGConfigGetPointScaleFactor(YGConfigConstRef config); -// Yoga previously had an error where containers would take the maximum space -// possible instead of the minimum like they are supposed to. In practice this -// resulted in implicit behaviour similar to align-self: stretch; Because this -// was such a long-standing bug we must allow legacy users to switch back to -// this behaviour. -WIN_EXPORT YG_DEPRECATED( - "Please use " - "\"YGConfigGetErrata()\"") bool YGConfigGetUseLegacyStretchBehaviour(YGConfigConstRef - config); -WIN_EXPORT -YG_DEPRECATED( - "\"YGConfigSetUseLegacyStretchBehaviour\" will be removed in the next " - "release. Usage should be replaced with \"YGConfigSetErrata(YGErrataAll)\" " - "to opt out of all future breaking conformance fixes, or " - "\"YGConfigSetErrata(YGErrataStretchFlexBasis)\" to opt out of the " - "specific conformance fix previously disabled by " - "\"UseLegacyStretchBehaviour\".") -void YGConfigSetUseLegacyStretchBehaviour( - YGConfigRef config, - bool useLegacyStretchBehaviour); - // YGConfig WIN_EXPORT YGConfigRef YGConfigNew(void); WIN_EXPORT void YGConfigFree(YGConfigRef config);