From 24f0c56cce35f33678d9d5cb7897d4699cc56079 Mon Sep 17 00:00:00 2001 From: Gilad Bar Date: Tue, 14 May 2024 07:13:21 -0700 Subject: [PATCH] Revert D57285584: Sanitize measure function results Differential Revision: D57285584 Original commit changeset: 935fcdd28c05 Original Phabricator Diff: D57285584 fbshipit-source-id: 3c5d7ccefd608885af4d6f08c0d1cd00553f1f34 --- yoga/node/Node.cpp | 26 ++++---------------------- yoga/node/Node.h | 4 ++-- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/yoga/node/Node.cpp b/yoga/node/Node.cpp index d0a5567a..adb63663 100644 --- a/yoga/node/Node.cpp +++ b/yoga/node/Node.cpp @@ -10,7 +10,6 @@ #include #include -#include #include #include @@ -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 { diff --git a/yoga/node/Node.h b/yoga/node/Node.h index cd029b40..8f5ee591 100644 --- a/yoga/node/Node.h +++ b/yoga/node/Node.h @@ -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 {