Skip to content

Commit be00354

Browse files
joevilchesfacebook-github-bot
authored andcommitted
Back out "Modify private apis to set, store, and get intrinsic sizing keywords" (#1750)
Summary: X-link: facebook/react-native#47895 Pull Request resolved: #1750 These APIs were only added so that we could do TDD as we work on intrinsic sizing functionality. As of right now they do nothing. We are aiming on publishing a new version of Yoga soon so for the time being we are going to back these out so as not to confuse anyone with this new functionality. Ideally we get to a point where we have some temporary experimental header to stage these in but this is a bit time sensitive so just backing out for now Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D66332307 fbshipit-source-id: 1d596964e0c893091c541988506e8b80fa6d1957
1 parent 0c99549 commit be00354

File tree

17 files changed

+54
-317
lines changed

17 files changed

+54
-317
lines changed

enums.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,7 @@
88

99
ENUMS = {
1010
"Direction": ["Inherit", "LTR", "RTL"],
11-
"Unit": [
12-
"Undefined",
13-
"Point",
14-
"Percent",
15-
"Auto",
16-
"MaxContent",
17-
"FitContent",
18-
"Stretch",
19-
],
11+
"Unit": ["Undefined", "Point", "Percent", "Auto"],
2012
"FlexDirection": ["Column", "ColumnReverse", "Row", "RowReverse"],
2113
"Justify": [
2214
"FlexStart",

java/com/facebook/yoga/YogaUnit.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ public enum YogaUnit {
1313
UNDEFINED(0),
1414
POINT(1),
1515
PERCENT(2),
16-
AUTO(3),
17-
MAX_CONTENT(4),
18-
FIT_CONTENT(5),
19-
STRETCH(6);
16+
AUTO(3);
2017

2118
private final int mIntValue;
2219

@@ -34,9 +31,6 @@ public static YogaUnit fromInt(int value) {
3431
case 1: return POINT;
3532
case 2: return PERCENT;
3633
case 3: return AUTO;
37-
case 4: return MAX_CONTENT;
38-
case 5: return FIT_CONTENT;
39-
case 6: return STRETCH;
4034
default: throw new IllegalArgumentException("Unknown enum value: " + value);
4135
}
4236
}

javascript/src/generated/YGEnums.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@ export enum Unit {
125125
Point = 1,
126126
Percent = 2,
127127
Auto = 3,
128-
MaxContent = 4,
129-
FitContent = 5,
130-
Stretch = 6,
131128
}
132129

133130
export enum Wrap {
@@ -206,9 +203,6 @@ const constants = {
206203
UNIT_POINT: Unit.Point,
207204
UNIT_PERCENT: Unit.Percent,
208205
UNIT_AUTO: Unit.Auto,
209-
UNIT_MAX_CONTENT: Unit.MaxContent,
210-
UNIT_FIT_CONTENT: Unit.FitContent,
211-
UNIT_STRETCH: Unit.Stretch,
212206
WRAP_NO_WRAP: Wrap.NoWrap,
213207
WRAP_WRAP: Wrap.Wrap,
214208
WRAP_WRAP_REVERSE: Wrap.WrapReverse,

tests/StyleValuePoolTest.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -128,19 +128,4 @@ TEST(StyleValuePool, store_undefined_after_large_int) {
128128
EXPECT_EQ(pool.getLength(handle), StyleLength::undefined());
129129
}
130130

131-
TEST(StyleValuePool, store_keywords) {
132-
StyleValuePool pool;
133-
StyleValueHandle handleMaxContent;
134-
StyleValueHandle handleFitContent;
135-
StyleValueHandle handleStretch;
136-
137-
pool.store(handleMaxContent, StyleSizeLength::ofMaxContent());
138-
pool.store(handleFitContent, StyleSizeLength::ofFitContent());
139-
pool.store(handleStretch, StyleSizeLength::ofStretch());
140-
141-
EXPECT_EQ(pool.getSize(handleMaxContent), StyleSizeLength::ofMaxContent());
142-
EXPECT_EQ(pool.getSize(handleFitContent), StyleSizeLength::ofFitContent());
143-
EXPECT_EQ(pool.getSize(handleStretch), StyleSizeLength::ofStretch());
144-
}
145-
146131
} // namespace facebook::yoga

yoga/YGEnums.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,6 @@ const char* YGUnitToString(const YGUnit value) {
245245
return "percent";
246246
case YGUnitAuto:
247247
return "auto";
248-
case YGUnitMaxContent:
249-
return "max-content";
250-
case YGUnitFitContent:
251-
return "fit-content";
252-
case YGUnitStretch:
253-
return "stretch";
254248
}
255249
return "unknown";
256250
}

yoga/YGEnums.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,7 @@ YG_ENUM_DECL(
131131
YGUnitUndefined,
132132
YGUnitPoint,
133133
YGUnitPercent,
134-
YGUnitAuto,
135-
YGUnitMaxContent,
136-
YGUnitFitContent,
137-
YGUnitStretch)
134+
YGUnitAuto)
138135

139136
YG_ENUM_DECL(
140137
YGWrap,

yoga/YGNodeStyle.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,19 @@ float YGNodeStyleGetFlexShrink(const YGNodeConstRef nodeRef) {
177177

178178
void YGNodeStyleSetFlexBasis(const YGNodeRef node, const float flexBasis) {
179179
updateStyle<&Style::flexBasis, &Style::setFlexBasis>(
180-
node, StyleSizeLength::points(flexBasis));
180+
node, StyleLength::points(flexBasis));
181181
}
182182

183183
void YGNodeStyleSetFlexBasisPercent(
184184
const YGNodeRef node,
185185
const float flexBasisPercent) {
186186
updateStyle<&Style::flexBasis, &Style::setFlexBasis>(
187-
node, StyleSizeLength::percent(flexBasisPercent));
187+
node, StyleLength::percent(flexBasisPercent));
188188
}
189189

190190
void YGNodeStyleSetFlexBasisAuto(const YGNodeRef node) {
191191
updateStyle<&Style::flexBasis, &Style::setFlexBasis>(
192-
node, StyleSizeLength::ofAuto());
192+
node, StyleLength::ofAuto());
193193
}
194194

195195
YGValue YGNodeStyleGetFlexBasis(const YGNodeConstRef node) {
@@ -308,17 +308,17 @@ YGBoxSizing YGNodeStyleGetBoxSizing(const YGNodeConstRef node) {
308308

309309
void YGNodeStyleSetWidth(YGNodeRef node, float points) {
310310
updateStyle<&Style::dimension, &Style::setDimension>(
311-
node, Dimension::Width, StyleSizeLength::points(points));
311+
node, Dimension::Width, StyleLength::points(points));
312312
}
313313

314314
void YGNodeStyleSetWidthPercent(YGNodeRef node, float percent) {
315315
updateStyle<&Style::dimension, &Style::setDimension>(
316-
node, Dimension::Width, StyleSizeLength::percent(percent));
316+
node, Dimension::Width, StyleLength::percent(percent));
317317
}
318318

319319
void YGNodeStyleSetWidthAuto(YGNodeRef node) {
320320
updateStyle<&Style::dimension, &Style::setDimension>(
321-
node, Dimension::Width, StyleSizeLength::ofAuto());
321+
node, Dimension::Width, StyleLength::ofAuto());
322322
}
323323

324324
YGValue YGNodeStyleGetWidth(YGNodeConstRef node) {
@@ -327,17 +327,17 @@ YGValue YGNodeStyleGetWidth(YGNodeConstRef node) {
327327

328328
void YGNodeStyleSetHeight(YGNodeRef node, float points) {
329329
updateStyle<&Style::dimension, &Style::setDimension>(
330-
node, Dimension::Height, StyleSizeLength::points(points));
330+
node, Dimension::Height, StyleLength::points(points));
331331
}
332332

333333
void YGNodeStyleSetHeightPercent(YGNodeRef node, float percent) {
334334
updateStyle<&Style::dimension, &Style::setDimension>(
335-
node, Dimension::Height, StyleSizeLength::percent(percent));
335+
node, Dimension::Height, StyleLength::percent(percent));
336336
}
337337

338338
void YGNodeStyleSetHeightAuto(YGNodeRef node) {
339339
updateStyle<&Style::dimension, &Style::setDimension>(
340-
node, Dimension::Height, StyleSizeLength::ofAuto());
340+
node, Dimension::Height, StyleLength::ofAuto());
341341
}
342342

343343
YGValue YGNodeStyleGetHeight(YGNodeConstRef node) {
@@ -346,12 +346,12 @@ YGValue YGNodeStyleGetHeight(YGNodeConstRef node) {
346346

347347
void YGNodeStyleSetMinWidth(const YGNodeRef node, const float minWidth) {
348348
updateStyle<&Style::minDimension, &Style::setMinDimension>(
349-
node, Dimension::Width, StyleSizeLength::points(minWidth));
349+
node, Dimension::Width, StyleLength::points(minWidth));
350350
}
351351

352352
void YGNodeStyleSetMinWidthPercent(const YGNodeRef node, const float minWidth) {
353353
updateStyle<&Style::minDimension, &Style::setMinDimension>(
354-
node, Dimension::Width, StyleSizeLength::percent(minWidth));
354+
node, Dimension::Width, StyleLength::percent(minWidth));
355355
}
356356

357357
YGValue YGNodeStyleGetMinWidth(const YGNodeConstRef node) {
@@ -360,14 +360,14 @@ YGValue YGNodeStyleGetMinWidth(const YGNodeConstRef node) {
360360

361361
void YGNodeStyleSetMinHeight(const YGNodeRef node, const float minHeight) {
362362
updateStyle<&Style::minDimension, &Style::setMinDimension>(
363-
node, Dimension::Height, StyleSizeLength::points(minHeight));
363+
node, Dimension::Height, StyleLength::points(minHeight));
364364
}
365365

366366
void YGNodeStyleSetMinHeightPercent(
367367
const YGNodeRef node,
368368
const float minHeight) {
369369
updateStyle<&Style::minDimension, &Style::setMinDimension>(
370-
node, Dimension::Height, StyleSizeLength::percent(minHeight));
370+
node, Dimension::Height, StyleLength::percent(minHeight));
371371
}
372372

373373
YGValue YGNodeStyleGetMinHeight(const YGNodeConstRef node) {
@@ -376,12 +376,12 @@ YGValue YGNodeStyleGetMinHeight(const YGNodeConstRef node) {
376376

377377
void YGNodeStyleSetMaxWidth(const YGNodeRef node, const float maxWidth) {
378378
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
379-
node, Dimension::Width, StyleSizeLength::points(maxWidth));
379+
node, Dimension::Width, StyleLength::points(maxWidth));
380380
}
381381

382382
void YGNodeStyleSetMaxWidthPercent(const YGNodeRef node, const float maxWidth) {
383383
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
384-
node, Dimension::Width, StyleSizeLength::percent(maxWidth));
384+
node, Dimension::Width, StyleLength::percent(maxWidth));
385385
}
386386

387387
YGValue YGNodeStyleGetMaxWidth(const YGNodeConstRef node) {
@@ -390,14 +390,14 @@ YGValue YGNodeStyleGetMaxWidth(const YGNodeConstRef node) {
390390

391391
void YGNodeStyleSetMaxHeight(const YGNodeRef node, const float maxHeight) {
392392
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
393-
node, Dimension::Height, StyleSizeLength::points(maxHeight));
393+
node, Dimension::Height, StyleLength::points(maxHeight));
394394
}
395395

396396
void YGNodeStyleSetMaxHeightPercent(
397397
const YGNodeRef node,
398398
const float maxHeight) {
399399
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
400-
node, Dimension::Height, StyleSizeLength::percent(maxHeight));
400+
node, Dimension::Height, StyleLength::percent(maxHeight));
401401
}
402402

403403
YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) {

yoga/YGValue.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ inline bool operator==(const YGValue& lhs, const YGValue& rhs) {
6565
switch (lhs.unit) {
6666
case YGUnitUndefined:
6767
case YGUnitAuto:
68-
case YGUnitFitContent:
69-
case YGUnitMaxContent:
70-
case YGUnitStretch:
7168
return true;
7269
case YGUnitPoint:
7370
case YGUnitPercent:

yoga/algorithm/CalculateLayout.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ static float distributeFreeSpaceSecondPass(
741741
marginCross;
742742
const bool isLoosePercentageMeasurement =
743743
currentLineChild->getProcessedDimension(dimension(crossAxis))
744-
.isPercent() &&
744+
.unit() == Unit::Percent &&
745745
sizingModeCrossDim != SizingMode::StretchFit;
746746
childCrossSizingMode =
747747
yoga::isUndefined(childCrossSize) || isLoosePercentageMeasurement

yoga/enums/Unit.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@ enum class Unit : uint8_t {
2020
Point = YGUnitPoint,
2121
Percent = YGUnitPercent,
2222
Auto = YGUnitAuto,
23-
MaxContent = YGUnitMaxContent,
24-
FitContent = YGUnitFitContent,
25-
Stretch = YGUnitStretch,
2623
};
2724

2825
template <>
2926
constexpr int32_t ordinalCount<Unit>() {
30-
return 7;
27+
return 4;
3128
}
3229

3330
constexpr Unit scopedEnum(YGUnit unscoped) {

0 commit comments

Comments
 (0)