Skip to content

Commit

Permalink
Added default constructor for YGCachedMeasurement
Browse files Browse the repository at this point in the history
Summary: Added default constructor for YGCachedMeasurement. This diff uses the default initialiser to get rid off the older designated initializer syntax. This diff also addresses facebook/yoga#700

Reviewed By: emilsjolander

Differential Revision: D7020337

fbshipit-source-id: e084e234bf6a2ae22e53e739959683abca169b88
  • Loading branch information
priteshrnandgaonkar authored and facebook-github-bot committed Feb 20, 2018
1 parent 8739596 commit f414182
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 1 addition & 8 deletions lib/yoga/src/main/cpp/yoga/YGLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,7 @@ YGLayout::YGLayout()
nextCachedMeasurementsIndex(0),
cachedMeasurements(),
measuredDimensions(kYGDefaultDimensionValues),
cachedLayout({
.availableWidth = 0,
.availableHeight = 0,
.widthMeasureMode = (YGMeasureMode)-1,
.heightMeasureMode = (YGMeasureMode)-1,
.computedWidth = -1,
.computedHeight = -1,
}),
cachedLayout(YGCachedMeasurement()),
didUseLegacyFlag(false),
doesLegacyStretchFlagAffectsLayout(false) {}

Expand Down
8 changes: 8 additions & 0 deletions lib/yoga/src/main/cpp/yoga/Yoga-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ struct YGCachedMeasurement {
float computedWidth;
float computedHeight;

YGCachedMeasurement()
: availableWidth(0),
availableHeight(0),
widthMeasureMode((YGMeasureMode)-1),
heightMeasureMode((YGMeasureMode)-1),
computedWidth(-1),
computedHeight(-1) {}

bool operator==(YGCachedMeasurement measurement) const {
bool isEqual = widthMeasureMode == measurement.widthMeasureMode &&
heightMeasureMode == measurement.heightMeasureMode;
Expand Down

0 comments on commit f414182

Please sign in to comment.