Node::styleDefinesDimension() -> Node::hasDefiniteLength() (#1526)

Summary:
X-link: https://github.com/facebook/react-native/pull/41995

Pull Request resolved: https://github.com/facebook/yoga/pull/1526

This function has made quite the journey from something that originally made more sense. This renames, refactors, and adds documentation for what it actually does.

This should eventually make its way into `yoga::Style` once computed style is moved into that structure.

bypass-github-export-checks

Reviewed By: joevilches

Differential Revision: D52105718

fbshipit-source-id: 6492224dd2e10cef3c5fc6a139323ad189a0925c
This commit is contained in:
Nick Gerleman
2023-12-19 13:38:40 -08:00
committed by Facebook GitHub Bot
parent ca4ecc044d
commit 1f391dfc50
4 changed files with 26 additions and 36 deletions

View File

@@ -420,23 +420,6 @@ bool Node::isLayoutDimensionDefined(const FlexDirection axis) {
return yoga::isDefined(value) && value >= 0.0f;
}
bool Node::styleDefinesDimension(
const FlexDirection axis,
const float ownerSize) {
auto resolvedDimension = getResolvedDimension(dimension(axis));
if (!resolvedDimension.isDefined()) {
return false;
}
return !(
resolvedDimension.isAuto() ||
(resolvedDimension.unit() == Unit::Point &&
resolvedDimension.value().unwrap() < 0.0f) ||
(resolvedDimension.unit() == Unit::Percent &&
(resolvedDimension.value().unwrap() < 0.0f ||
yoga::isUndefined(ownerSize))));
}
// Setters
void Node::setMeasureFunc(YGMeasureFunc measureFunc) {