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:
committed by
Facebook GitHub Bot
parent
eb1ca8ec7a
commit
24f0c56cce
@@ -10,7 +10,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <yoga/debug/AssertFatal.h>
|
#include <yoga/debug/AssertFatal.h>
|
||||||
#include <yoga/debug/Log.h>
|
|
||||||
#include <yoga/node/Node.h>
|
#include <yoga/node/Node.h>
|
||||||
#include <yoga/numeric/Comparison.h>
|
#include <yoga/numeric/Comparison.h>
|
||||||
|
|
||||||
@@ -50,29 +49,12 @@ Node::Node(Node&& node) noexcept
|
|||||||
}
|
}
|
||||||
|
|
||||||
YGSize Node::measure(
|
YGSize Node::measure(
|
||||||
float availableWidth,
|
float width,
|
||||||
MeasureMode widthMode,
|
MeasureMode widthMode,
|
||||||
float availableHeight,
|
float height,
|
||||||
MeasureMode heightMode) {
|
MeasureMode heightMode) {
|
||||||
const auto size = measureFunc_(
|
return measureFunc_(
|
||||||
this,
|
this, width, unscopedEnum(widthMode), height, unscopedEnum(heightMode));
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float Node::baseline(float width, float height) const {
|
float Node::baseline(float width, float height) const {
|
||||||
|
@@ -66,9 +66,9 @@ class YG_EXPORT Node : public ::YGNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
YGSize measure(
|
YGSize measure(
|
||||||
float availableWidth,
|
float width,
|
||||||
MeasureMode widthMode,
|
MeasureMode widthMode,
|
||||||
float availableHeight,
|
float height,
|
||||||
MeasureMode heightMode);
|
MeasureMode heightMode);
|
||||||
|
|
||||||
bool hasBaselineFunc() const noexcept {
|
bool hasBaselineFunc() const noexcept {
|
||||||
|
Reference in New Issue
Block a user