Valentin Shergin 8f51243957 Fabric: Enabling clang-format for the rest of Fabric
Summary: This is the second and the final part of adopting clang-format.

Reviewed By: mdvacca

Differential Revision: D10229624

fbshipit-source-id: d97670b716800ea2488b84bd0aacaf54d8bd2e31
2018-10-09 16:31:48 -07:00

60 lines
1.8 KiB
C++

// Copyright (c) Facebook, Inc. and its affiliates.
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
#include "ShadowView.h"
#include <fabric/core/LayoutableShadowNode.h>
namespace facebook {
namespace react {
static LayoutMetrics layoutMetricsFromShadowNode(const ShadowNode &shadowNode) {
auto layoutableShadowNode =
dynamic_cast<const LayoutableShadowNode *>(&shadowNode);
return layoutableShadowNode ? layoutableShadowNode->getLayoutMetrics()
: EmptyLayoutMetrics;
}
ShadowView::ShadowView(const ShadowNode &shadowNode)
: componentName(shadowNode.getComponentName()),
componentHandle(shadowNode.getComponentHandle()),
tag(shadowNode.getTag()),
props(shadowNode.getProps()),
eventEmitter(shadowNode.getEventEmitter()),
layoutMetrics(layoutMetricsFromShadowNode(shadowNode)),
localData(shadowNode.getLocalData()) {}
bool ShadowView::operator==(const ShadowView &rhs) const {
return std::tie(
this->tag,
this->componentName,
this->props,
this->eventEmitter,
this->layoutMetrics,
this->localData) ==
std::tie(
rhs.tag,
rhs.componentName,
rhs.props,
rhs.eventEmitter,
rhs.layoutMetrics,
rhs.localData);
}
bool ShadowView::operator!=(const ShadowView &rhs) const {
return !(*this == rhs);
}
bool ShadowViewNodePair::operator==(const ShadowViewNodePair &rhs) const {
return &this->shadowNode == &rhs.shadowNode;
}
bool ShadowViewNodePair::operator!=(const ShadowViewNodePair &rhs) const {
return !(*this == rhs);
}
} // namespace react
} // namespace facebook