Revert D57285584: Sanitize measure function results

Differential Revision:
D57285584

Original commit changeset: 935fcdd28c05

Original Phabricator Diff: D57285584

fbshipit-source-id: 3c5d7ccefd608885af4d6f08c0d1cd00553f1f34
This commit is contained in:
Gilad Bar
2024-05-14 07:13:21 -07:00
committed by Facebook GitHub Bot
parent eb1ca8ec7a
commit 24f0c56cce
2 changed files with 6 additions and 24 deletions

View File

@@ -10,7 +10,6 @@
#include <iostream>
#include <yoga/debug/AssertFatal.h>
#include <yoga/debug/Log.h>
#include <yoga/node/Node.h>
#include <yoga/numeric/Comparison.h>
@@ -50,29 +49,12 @@ Node::Node(Node&& node) noexcept
}
YGSize Node::measure(
float availableWidth,
float width,
MeasureMode widthMode,
float availableHeight,
float height,
MeasureMode heightMode) {
const auto size = measureFunc_(
this,
availableWidth,
unscopedEnum(widthMode),
availableHeight,
unscopedEnum(heightMode));
if (yoga::isUndefined(size.height) || size.height < 0 ||
yoga::isUndefined(size.width) || size.width < 0) {
yoga::log(
this,
LogLevel::Error,
"Measure function returned an invalid dimension to Yoga: [width=%f, height=%f]",
size.width,
size.height);
return {.width = 0.0f, .height = 0.0f};
}
return size;
return measureFunc_(
this, width, unscopedEnum(widthMode), height, unscopedEnum(heightMode));
}
float Node::baseline(float width, float height) const {

View File

@@ -66,9 +66,9 @@ class YG_EXPORT Node : public ::YGNode {
}
YGSize measure(
float availableWidth,
float width,
MeasureMode widthMode,
float availableHeight,
float height,
MeasureMode heightMode);
bool hasBaselineFunc() const noexcept {