Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions packages/react-native/ReactCommon/yoga/yoga/style/Style.h
Original file line number Diff line number Diff line change
Expand Up @@ -661,10 +661,10 @@ class YG_EXPORT Style {
lengthsEqual(padding_, pool_, other.padding_, other.pool_) &&
lengthsEqual(border_, pool_, other.border_, other.pool_) &&
lengthsEqual(gap_, pool_, other.gap_, other.pool_) &&
lengthsEqual(dimensions_, pool_, other.dimensions_, other.pool_) &&
lengthsEqual(
sizeLengthsEqual(dimensions_, pool_, other.dimensions_, other.pool_) &&
sizeLengthsEqual(
minDimensions_, pool_, other.minDimensions_, other.pool_) &&
lengthsEqual(
sizeLengthsEqual(
maxDimensions_, pool_, other.maxDimensions_, other.pool_) &&
numbersEqual(aspectRatio_, pool_, other.aspectRatio_, other.pool_) &&
gridTemplateColumns_ == other.gridTemplateColumns_ &&
Expand Down Expand Up @@ -716,6 +716,31 @@ class YG_EXPORT Style {
});
}

static inline bool sizeLengthsEqual(
const StyleValueHandle& lhsHandle,
const StyleValuePool& lhsPool,
const StyleValueHandle& rhsHandle,
const StyleValuePool& rhsPool) {
return (lhsHandle.isUndefined() && rhsHandle.isUndefined()) ||
(lhsPool.getSize(lhsHandle) == rhsPool.getSize(rhsHandle));
}

template <size_t N>
static inline bool sizeLengthsEqual(
const std::array<StyleValueHandle, N>& lhs,
const StyleValuePool& lhsPool,
const std::array<StyleValueHandle, N>& rhs,
const StyleValuePool& rhsPool) {
return std::equal(
lhs.begin(),
lhs.end(),
rhs.begin(),
rhs.end(),
[&](const auto& lhs, const auto& rhs) {
return sizeLengthsEqual(lhs, lhsPool, rhs, rhsPool);
});
}

StyleValueHandle computeColumnGap() const {
if (gap_[yoga::to_underlying(Gutter::Column)].isDefined()) {
return gap_[yoga::to_underlying(Gutter::Column)];
Expand Down
Loading