2 * Copyright (c) 2014-present, Facebook, Inc.
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
11 const std::array<float, 2> kYGDefaultDimensionValues = {
12 {YGUndefined, YGUndefined}};
16 dimensions(kYGDefaultDimensionValues),
20 direction(YGDirectionInherit),
21 computedFlexBasisGeneration(0),
22 computedFlexBasis(YGFloatOptional()),
25 lastOwnerDirection((YGDirection)-1),
26 nextCachedMeasurementsIndex(0),
28 measuredDimensions(kYGDefaultDimensionValues),
29 cachedLayout(YGCachedMeasurement()),
30 didUseLegacyFlag(false),
31 doesLegacyStretchFlagAffectsLayout(false) {}
33 bool YGLayout::operator==(const YGLayout& layout) const {
34 bool isEqual = YGFloatArrayEqual(position, layout.position) &&
35 YGFloatArrayEqual(dimensions, layout.dimensions) &&
36 YGFloatArrayEqual(margin, layout.margin) &&
37 YGFloatArrayEqual(border, layout.border) &&
38 YGFloatArrayEqual(padding, layout.padding) &&
39 direction == layout.direction && hadOverflow == layout.hadOverflow &&
40 lastOwnerDirection == layout.lastOwnerDirection &&
41 nextCachedMeasurementsIndex == layout.nextCachedMeasurementsIndex &&
42 cachedLayout == layout.cachedLayout &&
43 computedFlexBasis == layout.computedFlexBasis;
45 for (uint32_t i = 0; i < YG_MAX_CACHED_RESULT_COUNT && isEqual; ++i) {
46 isEqual = isEqual && cachedMeasurements[i] == layout.cachedMeasurements[i];
49 if (!YGFloatIsUndefined(measuredDimensions[0]) ||
50 !YGFloatIsUndefined(layout.measuredDimensions[0])) {
52 isEqual && (measuredDimensions[0] == layout.measuredDimensions[0]);
54 if (!YGFloatIsUndefined(measuredDimensions[1]) ||
55 !YGFloatIsUndefined(layout.measuredDimensions[1])) {
57 isEqual && (measuredDimensions[1] == layout.measuredDimensions[1]);
63 bool YGLayout::operator!=(const YGLayout& layout) const {
64 return !(*this == layout);