Fix measure inner dimensions #1114

Closed
kinarobin wants to merge 3 commits from fix-flex-inner-main-dimension-measure into main
kinarobin commented 2021-12-17 01:39:45 -08:00 (Migrated from github.com)

YGFloatIsUndefined(collectedFlexItemsValues.totalFlexGrowFactors) && collectedFlexItemsValues.totalFlexGrowFactors == 0 is not reachable.

`YGFloatIsUndefined(collectedFlexItemsValues.totalFlexGrowFactors) && collectedFlexItemsValues.totalFlexGrowFactors == 0` is not reachable.
rshest (Migrated from github.com) reviewed 2022-10-07 10:48:14 -07:00
@@ -2952,10 +2952,10 @@ static void YGNodelayoutImpl(
availableInnerMainDim = maxInnerMainDim;
} else {
rshest (Migrated from github.com) commented 2022-10-07 10:48:02 -07:00

Guess those extra parentheses are redundant, now that it's a list of OR clauses... granted, the expression is quite hard to unpack visually, and extra parentheses don't help here, quite an opposite

Guess those extra parentheses are redundant, now that it's a list of OR clauses... granted, the expression is quite hard to unpack visually, and extra parentheses don't help here, quite an opposite
rshest (Migrated from github.com) reviewed 2022-10-07 13:27:32 -07:00
@@ -2952,10 +2952,10 @@ static void YGNodelayoutImpl(
availableInnerMainDim = maxInnerMainDim;
} else {
rshest (Migrated from github.com) commented 2022-10-07 13:27:32 -07:00

I actually believe that the original intent there may have been to have it like this instead:

if (!node->getConfig()->useLegacyStretchBehaviour &&
            ((!YGFloatIsUndefined(
                  collectedFlexItemsValues.totalFlexGrowFactors) &&
              collectedFlexItemsValues.totalFlexGrowFactors == 0) ||
             (!YGFloatIsUndefined(node->resolveFlexGrow()) &&
              node->resolveFlexGrow() == 0))) {
I actually believe that the original intent there may have been to have it like this instead: ```c++ if (!node->getConfig()->useLegacyStretchBehaviour && ((!YGFloatIsUndefined( collectedFlexItemsValues.totalFlexGrowFactors) && collectedFlexItemsValues.totalFlexGrowFactors == 0) || (!YGFloatIsUndefined(node->resolveFlexGrow()) && node->resolveFlexGrow() == 0))) { ```
rshest (Migrated from github.com) requested changes 2022-10-07 13:47:08 -07:00
rshest (Migrated from github.com) left a comment

Please check my comment, the code was wrong there, but I believe the intent was to check if not undefined and then compare with zero for both values.

Please check my comment, the code was wrong there, but I believe the intent was to check if *not* undefined and then compare with zero for both values.
kinarobin (Migrated from github.com) reviewed 2022-10-07 20:39:58 -07:00
@@ -2952,10 +2952,10 @@ static void YGNodelayoutImpl(
availableInnerMainDim = maxInnerMainDim;
} else {
kinarobin (Migrated from github.com) commented 2022-10-07 20:39:57 -07:00

Yeah, you're right. I had update this code.

Yeah, you're right. I had update this code.
facebook-github-bot commented 2022-10-07 22:48:27 -07:00 (Migrated from github.com)

@rshest has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@rshest has imported this pull request. If you are a Meta employee, you can view this diff [on Phabricator](https://www.internalfb.com/diff/D40203817).

Pull request closed

Sign in to join this conversation.
No description provided.