Skip to content

Commit

Permalink
Fix the nodes' owners not being updated when display: contents is u…
Browse files Browse the repository at this point in the history
…sed (#47733)

Summary:
Pull Request resolved: #47733

In facebook/yoga#1729 I moved the cleanup of `display: contents` nodes to happen before all the early returns, but that change also made it be called **before** `cloneChildrenIfNeeded`. It actually needs to be called after `cloneChildrenIfNeeded` to make sure that children of `display: contents` nodes are properly owned.

It also needs to be called in every short-path, so it's being called in four places in this PR. Please let me know whether it's ok or not.

X-link: facebook/yoga#1743

Reviewed By: NickGerleman

Differential Revision: D65953902

Pulled By: zeyap

fbshipit-source-id: 0b18a5651f19c23564f5b3aa2a50833426e9ca5f
  • Loading branch information
j-piasecki authored and facebook-github-bot committed Nov 21, 2024
1 parent 73a2be1 commit aa53bde
Showing 1 changed file with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1294,10 +1294,6 @@ static void calculateLayoutImpl(
flexColumnDirection, direction, ownerWidth),
PhysicalEdge::Bottom);

// Clean and update all display: contents nodes with a direct path to the
// current node as they will not be traversed
cleanupContentsNodesRecursively(node);

if (node->hasMeasureFunc()) {
measureNodeWithMeasureFunc(
node,
Expand All @@ -1310,6 +1306,10 @@ static void calculateLayoutImpl(
ownerHeight,
layoutMarkerData,
reason);

// Clean and update all display: contents nodes with a direct path to the
// current node as they will not be traversed
cleanupContentsNodesRecursively(node);
return;
}

Expand All @@ -1324,6 +1324,10 @@ static void calculateLayoutImpl(
heightSizingMode,
ownerWidth,
ownerHeight);

// Clean and update all display: contents nodes with a direct path to the
// current node as they will not be traversed
cleanupContentsNodesRecursively(node);
return;
}

Expand All @@ -1339,6 +1343,9 @@ static void calculateLayoutImpl(
heightSizingMode,
ownerWidth,
ownerHeight)) {
// Clean and update all display: contents nodes with a direct path to the
// current node as they will not be traversed
cleanupContentsNodesRecursively(node);
return;
}

Expand All @@ -1348,6 +1355,10 @@ static void calculateLayoutImpl(
// Reset layout flags, as they could have changed.
node->setLayoutHadOverflow(false);

// Clean and update all display: contents nodes with a direct path to the
// current node as they will not be traversed
cleanupContentsNodesRecursively(node);

// STEP 1: CALCULATE VALUES FOR REMAINDER OF ALGORITHM
const FlexDirection mainAxis =
resolveDirection(node->style().flexDirection(), direction);
Expand Down

0 comments on commit aa53bde

Please sign in to comment.