Valentin Shergin 711abeda79 Fabric: Using enum class for some graphics types
Summary:
`enum class` types do not provide default conversion to integers and reguire use typename before value names.
This must prevent bugs like the previous one where we used `Undefined` as a number value.

Reviewed By: fkgozali

Differential Revision: D7554548

fbshipit-source-id: b19379aae48c9aebe03043e08cf3acc712da3cb8
2018-04-10 17:15:08 -07:00

39 lines
1021 B
C++

/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <fabric/core/LayoutPrimitives.h>
#include <fabric/graphics/Geometry.h>
namespace facebook {
namespace react {
/*
* Describes results of layout process for partucular shadow node.
*/
struct LayoutMetrics {
Rect frame;
EdgeInsets contentInsets {0};
EdgeInsets borderWidth {0};
DisplayType displayType {DisplayType::Flex};
LayoutDirection layoutDirection {LayoutDirection::Undefined};
bool operator ==(const LayoutMetrics& rhs) const {
return
std::tie(this->frame, this->contentInsets, this->borderWidth, this->displayType, this->layoutDirection) ==
std::tie(rhs.frame, rhs.contentInsets, rhs.borderWidth, rhs.displayType, rhs.layoutDirection);
}
bool operator !=(const LayoutMetrics& rhs) const {
return !(*this == rhs);
}
};
} // namespace react
} // namespace facebook