Skip to content

Commit c76b52b

Browse files
generatedunixname89002005232357meta-codesync[bot]
authored andcommitted
Revert D105720159: Spec-correct CSS Flexbox §4.5 auto-min-size opt-in on YGConfig
Differential Revision: D105720159 Original commit changeset: 57a14408b105 Original Phabricator Diff: D105720159 fbshipit-source-id: 0e642b96c7e21077af1b6778e306c355ef80441a
1 parent 35e3bbd commit c76b52b

22 files changed

Lines changed: 4 additions & 1146 deletions

enums.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,6 @@
8686
# Absolute nodes will resolve percentages against the inner size of
8787
# their containing node, not the padding box
8888
("AbsolutePercentAgainstInnerSize", 1 << 2),
89-
# Treat main-axis `min-{width,height}: undefined` as "no floor"
90-
# instead of the CSS §4.5 automatic minimum (which derives a
91-
# content-based floor from the item's min-content size). Set by
92-
# default on new configs to preserve pre-§4.5 Yoga shrink behavior.
93-
# Clear this bit to opt into the spec-correct CSS §4.5 floor.
94-
("MinSizeUndefinedInsteadOfAuto", 1 << 3),
9589
# Enable all incorrect behavior (preserve compatibility)
9690
("All", 0x7FFFFFFF),
9791
# Enable all errata except for "StretchFlexBasis" (Defaults behavior

java/com/facebook/yoga/YogaConfig.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ public abstract class YogaConfig {
1919

2020
public abstract fun setErrata(errata: YogaErrata)
2121

22-
/**
23-
* Sets the errata bitmask directly from an [Int]. Use this when combining multiple [YogaErrata]
24-
* values (e.g., `YogaErrata.CLASSIC.intValue() and
25-
* YogaErrata.STRETCH_FLEX_BASIS.intValue().inv()`) — the [YogaErrata] enum cannot represent
26-
* arbitrary bitmask combinations.
27-
*/
28-
public abstract fun setErrata(errata: Int)
29-
3022
public abstract fun getErrata(): YogaErrata
3123

3224
public abstract fun setLogger(logger: YogaLogger?)

java/com/facebook/yoga/YogaConfigJNIBase.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ private constructor(@JvmField protected var nativePointer: Long) : YogaConfig()
5050
YogaNative.jni_YGConfigSetErrataJNI(nativePointer, errata.intValue())
5151
}
5252

53-
public override fun setErrata(errata: Int) {
54-
YogaNative.jni_YGConfigSetErrataJNI(nativePointer, errata)
55-
}
56-
5753
public override fun getErrata(): YogaErrata =
5854
YogaErrata.fromInt(YogaNative.jni_YGConfigGetErrataJNI(nativePointer))
5955

java/com/facebook/yoga/YogaErrata.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public enum class YogaErrata(public val intValue: Int) {
1414
STRETCH_FLEX_BASIS(1),
1515
ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING(2),
1616
ABSOLUTE_PERCENT_AGAINST_INNER_SIZE(4),
17-
MIN_SIZE_UNDEFINED_INSTEAD_OF_AUTO(8),
1817
ALL(2147483647),
1918
CLASSIC(2147483646);
2019

@@ -28,7 +27,6 @@ public enum class YogaErrata(public val intValue: Int) {
2827
1 -> STRETCH_FLEX_BASIS
2928
2 -> ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING
3029
4 -> ABSOLUTE_PERCENT_AGAINST_INNER_SIZE
31-
8 -> MIN_SIZE_UNDEFINED_INSTEAD_OF_AUTO
3230
2147483647 -> ALL
3331
2147483646 -> CLASSIC
3432
else -> throw IllegalArgumentException("Unknown enum value: $value")

java/com/facebook/yoga/YogaNative.kt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -311,22 +311,6 @@ public object YogaNative {
311311
@JvmStatic
312312
public external fun jni_YGNodeSetHasMeasureFuncJNI(nativePointer: Long, hasMeasureFunc: Boolean)
313313

314-
@JvmStatic
315-
public external fun jni_YGNodeSetHasMinContentMeasureFuncJNI(
316-
nativePointer: Long,
317-
hasMinContentMeasureFunc: Boolean,
318-
)
319-
320-
@JvmStatic
321-
public external fun jni_YGNodeSetMinContentWidthJNI(nativePointer: Long, minContentWidth: Float)
322-
323-
@JvmStatic
324-
public external fun jni_YGNodeSetMinContentHeightJNI(nativePointer: Long, minContentHeight: Float)
325-
326-
@JvmStatic public external fun jni_YGNodeGetMinContentWidthJNI(nativePointer: Long): Float
327-
328-
@JvmStatic public external fun jni_YGNodeGetMinContentHeightJNI(nativePointer: Long): Float
329-
330314
@JvmStatic
331315
public external fun jni_YGNodeSetHasBaselineFuncJNI(nativePointer: Long, hasMeasureFunc: Boolean)
332316

java/com/facebook/yoga/YogaNode.kt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,16 +228,6 @@ public abstract class YogaNode : YogaProps {
228228

229229
abstract override fun setMeasureFunction(measureFunction: YogaMeasureFunction?)
230230

231-
abstract override fun setMinContentMeasureFunction(measureFunction: YogaMeasureFunction?)
232-
233-
abstract override fun setMinContentWidth(minContentWidth: Float)
234-
235-
abstract override fun setMinContentHeight(minContentHeight: Float)
236-
237-
abstract override fun getMinContentWidth(): Float
238-
239-
abstract override fun getMinContentHeight(): Float
240-
241231
abstract override fun setBaselineFunction(yogaBaselineFunction: YogaBaselineFunction?)
242232

243233
public abstract val isMeasureDefined: Boolean

java/com/facebook/yoga/YogaNodeJNIBase.kt

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public abstract class YogaNodeJNIBase : YogaNode, Cloneable {
1616
private var config: YogaConfig? = null
1717
private var children: MutableList<YogaNodeJNIBase>? = null
1818
private var measureFunction: YogaMeasureFunction? = null
19-
private var minContentMeasureFunction: YogaMeasureFunction? = null
2019
private var baselineFunction: YogaBaselineFunction? = null
2120
protected var nativePointer: Long = 0
2221

@@ -47,7 +46,6 @@ public abstract class YogaNodeJNIBase : YogaNode, Cloneable {
4746

4847
override fun reset() {
4948
measureFunction = null
50-
minContentMeasureFunction = null
5149
baselineFunction = null
5250
data = null
5351
arr = null
@@ -526,25 +524,6 @@ public abstract class YogaNodeJNIBase : YogaNode, Cloneable {
526524
YogaNative.jni_YGNodeSetHasMeasureFuncJNI(nativePointer, measureFunction != null)
527525
}
528526

529-
override fun setMinContentMeasureFunction(measureFunction: YogaMeasureFunction?) {
530-
this.minContentMeasureFunction = measureFunction
531-
YogaNative.jni_YGNodeSetHasMinContentMeasureFuncJNI(nativePointer, measureFunction != null)
532-
}
533-
534-
override fun setMinContentWidth(minContentWidth: Float) {
535-
YogaNative.jni_YGNodeSetMinContentWidthJNI(nativePointer, minContentWidth)
536-
}
537-
538-
override fun setMinContentHeight(minContentHeight: Float) {
539-
YogaNative.jni_YGNodeSetMinContentHeightJNI(nativePointer, minContentHeight)
540-
}
541-
542-
override fun getMinContentWidth(): Float =
543-
YogaNative.jni_YGNodeGetMinContentWidthJNI(nativePointer)
544-
545-
override fun getMinContentHeight(): Float =
546-
YogaNative.jni_YGNodeGetMinContentHeightJNI(nativePointer)
547-
548527
override fun setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: Boolean) {
549528
YogaNative.jni_YGNodeSetAlwaysFormsContainingBlockJNI(
550529
nativePointer,
@@ -568,27 +547,6 @@ public abstract class YogaNodeJNIBase : YogaNode, Cloneable {
568547
)
569548
}
570549

571-
// Native callback invoked by Yoga during the CSS Flexbox §4.5 auto-min
572-
// probe when a min-content measure function is registered. Mirrors
573-
// [measure]; see that method's note on non-overridability.
574-
@DoNotStrip
575-
public fun measureMinContent(
576-
width: Float,
577-
widthMode: Int,
578-
height: Float,
579-
heightMode: Int,
580-
): Long {
581-
val mf =
582-
checkNotNull(minContentMeasureFunction) { "Min-content measure function isn't defined!" }
583-
return mf.measure(
584-
this,
585-
width,
586-
YogaMeasureMode.fromInt(widthMode),
587-
height,
588-
YogaMeasureMode.fromInt(heightMode),
589-
)
590-
}
591-
592550
override fun setBaselineFunction(yogaBaselineFunction: YogaBaselineFunction?) {
593551
baselineFunction = yogaBaselineFunction
594552
YogaNative.jni_YGNodeSetHasBaselineFuncJNI(nativePointer, yogaBaselineFunction != null)

java/com/facebook/yoga/YogaProps.kt

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -125,28 +125,6 @@ public interface YogaProps {
125125

126126
public fun setMeasureFunction(measureFunction: YogaMeasureFunction?)
127127

128-
public fun setMinContentMeasureFunction(measureFunction: YogaMeasureFunction?)
129-
130-
/**
131-
* Sets the static min-content width used by the CSS Flexbox §4.5 automatic minimum sizing probe.
132-
* Pass `YogaConstants.UNDEFINED` to clear. See `YGNodeSetMinContentWidth` in the Yoga C API for
133-
* full precedence rules.
134-
*/
135-
public fun setMinContentWidth(minContentWidth: Float)
136-
137-
/**
138-
* Sets the static min-content height used by the CSS Flexbox §4.5 automatic minimum sizing probe.
139-
* Pass `YogaConstants.UNDEFINED` to clear. See `YGNodeSetMinContentHeight` in the Yoga C API for
140-
* full precedence rules.
141-
*/
142-
public fun setMinContentHeight(minContentHeight: Float)
143-
144-
/** Returns the static min-content width, or `YogaConstants.UNDEFINED` if not set. */
145-
public fun getMinContentWidth(): Float
146-
147-
/** Returns the static min-content height, or `YogaConstants.UNDEFINED` if not set. */
148-
public fun getMinContentHeight(): Float
149-
150128
public fun setBaselineFunction(yogaBaselineFunction: YogaBaselineFunction?)
151129

152130
/* Mutable properties - getter and setter with matching types */

java/jni/YGJNIVanilla.cpp

Lines changed: 0 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -683,83 +683,6 @@ static void jni_YGNodeSetHasMeasureFuncJNI(
683683
static_cast<bool>(hasMeasureFunc) ? YGJNIMeasureFunc : nullptr);
684684
}
685685

686-
static YGSize YGJNIMinContentMeasureFunc(
687-
YGNodeConstRef node,
688-
float width,
689-
YGMeasureMode widthMode,
690-
float height,
691-
YGMeasureMode heightMode) {
692-
if (auto obj = YGNodeJobject(node)) {
693-
YGTransferLayoutDirection(node, obj.get());
694-
JNIEnv* env = getCurrentEnv();
695-
auto objectClass = facebook::yoga::vanillajni::make_local_ref(
696-
env, env->GetObjectClass(obj.get()));
697-
// NOLINTNEXTLINE(misc-misplaced-const)
698-
static const jmethodID methodId = facebook::yoga::vanillajni::getMethodId(
699-
env, objectClass.get(), "measureMinContent", "(FIFI)J");
700-
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg)
701-
const auto measureResult = facebook::yoga::vanillajni::callLongMethod(
702-
env, obj.get(), methodId, width, widthMode, height, heightMode);
703-
704-
uint32_t wBits = 0xFFFFFFFF & (measureResult >> 32);
705-
uint32_t hBits = 0xFFFFFFFF & measureResult;
706-
auto measuredWidth = std::bit_cast<float>(wBits);
707-
auto measuredHeight = std::bit_cast<float>(hBits);
708-
709-
return YGSize{measuredWidth, measuredHeight};
710-
} else {
711-
return YGSize{
712-
widthMode == YGMeasureModeUndefined ? 0 : width,
713-
heightMode == YGMeasureModeUndefined ? 0 : height,
714-
};
715-
}
716-
}
717-
718-
static void jni_YGNodeSetHasMinContentMeasureFuncJNI(
719-
JNIEnv* /*env*/,
720-
jobject /*obj*/,
721-
jlong nativePointer,
722-
jboolean hasMinContentMeasureFunc) {
723-
YGNodeSetMinContentMeasureFunc(
724-
_jlong2YGNodeRef(nativePointer),
725-
static_cast<bool>(hasMinContentMeasureFunc) ? YGJNIMinContentMeasureFunc
726-
: nullptr);
727-
}
728-
729-
static void jni_YGNodeSetMinContentWidthJNI(
730-
JNIEnv* /*env*/,
731-
jobject /*obj*/,
732-
jlong nativePointer,
733-
jfloat minContentWidth) {
734-
YGNodeSetMinContentWidth(
735-
_jlong2YGNodeRef(nativePointer), static_cast<float>(minContentWidth));
736-
}
737-
738-
static void jni_YGNodeSetMinContentHeightJNI(
739-
JNIEnv* /*env*/,
740-
jobject /*obj*/,
741-
jlong nativePointer,
742-
jfloat minContentHeight) {
743-
YGNodeSetMinContentHeight(
744-
_jlong2YGNodeRef(nativePointer), static_cast<float>(minContentHeight));
745-
}
746-
747-
static jfloat jni_YGNodeGetMinContentWidthJNI(
748-
JNIEnv* /*env*/,
749-
jobject /*obj*/,
750-
jlong nativePointer) {
751-
return static_cast<jfloat>(
752-
YGNodeGetMinContentWidth(_jlong2YGNodeRef(nativePointer)));
753-
}
754-
755-
static jfloat jni_YGNodeGetMinContentHeightJNI(
756-
JNIEnv* /*env*/,
757-
jobject /*obj*/,
758-
jlong nativePointer) {
759-
return static_cast<jfloat>(
760-
YGNodeGetMinContentHeight(_jlong2YGNodeRef(nativePointer)));
761-
}
762-
763686
static float YGJNIBaselineFunc(YGNodeConstRef node, float width, float height) {
764687
if (auto obj = YGNodeJobject(node)) {
765688
JNIEnv* env = getCurrentEnv();
@@ -1135,23 +1058,6 @@ static JNINativeMethod methods[] = {
11351058
{"jni_YGNodeSetHasMeasureFuncJNI",
11361059
"(JZ)V",
11371060
(void*)jni_YGNodeSetHasMeasureFuncJNI},
1138-
// NOLINTBEGIN(cppcoreguidelines-pro-type-cstyle-cast)
1139-
{"jni_YGNodeSetHasMinContentMeasureFuncJNI",
1140-
"(JZ)V",
1141-
(void*)jni_YGNodeSetHasMinContentMeasureFuncJNI},
1142-
{"jni_YGNodeSetMinContentWidthJNI",
1143-
"(JF)V",
1144-
(void*)jni_YGNodeSetMinContentWidthJNI},
1145-
{"jni_YGNodeSetMinContentHeightJNI",
1146-
"(JF)V",
1147-
(void*)jni_YGNodeSetMinContentHeightJNI},
1148-
{"jni_YGNodeGetMinContentWidthJNI",
1149-
"(J)F",
1150-
(void*)jni_YGNodeGetMinContentWidthJNI},
1151-
{"jni_YGNodeGetMinContentHeightJNI",
1152-
"(J)F",
1153-
(void*)jni_YGNodeGetMinContentHeightJNI},
1154-
// NOLINTEND(cppcoreguidelines-pro-type-cstyle-cast)
11551061
{"jni_YGNodeStyleGetGapJNI", "(JI)J", (void*)jni_YGNodeStyleGetGapJNI},
11561062
{"jni_YGNodeStyleSetGapJNI", "(JIF)V", (void*)jni_YGNodeStyleSetGapJNI},
11571063
{"jni_YGNodeStyleSetGapPercentJNI",

javascript/src/generated/YGEnums.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ export enum Errata {
6161
StretchFlexBasis = 1,
6262
AbsolutePositionWithoutInsetsExcludesPadding = 2,
6363
AbsolutePercentAgainstInnerSize = 4,
64-
MinSizeUndefinedInsteadOfAuto = 8,
6564
All = 2147483647,
6665
Classic = 2147483646,
6766
}
@@ -189,7 +188,6 @@ const constants = {
189188
ERRATA_STRETCH_FLEX_BASIS: Errata.StretchFlexBasis,
190189
ERRATA_ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING: Errata.AbsolutePositionWithoutInsetsExcludesPadding,
191190
ERRATA_ABSOLUTE_PERCENT_AGAINST_INNER_SIZE: Errata.AbsolutePercentAgainstInnerSize,
192-
ERRATA_MIN_SIZE_UNDEFINED_INSTEAD_OF_AUTO: Errata.MinSizeUndefinedInsteadOfAuto,
193191
ERRATA_ALL: Errata.All,
194192
ERRATA_CLASSIC: Errata.Classic,
195193
EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: ExperimentalFeature.WebFlexBasis,

0 commit comments

Comments
 (0)