Skip measurement when there's no available vertical space
We already did this optimization when there wasn't any available horizontal space. Now we're covering the vertical space case as well. This optimization assumes that, for a node with a measure function, if there isn't any available horizontal or vertical space, then we don't need to measure the node and can assume that the node is 0x0.
This commit is contained in:
@@ -518,9 +518,9 @@ public class LayoutEngine {
|
||||
// Don't bother sizing the text if both dimensions are already defined.
|
||||
node.layout.measuredDimensions[DIMENSION_WIDTH] = boundAxis(node, CSS_FLEX_DIRECTION_ROW, availableWidth - marginAxisRow);
|
||||
node.layout.measuredDimensions[DIMENSION_HEIGHT] = boundAxis(node, CSS_FLEX_DIRECTION_COLUMN, availableHeight - marginAxisColumn);
|
||||
} else if (innerWidth <= 0) {
|
||||
} else if (innerWidth <= 0 || innerHeight <= 0) {
|
||||
|
||||
// Don't bother sizing the text if there's no horizontal space.
|
||||
// Don't bother sizing the text if there's no horizontal or vertical space.
|
||||
node.layout.measuredDimensions[DIMENSION_WIDTH] = boundAxis(node, CSS_FLEX_DIRECTION_ROW, 0);
|
||||
node.layout.measuredDimensions[DIMENSION_HEIGHT] = boundAxis(node, CSS_FLEX_DIRECTION_COLUMN, 0);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user