Skip to content

Commit

Permalink
Fix for nodes with display: contents not being cleaned in some cases
Browse files Browse the repository at this point in the history
Summary:
Fixes a case where a node with `display: contents` would not be cleaned up in some cases. This was caused by it being called after some early returns handling different quick paths. This PR moves the call to `cleanupContentsNodesRecursively` earlier so that it's always called.

Changelog:
[General][Fixed] - Fix for nodes with `display: contents` not being cleaned in some cases

X-link: facebook/yoga#1729

Differential Revision: D64910099

Pulled By: NickGerleman
  • Loading branch information
j-piasecki authored and facebook-github-bot committed Oct 24, 2024
1 parent 70c7616 commit a77671b
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,10 @@ 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 Down Expand Up @@ -1366,9 +1370,6 @@ 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 a77671b

Please sign in to comment.