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. Reviewed By: javache Differential Revision: D49131250 fbshipit-source-id: cc1d4e8b179697b9a11a685f4fc4e9d36e1a26a0
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a2d3fc6a3c
commit
c35f8819ae
@@ -18,18 +18,6 @@ public abstract class YogaConfig {
|
|||||||
public abstract void setPrintTreeFlag(boolean enable);
|
public abstract void setPrintTreeFlag(boolean enable);
|
||||||
|
|
||||||
public abstract void setPointScaleFactor(float pixelsInPoint);
|
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);
|
public abstract void setErrata(YogaErrata errata);
|
||||||
|
|
||||||
|
@@ -43,15 +43,6 @@ public abstract class YogaConfigJNIBase extends YogaConfig {
|
|||||||
YogaNative.jni_YGConfigSetPointScaleFactorJNI(mNativePointer, 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) {
|
public void setErrata(YogaErrata errata) {
|
||||||
YogaNative.jni_YGConfigSetErrataJNI(mNativePointer, errata.intValue());
|
YogaNative.jni_YGConfigSetErrataJNI(mNativePointer, errata.intValue());
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,6 @@ public class YogaNative {
|
|||||||
static native void jni_YGConfigSetUseWebDefaultsJNI(long nativePointer, boolean useWebDefaults);
|
static native void jni_YGConfigSetUseWebDefaultsJNI(long nativePointer, boolean useWebDefaults);
|
||||||
static native void jni_YGConfigSetPrintTreeFlagJNI(long nativePointer, boolean enable);
|
static native void jni_YGConfigSetPrintTreeFlagJNI(long nativePointer, boolean enable);
|
||||||
static native void jni_YGConfigSetPointScaleFactorJNI(long nativePointer, float pixelsInPoint);
|
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 void jni_YGConfigSetErrataJNI(long nativePointer, int errata);
|
||||||
static native int jni_YGConfigGetErrataJNI(long nativePointer);
|
static native int jni_YGConfigGetErrataJNI(long nativePointer);
|
||||||
static native void jni_YGConfigSetLoggerJNI(long nativePointer, YogaLogger logger);
|
static native void jni_YGConfigSetLoggerJNI(long nativePointer, YogaLogger logger);
|
||||||
|
@@ -93,18 +93,6 @@ static void jni_YGConfigSetPointScaleFactorJNI(
|
|||||||
YGConfigSetPointScaleFactor(config, pixelsInPoint);
|
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(
|
static void jni_YGConfigSetErrataJNI(
|
||||||
JNIEnv* /*env*/,
|
JNIEnv* /*env*/,
|
||||||
jobject /*obj*/,
|
jobject /*obj*/,
|
||||||
@@ -790,9 +778,6 @@ static JNINativeMethod methods[] = {
|
|||||||
{"jni_YGConfigSetPointScaleFactorJNI",
|
{"jni_YGConfigSetPointScaleFactorJNI",
|
||||||
"(JF)V",
|
"(JF)V",
|
||||||
(void*) jni_YGConfigSetPointScaleFactorJNI},
|
(void*) jni_YGConfigSetPointScaleFactorJNI},
|
||||||
{"jni_YGConfigSetUseLegacyStretchBehaviourJNI",
|
|
||||||
"(JZ)V",
|
|
||||||
(void*) jni_YGConfigSetUseLegacyStretchBehaviourJNI},
|
|
||||||
{"jni_YGConfigSetErrataJNI", "(JI)V", (void*) jni_YGConfigSetErrataJNI},
|
{"jni_YGConfigSetErrataJNI", "(JI)V", (void*) jni_YGConfigSetErrataJNI},
|
||||||
{"jni_YGConfigGetErrataJNI", "(J)I", (void*) jni_YGConfigGetErrataJNI},
|
{"jni_YGConfigGetErrataJNI", "(J)I", (void*) jni_YGConfigGetErrataJNI},
|
||||||
{"jni_YGConfigSetLoggerJNI",
|
{"jni_YGConfigSetLoggerJNI",
|
||||||
|
@@ -292,7 +292,7 @@ public class YogaNodeTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testResetApiShouldResetAllLayoutOutputs() {
|
public void testResetApiShouldResetAllLayoutOutputs() {
|
||||||
YogaConfig config = YogaConfigFactory.create();
|
YogaConfig config = YogaConfigFactory.create();
|
||||||
config.setUseLegacyStretchBehaviour(true);
|
config.setErrata(YogaErrata.STRETCH_FLEX_BASIS);
|
||||||
YogaNode node = createNode(config);
|
YogaNode node = createNode(config);
|
||||||
node.setWidth(100);
|
node.setWidth(100);
|
||||||
node.setHeight(100);
|
node.setHeight(100);
|
||||||
|
@@ -32,13 +32,6 @@ void Config::setPointScaleFactor(float pixelsInPoint) {
|
|||||||
YGConfigSetPointScaleFactor(m_config, 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) {
|
void Config::setErrata(int errata) {
|
||||||
YGConfigSetErrata(m_config, static_cast<YGErrata>(errata));
|
YGConfigSetErrata(m_config, static_cast<YGErrata>(errata));
|
||||||
}
|
}
|
||||||
@@ -52,13 +45,6 @@ bool Config::isExperimentalFeatureEnabled(int feature) const {
|
|||||||
m_config, static_cast<YGExperimentalFeature>(feature));
|
m_config, static_cast<YGExperimentalFeature>(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 {
|
int Config::getErrata() const {
|
||||||
return static_cast<int>(YGConfigGetErrata(m_config));
|
return static_cast<int>(YGConfigGetErrata(m_config));
|
||||||
}
|
}
|
||||||
|
@@ -32,13 +32,11 @@ public: // Prevent accidental copy
|
|||||||
public: // Setters
|
public: // Setters
|
||||||
void setExperimentalFeatureEnabled(int feature, bool enabled);
|
void setExperimentalFeatureEnabled(int feature, bool enabled);
|
||||||
void setPointScaleFactor(float pixelsInPoint);
|
void setPointScaleFactor(float pixelsInPoint);
|
||||||
void setUseLegacyStretchBehaviour(bool useLegacyStretchBehaviour);
|
|
||||||
void setErrata(int errata);
|
void setErrata(int errata);
|
||||||
void setUseWebDefaults(bool useWebDefaults);
|
void setUseWebDefaults(bool useWebDefaults);
|
||||||
|
|
||||||
public: // Getters
|
public: // Getters
|
||||||
bool isExperimentalFeatureEnabled(int feature) const;
|
bool isExperimentalFeatureEnabled(int feature) const;
|
||||||
bool useLegacyStretchBehaviour() const;
|
|
||||||
int getErrata() const;
|
int getErrata() const;
|
||||||
bool useWebDefaults() const;
|
bool useWebDefaults() const;
|
||||||
|
|
||||||
|
@@ -32,13 +32,10 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) {
|
|||||||
"setExperimentalFeatureEnabled",
|
"setExperimentalFeatureEnabled",
|
||||||
&Config::setExperimentalFeatureEnabled)
|
&Config::setExperimentalFeatureEnabled)
|
||||||
.function("setPointScaleFactor", &Config::setPointScaleFactor)
|
.function("setPointScaleFactor", &Config::setPointScaleFactor)
|
||||||
.function(
|
|
||||||
"setUseLegacyStretchBehaviour", &Config::setUseLegacyStretchBehaviour)
|
|
||||||
.function("setErrata", &Config::setErrata)
|
.function("setErrata", &Config::setErrata)
|
||||||
.function("setUseWebDefaults", &Config::setUseWebDefaults)
|
.function("setUseWebDefaults", &Config::setUseWebDefaults)
|
||||||
.function(
|
.function(
|
||||||
"isExperimentalFeatureEnabled", &Config::isExperimentalFeatureEnabled)
|
"isExperimentalFeatureEnabled", &Config::isExperimentalFeatureEnabled)
|
||||||
.function("useLegacyStretchBehaviour", &Config::useLegacyStretchBehaviour)
|
|
||||||
.function("getErrata", &Config::getErrata)
|
.function("getErrata", &Config::getErrata)
|
||||||
.function("useWebDefaults", &Config::useWebDefaults);
|
.function("useWebDefaults", &Config::useWebDefaults);
|
||||||
|
|
||||||
|
12
javascript/src/wrapAssembly.d.ts
vendored
12
javascript/src/wrapAssembly.d.ts
vendored
@@ -53,18 +53,6 @@ export type Config = {
|
|||||||
enabled: boolean,
|
enabled: boolean,
|
||||||
): void;
|
): void;
|
||||||
setPointScaleFactor(factor: number): 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;
|
getErrata(): Errata;
|
||||||
setErrata(errata: Errata): void;
|
setErrata(errata: Errata): void;
|
||||||
useWebDefaults(): boolean;
|
useWebDefaults(): boolean;
|
||||||
|
@@ -1017,21 +1017,6 @@ YOGA_EXPORT void YGConfigSetUseWebDefaults(
|
|||||||
resolveRef(config)->setUseWebDefaults(enabled);
|
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) {
|
bool YGConfigGetUseWebDefaults(const YGConfigConstRef config) {
|
||||||
return resolveRef(config)->useWebDefaults();
|
return resolveRef(config)->useWebDefaults();
|
||||||
}
|
}
|
||||||
|
21
yoga/Yoga.h
21
yoga/Yoga.h
@@ -306,27 +306,6 @@ WIN_EXPORT void YGConfigSetPointScaleFactor(
|
|||||||
float pixelsInPoint);
|
float pixelsInPoint);
|
||||||
WIN_EXPORT float YGConfigGetPointScaleFactor(YGConfigConstRef config);
|
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
|
// YGConfig
|
||||||
WIN_EXPORT YGConfigRef YGConfigNew(void);
|
WIN_EXPORT YGConfigRef YGConfigNew(void);
|
||||||
WIN_EXPORT void YGConfigFree(YGConfigRef config);
|
WIN_EXPORT void YGConfigFree(YGConfigRef config);
|
||||||
|
Reference in New Issue
Block a user