mirror of
https://github.com/status-im/react-native.git
synced 2025-01-24 16:29:01 +00:00
Overflow detection in Yoga
Reviewed By: gkassabli Differential Revision: D5336645 fbshipit-source-id: c4f87d1754d7bac848e8d347b31d619393b94d2c
This commit is contained in:
parent
12ab236629
commit
ecd5829bf8
@ -54,6 +54,7 @@ typedef struct YGLayout {
|
|||||||
|
|
||||||
uint32_t computedFlexBasisGeneration;
|
uint32_t computedFlexBasisGeneration;
|
||||||
float computedFlexBasis;
|
float computedFlexBasis;
|
||||||
|
bool hadOverflow;
|
||||||
|
|
||||||
// Instead of recomputing the entire layout every single time, we
|
// Instead of recomputing the entire layout every single time, we
|
||||||
// cache some information to break early when nothing changed
|
// cache some information to break early when nothing changed
|
||||||
@ -192,6 +193,7 @@ static YGNode gYGNodeDefaults = {
|
|||||||
.lastParentDirection = (YGDirection) -1,
|
.lastParentDirection = (YGDirection) -1,
|
||||||
.nextCachedMeasurementsIndex = 0,
|
.nextCachedMeasurementsIndex = 0,
|
||||||
.computedFlexBasis = YGUndefined,
|
.computedFlexBasis = YGUndefined,
|
||||||
|
.hadOverflow = false,
|
||||||
.measuredDimensions = YG_DEFAULT_DIMENSION_VALUES,
|
.measuredDimensions = YG_DEFAULT_DIMENSION_VALUES,
|
||||||
|
|
||||||
.cachedLayout =
|
.cachedLayout =
|
||||||
@ -782,6 +784,7 @@ YG_NODE_LAYOUT_PROPERTY_IMPL(float, Bottom, position[YGEdgeBottom]);
|
|||||||
YG_NODE_LAYOUT_PROPERTY_IMPL(float, Width, dimensions[YGDimensionWidth]);
|
YG_NODE_LAYOUT_PROPERTY_IMPL(float, Width, dimensions[YGDimensionWidth]);
|
||||||
YG_NODE_LAYOUT_PROPERTY_IMPL(float, Height, dimensions[YGDimensionHeight]);
|
YG_NODE_LAYOUT_PROPERTY_IMPL(float, Height, dimensions[YGDimensionHeight]);
|
||||||
YG_NODE_LAYOUT_PROPERTY_IMPL(YGDirection, Direction, direction);
|
YG_NODE_LAYOUT_PROPERTY_IMPL(YGDirection, Direction, direction);
|
||||||
|
YG_NODE_LAYOUT_PROPERTY_IMPL(bool, HadOverflow, hadOverflow);
|
||||||
|
|
||||||
YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Margin, margin);
|
YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Margin, margin);
|
||||||
YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Border, border);
|
YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Border, border);
|
||||||
@ -2574,12 +2577,14 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
performLayout && !requiresStretchLayout,
|
performLayout && !requiresStretchLayout,
|
||||||
"flex",
|
"flex",
|
||||||
config);
|
config);
|
||||||
|
node->layout.hadOverflow = node->layout.hadOverflow || currentRelativeChild->layout.hadOverflow;
|
||||||
|
|
||||||
currentRelativeChild = currentRelativeChild->nextChild;
|
currentRelativeChild = currentRelativeChild->nextChild;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
remainingFreeSpace = originalRemainingFreeSpace + deltaFreeSpace;
|
remainingFreeSpace = originalRemainingFreeSpace + deltaFreeSpace;
|
||||||
|
node->layout.hadOverflow = node->layout.hadOverflow || (remainingFreeSpace < 0);
|
||||||
|
|
||||||
// STEP 6: MAIN-AXIS JUSTIFICATION & CROSS-AXIS SIZE DETERMINATION
|
// STEP 6: MAIN-AXIS JUSTIFICATION & CROSS-AXIS SIZE DETERMINATION
|
||||||
|
|
||||||
|
@ -215,6 +215,7 @@ YG_NODE_LAYOUT_PROPERTY(float, Bottom);
|
|||||||
YG_NODE_LAYOUT_PROPERTY(float, Width);
|
YG_NODE_LAYOUT_PROPERTY(float, Width);
|
||||||
YG_NODE_LAYOUT_PROPERTY(float, Height);
|
YG_NODE_LAYOUT_PROPERTY(float, Height);
|
||||||
YG_NODE_LAYOUT_PROPERTY(YGDirection, Direction);
|
YG_NODE_LAYOUT_PROPERTY(YGDirection, Direction);
|
||||||
|
YG_NODE_LAYOUT_PROPERTY(bool, HadOverflow);
|
||||||
|
|
||||||
// Get the computed values for these nodes after performing layout. If they were set using
|
// Get the computed values for these nodes after performing layout. If they were set using
|
||||||
// point values then the returned value will be the same as YGNodeStyleGetXXX. However if
|
// point values then the returned value will be the same as YGNodeStyleGetXXX. However if
|
||||||
|
Loading…
x
Reference in New Issue
Block a user