Correct YGNodeCanUseCachedMeasurement to account for non-existent scale factor
Summary: When config was added to YGNodeCanUseCachedMeasurement we didn't account for default 0 scale factor. This diff fixes that Reviewed By: emilsjolander Differential Revision: D5061016 fbshipit-source-id: 907ef987bd0ead29cf02f6945a3f03d4ffb58a2e
This commit is contained in:
committed by
Facebook Github Bot
parent
adad054cad
commit
9cdaedfcb5
@@ -3164,10 +3164,11 @@ bool YGNodeCanUseCachedMeasurement(const YGMeasureMode widthMode,
|
|||||||
if (lastComputedHeight < 0 || lastComputedWidth < 0) {
|
if (lastComputedHeight < 0 || lastComputedWidth < 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const float effectiveWidth = config != NULL ? YGRoundValueToPixelGrid(width, config->pointScaleFactor, false, false) : width;
|
bool useRoundedComparison = config != NULL && config->pointScaleFactor != 0;
|
||||||
const float effectiveHeight = config != NULL ? YGRoundValueToPixelGrid(height, config->pointScaleFactor, false, false) : height;
|
const float effectiveWidth = useRoundedComparison ? YGRoundValueToPixelGrid(width, config->pointScaleFactor, false, false) : width;
|
||||||
const float effectiveLastWidth = config != NULL ? YGRoundValueToPixelGrid(lastWidth, config->pointScaleFactor, false, false) : lastWidth;
|
const float effectiveHeight = useRoundedComparison ? YGRoundValueToPixelGrid(height, config->pointScaleFactor, false, false) : height;
|
||||||
const float effectiveLastHeight = config != NULL ? YGRoundValueToPixelGrid(lastHeight, config->pointScaleFactor, false, false) : lastHeight;
|
const float effectiveLastWidth = useRoundedComparison ? YGRoundValueToPixelGrid(lastWidth, config->pointScaleFactor, false, false) : lastWidth;
|
||||||
|
const float effectiveLastHeight = useRoundedComparison ? YGRoundValueToPixelGrid(lastHeight, config->pointScaleFactor, false, false) : lastHeight;
|
||||||
|
|
||||||
const bool hasSameWidthSpec = lastWidthMode == widthMode && YGFloatsEqual(effectiveLastWidth, effectiveWidth);
|
const bool hasSameWidthSpec = lastWidthMode == widthMode && YGFloatsEqual(effectiveLastWidth, effectiveWidth);
|
||||||
const bool hasSameHeightSpec = lastHeightMode == heightMode && YGFloatsEqual(effectiveLastHeight, effectiveHeight);
|
const bool hasSameHeightSpec = lastHeightMode == heightMode && YGFloatsEqual(effectiveLastHeight, effectiveHeight);
|
||||||
|
Reference in New Issue
Block a user