Skip to content

Commit fd29d68

Browse files
FBLite Revert Botfacebook-github-bot
authored andcommitted
Revert D76793705: Fix possible invalid measurements when width or height is zero pixels
Differential Revision: D76793705 Original commit changeset: ea4c00e68891 Original Phabricator Diff: D76793705 fbshipit-source-id: 95d6b66ab08e073da9fb07fd4094a7e30e2f453b
1 parent 5348f9f commit fd29d68

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

packages/react-native/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -415,12 +415,6 @@ static void measureNodeWithoutChildren(
415415
Dimension::Height);
416416
}
417417

418-
inline bool isFixedSize(float dim, SizingMode sizingMode) {
419-
return yoga::isDefined(dim) &&
420-
(sizingMode == SizingMode::StretchFit ||
421-
(sizingMode == SizingMode::FitContent && dim <= 0.0));
422-
}
423-
424418
static bool measureNodeWithFixedSize(
425419
yoga::Node* const node,
426420
const Direction direction,
@@ -430,8 +424,12 @@ static bool measureNodeWithFixedSize(
430424
const SizingMode heightSizingMode,
431425
const float ownerWidth,
432426
const float ownerHeight) {
433-
if (isFixedSize(availableWidth, widthSizingMode) &&
434-
isFixedSize(availableHeight, heightSizingMode)) {
427+
if ((yoga::isDefined(availableWidth) &&
428+
widthSizingMode == SizingMode::FitContent && availableWidth <= 0.0f) ||
429+
(yoga::isDefined(availableHeight) &&
430+
heightSizingMode == SizingMode::FitContent && availableHeight <= 0.0f) ||
431+
(widthSizingMode == SizingMode::StretchFit &&
432+
heightSizingMode == SizingMode::StretchFit)) {
435433
node->setLayoutMeasuredDimension(
436434
boundAxis(
437435
node,

0 commit comments

Comments
 (0)