Skip to content

Commit

Permalink
Remove config drilling (#1378)
Browse files Browse the repository at this point in the history
Summary:
X-link: facebook/react-native#39404

Pull Request resolved: #1378

We thread a config through the root node, to every function, that we don't actually use (with the exception of `canUseCachedMeasurement` in the previous diff which was passing root `pointScaleFactor`).

Since the model is currently per-node config, this only creates redundancy/confusion.

I do think we might want to make some more global/layout-pass scoped configuration in the future, but likely not with this sort of drilling.

Reviewed By: yungsters

Differential Revision: D49180385

fbshipit-source-id: 91248042df7d3cea1fc316b47b8137fcb790b521
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Sep 14, 2023
1 parent 66cc95f commit 9d21e3e
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions yoga/algorithm/CalculateLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ bool calculateLayoutInternal(
const float ownerHeight,
const bool performLayout,
const LayoutPassReason reason,
const yoga::Config* const config,
LayoutData& layoutMarkerData,
const uint32_t depth,
const uint32_t generationCount);
Expand Down Expand Up @@ -131,7 +130,6 @@ static void computeFlexBasisForChild(
const float ownerHeight,
const YGMeasureMode heightMode,
const YGDirection direction,
const yoga::Config* const config,
LayoutData& layoutMarkerData,
const uint32_t depth,
const uint32_t generationCount) {
Expand Down Expand Up @@ -305,7 +303,6 @@ static void computeFlexBasisForChild(
ownerHeight,
false,
LayoutPassReason::kMeasureChild,
config,
layoutMarkerData,
depth,
generationCount);
Expand All @@ -324,7 +321,6 @@ static void layoutAbsoluteChild(
const YGMeasureMode widthMode,
const float height,
const YGDirection direction,
const yoga::Config* const config,
LayoutData& layoutMarkerData,
const uint32_t depth,
const uint32_t generationCount) {
Expand Down Expand Up @@ -431,7 +427,6 @@ static void layoutAbsoluteChild(
childHeight,
false,
LayoutPassReason::kAbsMeasureChild,
config,
layoutMarkerData,
depth,
generationCount);
Expand All @@ -452,7 +447,6 @@ static void layoutAbsoluteChild(
childHeight,
true,
LayoutPassReason::kAbsLayout,
config,
layoutMarkerData,
depth,
generationCount);
Expand Down Expand Up @@ -778,7 +772,6 @@ static float computeFlexBasisForChildren(
YGMeasureMode heightMeasureMode,
YGDirection direction,
YGFlexDirection mainAxis,
const yoga::Config* const config,
bool performLayout,
LayoutData& layoutMarkerData,
const uint32_t depth,
Expand Down Expand Up @@ -844,7 +837,6 @@ static float computeFlexBasisForChildren(
availableInnerHeight,
heightMeasureMode,
direction,
config,
layoutMarkerData,
depth,
generationCount);
Expand Down Expand Up @@ -876,7 +868,6 @@ static float distributeFreeSpaceSecondPass(
const bool mainAxisOverflows,
const YGMeasureMode measureModeCrossDim,
const bool performLayout,
const yoga::Config* const config,
LayoutData& layoutMarkerData,
const uint32_t depth,
const uint32_t generationCount) {
Expand Down Expand Up @@ -1040,7 +1031,6 @@ static float distributeFreeSpaceSecondPass(
isLayoutPass,
isLayoutPass ? LayoutPassReason::kFlexLayout
: LayoutPassReason::kFlexMeasure,
config,
layoutMarkerData,
depth,
generationCount);
Expand Down Expand Up @@ -1172,7 +1162,6 @@ static void resolveFlexibleLength(
const bool mainAxisOverflows,
const YGMeasureMode measureModeCrossDim,
const bool performLayout,
const yoga::Config* const config,
LayoutData& layoutMarkerData,
const uint32_t depth,
const uint32_t generationCount) {
Expand All @@ -1199,7 +1188,6 @@ static void resolveFlexibleLength(
mainAxisOverflows,
measureModeCrossDim,
performLayout,
config,
layoutMarkerData,
depth,
generationCount);
Expand Down Expand Up @@ -1496,7 +1484,6 @@ static void calculateLayoutImpl(
const float ownerWidth,
const float ownerHeight,
const bool performLayout,
const yoga::Config* const config,
LayoutData& layoutMarkerData,
const uint32_t depth,
const uint32_t generationCount,
Expand Down Expand Up @@ -1673,7 +1660,6 @@ static void calculateLayoutImpl(
heightMeasureMode,
direction,
mainAxis,
config,
performLayout,
layoutMarkerData,
depth,
Expand Down Expand Up @@ -1812,7 +1798,6 @@ static void calculateLayoutImpl(
mainAxisOverflows,
measureModeCrossDim,
performLayout,
config,
layoutMarkerData,
depth,
generationCount);
Expand Down Expand Up @@ -1987,7 +1972,6 @@ static void calculateLayoutImpl(
availableInnerHeight,
true,
LayoutPassReason::kStretch,
config,
layoutMarkerData,
depth,
generationCount);
Expand Down Expand Up @@ -2204,7 +2188,6 @@ static void calculateLayoutImpl(
availableInnerHeight,
true,
LayoutPassReason::kMultilineStretch,
config,
layoutMarkerData,
depth,
generationCount);
Expand Down Expand Up @@ -2340,7 +2323,7 @@ static void calculateLayoutImpl(
continue;
}
const bool absolutePercentageAgainstPaddingEdge =
config->isExperimentalFeatureEnabled(
node->getConfig()->isExperimentalFeatureEnabled(
YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge);

layoutAbsoluteChild(
Expand All @@ -2354,7 +2337,6 @@ static void calculateLayoutImpl(
? node->getLayout().measuredDimensions[YGDimensionHeight]
: availableInnerHeight,
direction,
config,
layoutMarkerData,
depth,
generationCount);
Expand Down Expand Up @@ -2434,7 +2416,6 @@ bool calculateLayoutInternal(
const float ownerHeight,
const bool performLayout,
const LayoutPassReason reason,
const yoga::Config* const config,
LayoutData& layoutMarkerData,
uint32_t depth,
const uint32_t generationCount) {
Expand Down Expand Up @@ -2594,7 +2575,6 @@ bool calculateLayoutInternal(
ownerWidth,
ownerHeight,
performLayout,
config,
layoutMarkerData,
depth,
generationCount,
Expand Down Expand Up @@ -2750,7 +2730,6 @@ void calculateLayout(
ownerHeight,
true,
LayoutPassReason::kInitial,
node->getConfig(),
markerData,
0, // tree root
gCurrentGenerationCount.load(std::memory_order_relaxed))) {
Expand Down

0 comments on commit 9d21e3e

Please sign in to comment.