Rename Node.h's getResolvedDimension to getProcessedDimension (#1705)

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

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

To get the height and width we call a function currently named `getResolvedDimension`. This returns a `Style::Length`, which in most cases we "resolve" immediately by calling `resolve`. This is a bit confusing that you need to `resolve` something that is already `resolved`.

I plan on adding a new function soon for `contentBox` which would resolve the length for you, so I think this should be renamed.

Also deleted unused `getResolvedDimensions`

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D63407730

fbshipit-source-id: e855c17d9c99817be308b7263fcb5d43559ede14
This commit is contained in:
Joe Vilches
2024-10-01 15:19:22 -07:00
committed by Facebook GitHub Bot
parent 22b018c957
commit b02caa8e06
4 changed files with 23 additions and 27 deletions

View File

@@ -43,7 +43,7 @@ Node::Node(Node&& node) noexcept
owner_(node.owner_),
children_(std::move(node.children_)),
config_(node.config_),
resolvedDimensions_(node.resolvedDimensions_) {
processedDimensions_(node.processedDimensions_) {
for (auto c : children_) {
c->setOwner(this);
}
@@ -292,14 +292,14 @@ Style::Length Node::resolveFlexBasisPtr() const {
return value::ofAuto();
}
void Node::resolveDimension() {
void Node::processDimensions() {
for (auto dim : {Dimension::Width, Dimension::Height}) {
if (style_.maxDimension(dim).isDefined() &&
yoga::inexactEquals(
style_.maxDimension(dim), style_.minDimension(dim))) {
resolvedDimensions_[yoga::to_underlying(dim)] = style_.maxDimension(dim);
processedDimensions_[yoga::to_underlying(dim)] = style_.maxDimension(dim);
} else {
resolvedDimensions_[yoga::to_underlying(dim)] = style_.dimension(dim);
processedDimensions_[yoga::to_underlying(dim)] = style_.dimension(dim);
}
}
}