C++ style enums 8/N: Direction (#1392)
Summary: X-link: https://github.com/facebook/react-native/pull/39483 Pull Request resolved: https://github.com/facebook/yoga/pull/1392 Moves internal usages of YGDirection to Direction. bypass-github-export-checks Changelog: [Internal] Reviewed By: rshest Differential Revision: D49335231 fbshipit-source-id: 459fe820c91be88734cebaa8655cd3f0afda83bf
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ea3869fe9f
commit
9b99e4fc22
@@ -296,7 +296,7 @@ void Node::removeChild(size_t index) {
|
||||
children_.erase(children_.begin() + static_cast<ptrdiff_t>(index));
|
||||
}
|
||||
|
||||
void Node::setLayoutDirection(YGDirection direction) {
|
||||
void Node::setLayoutDirection(Direction direction) {
|
||||
layout_.setDirection(direction);
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ void Node::setLayoutPadding(float padding, YGEdge edge) {
|
||||
layout_.padding[edge] = padding;
|
||||
}
|
||||
|
||||
void Node::setLayoutLastOwnerDirection(YGDirection direction) {
|
||||
void Node::setLayoutLastOwnerDirection(Direction direction) {
|
||||
layout_.lastOwnerDirection = direction;
|
||||
}
|
||||
|
||||
@@ -369,14 +369,14 @@ FloatOptional Node::relativePosition(
|
||||
}
|
||||
|
||||
void Node::setPosition(
|
||||
const YGDirection direction,
|
||||
const Direction direction,
|
||||
const float mainSize,
|
||||
const float crossSize,
|
||||
const float ownerWidth) {
|
||||
/* Root nodes should be always layouted as LTR, so we don't return negative
|
||||
* values. */
|
||||
const YGDirection directionRespectingRoot =
|
||||
owner_ != nullptr ? direction : YGDirectionLTR;
|
||||
const Direction directionRespectingRoot =
|
||||
owner_ != nullptr ? direction : Direction::LTR;
|
||||
const YGFlexDirection mainAxis =
|
||||
yoga::resolveDirection(style_.flexDirection(), directionRespectingRoot);
|
||||
const YGFlexDirection crossAxis =
|
||||
@@ -447,10 +447,10 @@ void Node::resolveDimension() {
|
||||
}
|
||||
}
|
||||
|
||||
YGDirection Node::resolveDirection(const YGDirection ownerDirection) {
|
||||
if (style_.direction() == YGDirectionInherit) {
|
||||
return ownerDirection > YGDirectionInherit ? ownerDirection
|
||||
: YGDirectionLTR;
|
||||
Direction Node::resolveDirection(const Direction ownerDirection) {
|
||||
if (style_.direction() == Direction::Inherit) {
|
||||
return ownerDirection != Direction::Inherit ? ownerDirection
|
||||
: Direction::LTR;
|
||||
} else {
|
||||
return style_.direction();
|
||||
}
|
||||
|
Reference in New Issue
Block a user