Fix unnecessary measure calls

Summary:
Fix #334
Closes https://github.com/facebook/yoga/pull/347

Reviewed By: dshahidehpour

Differential Revision: D4455438

Pulled By: emilsjolander

fbshipit-source-id: 013c89e71757d9048708ec85cbb6af9f33ac1ea6
This commit is contained in:
Lukas Wöhrl
2017-01-24 18:57:07 -08:00
committed by Facebook Github Bot
parent a2a84532ff
commit e4b50f2a8d
2 changed files with 43 additions and 2 deletions

View File

@@ -2785,7 +2785,7 @@ static inline bool YGMeasureModeOldSizeIsUnspecifiedAndStillFits(YGMeasureMode s
YGMeasureMode lastSizeMode,
float lastComputedSize) {
return sizeMode == YGMeasureModeAtMost && lastSizeMode == YGMeasureModeUndefined &&
size >= lastComputedSize;
(size >= lastComputedSize || YGFloatsEqual(size, lastComputedSize));
}
static inline bool YGMeasureModeNewMeasureSizeIsStricterAndStillValid(YGMeasureMode sizeMode,
@@ -2794,7 +2794,7 @@ static inline bool YGMeasureModeNewMeasureSizeIsStricterAndStillValid(YGMeasureM
float lastSize,
float lastComputedSize) {
return lastSizeMode == YGMeasureModeAtMost && sizeMode == YGMeasureModeAtMost &&
lastSize > size && lastComputedSize <= size;
lastSize > size && (lastComputedSize <= size || YGFloatsEqual(size, lastComputedSize));
}
bool YGNodeCanUseCachedMeasurement(const YGMeasureMode widthMode,