Remove config drilling (#1378)
Summary: X-link: https://github.com/facebook/react-native/pull/39404 Pull Request resolved: https://github.com/facebook/yoga/pull/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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
66cc95f932
commit
9d21e3e300
@@ -44,7 +44,6 @@ bool calculateLayoutInternal(
|
|||||||
const float ownerHeight,
|
const float ownerHeight,
|
||||||
const bool performLayout,
|
const bool performLayout,
|
||||||
const LayoutPassReason reason,
|
const LayoutPassReason reason,
|
||||||
const yoga::Config* const config,
|
|
||||||
LayoutData& layoutMarkerData,
|
LayoutData& layoutMarkerData,
|
||||||
const uint32_t depth,
|
const uint32_t depth,
|
||||||
const uint32_t generationCount);
|
const uint32_t generationCount);
|
||||||
@@ -131,7 +130,6 @@ static void computeFlexBasisForChild(
|
|||||||
const float ownerHeight,
|
const float ownerHeight,
|
||||||
const YGMeasureMode heightMode,
|
const YGMeasureMode heightMode,
|
||||||
const YGDirection direction,
|
const YGDirection direction,
|
||||||
const yoga::Config* const config,
|
|
||||||
LayoutData& layoutMarkerData,
|
LayoutData& layoutMarkerData,
|
||||||
const uint32_t depth,
|
const uint32_t depth,
|
||||||
const uint32_t generationCount) {
|
const uint32_t generationCount) {
|
||||||
@@ -305,7 +303,6 @@ static void computeFlexBasisForChild(
|
|||||||
ownerHeight,
|
ownerHeight,
|
||||||
false,
|
false,
|
||||||
LayoutPassReason::kMeasureChild,
|
LayoutPassReason::kMeasureChild,
|
||||||
config,
|
|
||||||
layoutMarkerData,
|
layoutMarkerData,
|
||||||
depth,
|
depth,
|
||||||
generationCount);
|
generationCount);
|
||||||
@@ -324,7 +321,6 @@ static void layoutAbsoluteChild(
|
|||||||
const YGMeasureMode widthMode,
|
const YGMeasureMode widthMode,
|
||||||
const float height,
|
const float height,
|
||||||
const YGDirection direction,
|
const YGDirection direction,
|
||||||
const yoga::Config* const config,
|
|
||||||
LayoutData& layoutMarkerData,
|
LayoutData& layoutMarkerData,
|
||||||
const uint32_t depth,
|
const uint32_t depth,
|
||||||
const uint32_t generationCount) {
|
const uint32_t generationCount) {
|
||||||
@@ -431,7 +427,6 @@ static void layoutAbsoluteChild(
|
|||||||
childHeight,
|
childHeight,
|
||||||
false,
|
false,
|
||||||
LayoutPassReason::kAbsMeasureChild,
|
LayoutPassReason::kAbsMeasureChild,
|
||||||
config,
|
|
||||||
layoutMarkerData,
|
layoutMarkerData,
|
||||||
depth,
|
depth,
|
||||||
generationCount);
|
generationCount);
|
||||||
@@ -452,7 +447,6 @@ static void layoutAbsoluteChild(
|
|||||||
childHeight,
|
childHeight,
|
||||||
true,
|
true,
|
||||||
LayoutPassReason::kAbsLayout,
|
LayoutPassReason::kAbsLayout,
|
||||||
config,
|
|
||||||
layoutMarkerData,
|
layoutMarkerData,
|
||||||
depth,
|
depth,
|
||||||
generationCount);
|
generationCount);
|
||||||
@@ -778,7 +772,6 @@ static float computeFlexBasisForChildren(
|
|||||||
YGMeasureMode heightMeasureMode,
|
YGMeasureMode heightMeasureMode,
|
||||||
YGDirection direction,
|
YGDirection direction,
|
||||||
YGFlexDirection mainAxis,
|
YGFlexDirection mainAxis,
|
||||||
const yoga::Config* const config,
|
|
||||||
bool performLayout,
|
bool performLayout,
|
||||||
LayoutData& layoutMarkerData,
|
LayoutData& layoutMarkerData,
|
||||||
const uint32_t depth,
|
const uint32_t depth,
|
||||||
@@ -844,7 +837,6 @@ static float computeFlexBasisForChildren(
|
|||||||
availableInnerHeight,
|
availableInnerHeight,
|
||||||
heightMeasureMode,
|
heightMeasureMode,
|
||||||
direction,
|
direction,
|
||||||
config,
|
|
||||||
layoutMarkerData,
|
layoutMarkerData,
|
||||||
depth,
|
depth,
|
||||||
generationCount);
|
generationCount);
|
||||||
@@ -876,7 +868,6 @@ static float distributeFreeSpaceSecondPass(
|
|||||||
const bool mainAxisOverflows,
|
const bool mainAxisOverflows,
|
||||||
const YGMeasureMode measureModeCrossDim,
|
const YGMeasureMode measureModeCrossDim,
|
||||||
const bool performLayout,
|
const bool performLayout,
|
||||||
const yoga::Config* const config,
|
|
||||||
LayoutData& layoutMarkerData,
|
LayoutData& layoutMarkerData,
|
||||||
const uint32_t depth,
|
const uint32_t depth,
|
||||||
const uint32_t generationCount) {
|
const uint32_t generationCount) {
|
||||||
@@ -1040,7 +1031,6 @@ static float distributeFreeSpaceSecondPass(
|
|||||||
isLayoutPass,
|
isLayoutPass,
|
||||||
isLayoutPass ? LayoutPassReason::kFlexLayout
|
isLayoutPass ? LayoutPassReason::kFlexLayout
|
||||||
: LayoutPassReason::kFlexMeasure,
|
: LayoutPassReason::kFlexMeasure,
|
||||||
config,
|
|
||||||
layoutMarkerData,
|
layoutMarkerData,
|
||||||
depth,
|
depth,
|
||||||
generationCount);
|
generationCount);
|
||||||
@@ -1172,7 +1162,6 @@ static void resolveFlexibleLength(
|
|||||||
const bool mainAxisOverflows,
|
const bool mainAxisOverflows,
|
||||||
const YGMeasureMode measureModeCrossDim,
|
const YGMeasureMode measureModeCrossDim,
|
||||||
const bool performLayout,
|
const bool performLayout,
|
||||||
const yoga::Config* const config,
|
|
||||||
LayoutData& layoutMarkerData,
|
LayoutData& layoutMarkerData,
|
||||||
const uint32_t depth,
|
const uint32_t depth,
|
||||||
const uint32_t generationCount) {
|
const uint32_t generationCount) {
|
||||||
@@ -1199,7 +1188,6 @@ static void resolveFlexibleLength(
|
|||||||
mainAxisOverflows,
|
mainAxisOverflows,
|
||||||
measureModeCrossDim,
|
measureModeCrossDim,
|
||||||
performLayout,
|
performLayout,
|
||||||
config,
|
|
||||||
layoutMarkerData,
|
layoutMarkerData,
|
||||||
depth,
|
depth,
|
||||||
generationCount);
|
generationCount);
|
||||||
@@ -1496,7 +1484,6 @@ static void calculateLayoutImpl(
|
|||||||
const float ownerWidth,
|
const float ownerWidth,
|
||||||
const float ownerHeight,
|
const float ownerHeight,
|
||||||
const bool performLayout,
|
const bool performLayout,
|
||||||
const yoga::Config* const config,
|
|
||||||
LayoutData& layoutMarkerData,
|
LayoutData& layoutMarkerData,
|
||||||
const uint32_t depth,
|
const uint32_t depth,
|
||||||
const uint32_t generationCount,
|
const uint32_t generationCount,
|
||||||
@@ -1673,7 +1660,6 @@ static void calculateLayoutImpl(
|
|||||||
heightMeasureMode,
|
heightMeasureMode,
|
||||||
direction,
|
direction,
|
||||||
mainAxis,
|
mainAxis,
|
||||||
config,
|
|
||||||
performLayout,
|
performLayout,
|
||||||
layoutMarkerData,
|
layoutMarkerData,
|
||||||
depth,
|
depth,
|
||||||
@@ -1812,7 +1798,6 @@ static void calculateLayoutImpl(
|
|||||||
mainAxisOverflows,
|
mainAxisOverflows,
|
||||||
measureModeCrossDim,
|
measureModeCrossDim,
|
||||||
performLayout,
|
performLayout,
|
||||||
config,
|
|
||||||
layoutMarkerData,
|
layoutMarkerData,
|
||||||
depth,
|
depth,
|
||||||
generationCount);
|
generationCount);
|
||||||
@@ -1987,7 +1972,6 @@ static void calculateLayoutImpl(
|
|||||||
availableInnerHeight,
|
availableInnerHeight,
|
||||||
true,
|
true,
|
||||||
LayoutPassReason::kStretch,
|
LayoutPassReason::kStretch,
|
||||||
config,
|
|
||||||
layoutMarkerData,
|
layoutMarkerData,
|
||||||
depth,
|
depth,
|
||||||
generationCount);
|
generationCount);
|
||||||
@@ -2204,7 +2188,6 @@ static void calculateLayoutImpl(
|
|||||||
availableInnerHeight,
|
availableInnerHeight,
|
||||||
true,
|
true,
|
||||||
LayoutPassReason::kMultilineStretch,
|
LayoutPassReason::kMultilineStretch,
|
||||||
config,
|
|
||||||
layoutMarkerData,
|
layoutMarkerData,
|
||||||
depth,
|
depth,
|
||||||
generationCount);
|
generationCount);
|
||||||
@@ -2340,7 +2323,7 @@ static void calculateLayoutImpl(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const bool absolutePercentageAgainstPaddingEdge =
|
const bool absolutePercentageAgainstPaddingEdge =
|
||||||
config->isExperimentalFeatureEnabled(
|
node->getConfig()->isExperimentalFeatureEnabled(
|
||||||
YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge);
|
YGExperimentalFeatureAbsolutePercentageAgainstPaddingEdge);
|
||||||
|
|
||||||
layoutAbsoluteChild(
|
layoutAbsoluteChild(
|
||||||
@@ -2354,7 +2337,6 @@ static void calculateLayoutImpl(
|
|||||||
? node->getLayout().measuredDimensions[YGDimensionHeight]
|
? node->getLayout().measuredDimensions[YGDimensionHeight]
|
||||||
: availableInnerHeight,
|
: availableInnerHeight,
|
||||||
direction,
|
direction,
|
||||||
config,
|
|
||||||
layoutMarkerData,
|
layoutMarkerData,
|
||||||
depth,
|
depth,
|
||||||
generationCount);
|
generationCount);
|
||||||
@@ -2434,7 +2416,6 @@ bool calculateLayoutInternal(
|
|||||||
const float ownerHeight,
|
const float ownerHeight,
|
||||||
const bool performLayout,
|
const bool performLayout,
|
||||||
const LayoutPassReason reason,
|
const LayoutPassReason reason,
|
||||||
const yoga::Config* const config,
|
|
||||||
LayoutData& layoutMarkerData,
|
LayoutData& layoutMarkerData,
|
||||||
uint32_t depth,
|
uint32_t depth,
|
||||||
const uint32_t generationCount) {
|
const uint32_t generationCount) {
|
||||||
@@ -2594,7 +2575,6 @@ bool calculateLayoutInternal(
|
|||||||
ownerWidth,
|
ownerWidth,
|
||||||
ownerHeight,
|
ownerHeight,
|
||||||
performLayout,
|
performLayout,
|
||||||
config,
|
|
||||||
layoutMarkerData,
|
layoutMarkerData,
|
||||||
depth,
|
depth,
|
||||||
generationCount,
|
generationCount,
|
||||||
@@ -2750,7 +2730,6 @@ void calculateLayout(
|
|||||||
ownerHeight,
|
ownerHeight,
|
||||||
true,
|
true,
|
||||||
LayoutPassReason::kInitial,
|
LayoutPassReason::kInitial,
|
||||||
node->getConfig(),
|
|
||||||
markerData,
|
markerData,
|
||||||
0, // tree root
|
0, // tree root
|
||||||
gCurrentGenerationCount.load(std::memory_order_relaxed))) {
|
gCurrentGenerationCount.load(std::memory_order_relaxed))) {
|
||||||
|
Reference in New Issue
Block a user