Revert D48710084: C++ Cleanup 1/N: Reorganize YGStyle

Differential Revision:
D48710084

Original commit changeset: 20961aee30d5

Original Phabricator Diff: D48710084

fbshipit-source-id: 79cda4f13979b8d0cdf87dabbfc13cbd17abe488
This commit is contained in:
Zhiyao Zhou
2023-08-29 23:27:25 -07:00
committed by Facebook GitHub Bot
parent 13c5ce2234
commit 2a32637c56
15 changed files with 183 additions and 182 deletions

View File

@@ -1,60 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include <yoga/style/Style.h>
#include <yoga/Utils.h>
namespace facebook::yoga {
// Yoga specific properties, not compatible with flexbox specification
bool operator==(const Style& lhs, const Style& rhs) {
bool areNonFloatValuesEqual = lhs.direction() == rhs.direction() &&
lhs.flexDirection() == rhs.flexDirection() &&
lhs.justifyContent() == rhs.justifyContent() &&
lhs.alignContent() == rhs.alignContent() &&
lhs.alignItems() == rhs.alignItems() &&
lhs.alignSelf() == rhs.alignSelf() &&
lhs.positionType() == rhs.positionType() &&
lhs.flexWrap() == rhs.flexWrap() && lhs.overflow() == rhs.overflow() &&
lhs.display() == rhs.display() &&
YGValueEqual(lhs.flexBasis(), rhs.flexBasis()) &&
lhs.margin() == rhs.margin() && lhs.position() == rhs.position() &&
lhs.padding() == rhs.padding() && lhs.border() == rhs.border() &&
lhs.gap() == rhs.gap() && lhs.dimensions() == rhs.dimensions() &&
lhs.minDimensions() == rhs.minDimensions() &&
lhs.maxDimensions() == rhs.maxDimensions();
areNonFloatValuesEqual = areNonFloatValuesEqual &&
lhs.flex().isUndefined() == rhs.flex().isUndefined();
if (areNonFloatValuesEqual && !lhs.flex().isUndefined() &&
!rhs.flex().isUndefined()) {
areNonFloatValuesEqual = areNonFloatValuesEqual && lhs.flex() == rhs.flex();
}
areNonFloatValuesEqual = areNonFloatValuesEqual &&
lhs.flexGrow().isUndefined() == rhs.flexGrow().isUndefined();
if (areNonFloatValuesEqual && !lhs.flexGrow().isUndefined()) {
areNonFloatValuesEqual =
areNonFloatValuesEqual && lhs.flexGrow() == rhs.flexGrow();
}
areNonFloatValuesEqual = areNonFloatValuesEqual &&
lhs.flexShrink().isUndefined() == rhs.flexShrink().isUndefined();
if (areNonFloatValuesEqual && !rhs.flexShrink().isUndefined()) {
areNonFloatValuesEqual =
areNonFloatValuesEqual && lhs.flexShrink() == rhs.flexShrink();
}
if (!(lhs.aspectRatio().isUndefined() && rhs.aspectRatio().isUndefined())) {
areNonFloatValuesEqual =
areNonFloatValuesEqual && lhs.aspectRatio() == rhs.aspectRatio();
}
return areNonFloatValuesEqual;
}
} // namespace facebook::yoga