Reflow comments
Summary: @public Repeated application and alternation of Clang Format rules has lead to unfortunate block comment formatting. Here, we reflow comments Reviewed By: SidharthGuglani Differential Revision: D13677242 fbshipit-source-id: 3f1f5e38693eb15e9705f24fd363fc1618c78974
This commit is contained in:
committed by
Facebook Github Bot
parent
7fa0816d81
commit
71321f763a
@@ -149,8 +149,8 @@ private:
|
||||
static constexpr uint32_t BIAS = 0x20000000;
|
||||
static constexpr uint32_t PERCENT_BIT = 0x40000000;
|
||||
|
||||
// these are signaling NaNs with specific bit pattern as payload
|
||||
// they will be silenced whenever going through an FPU operation on ARM + x86
|
||||
// these are signaling NaNs with specific bit pattern as payload they will be
|
||||
// silenced whenever going through an FPU operation on ARM + x86
|
||||
static constexpr uint32_t AUTO_BITS = 0x7faaaaaa;
|
||||
static constexpr uint32_t ZERO_BITS_POINT = 0x7f8f0f0f;
|
||||
static constexpr uint32_t ZERO_BITS_PERCENT = 0x7f80f0f0;
|
||||
|
10
yoga/Utils.h
10
yoga/Utils.h
@@ -9,8 +9,8 @@
|
||||
#include "Yoga-internal.h"
|
||||
#include "CompactValue.h"
|
||||
|
||||
// This struct is an helper model to hold the data for step 4 of flexbox
|
||||
// algo, which is collecting the flex items in a line.
|
||||
// This struct is an helper model to hold the data for step 4 of flexbox algo,
|
||||
// which is collecting the flex items in a line.
|
||||
//
|
||||
// - itemsOnLine: Number of items which can fit in a line considering the
|
||||
// available Inner dimension, the flex items computed flexbasis and their
|
||||
@@ -18,9 +18,9 @@
|
||||
// indicates because we skip over absolute-positioned items.
|
||||
//
|
||||
// - sizeConsumedOnCurrentLine: It is accumulation of the dimensions and margin
|
||||
// of all the children on the current line. This will be used in order to either
|
||||
// set the dimensions of the node if none already exist or to compute the
|
||||
// remaining space left for the flexible children.
|
||||
// of all the children on the current line. This will be used in order to
|
||||
// either set the dimensions of the node if none already exist or to compute
|
||||
// the remaining space left for the flexible children.
|
||||
//
|
||||
// - totalFlexGrowFactors: total flex grow factors of flex items which are to be
|
||||
// layed in the current line
|
||||
|
@@ -25,8 +25,8 @@ struct YGLayout {
|
||||
uint32_t computedFlexBasisGeneration = 0;
|
||||
YGFloatOptional computedFlexBasis = {};
|
||||
|
||||
// Instead of recomputing the entire layout every single time, we
|
||||
// cache some information to break early when nothing changed
|
||||
// Instead of recomputing the entire layout every single time, we cache some
|
||||
// information to break early when nothing changed
|
||||
uint32_t generationCount = 0;
|
||||
YGDirection lastOwnerDirection = (YGDirection) -1;
|
||||
|
||||
|
@@ -23,8 +23,8 @@ typedef struct {
|
||||
// accepts marker type, a node ref, and marker data (depends on marker type)
|
||||
// can return a handle or id that Yoga will pass to endMarker
|
||||
void* (*startMarker)(YGMarkerType, YGNodeRef, YGMarkerData);
|
||||
// accepts marker type, a node ref, marker data, and marker id as returned
|
||||
// by startMarker
|
||||
// accepts marker type, a node ref, marker data, and marker id as returned by
|
||||
// startMarker
|
||||
void (*endMarker)(YGMarkerType, YGNodeRef, YGMarkerData, void* id);
|
||||
} YGMarkerCallbacks;
|
||||
|
||||
|
@@ -206,8 +206,8 @@ void YGNode::setLayoutDimension(float dimension, int index) {
|
||||
layout_.dimensions[index] = dimension;
|
||||
}
|
||||
|
||||
// If both left and right are defined, then use left. Otherwise return
|
||||
// +left or -right depending on which is defined.
|
||||
// If both left and right are defined, then use left. Otherwise return +left or
|
||||
// -right depending on which is defined.
|
||||
YGFloatOptional YGNode::relativePosition(
|
||||
const YGFlexDirection axis,
|
||||
const float axisSize) const {
|
||||
|
@@ -102,10 +102,9 @@ public:
|
||||
}
|
||||
|
||||
// returns the YGNodeRef that owns this YGNode. An owner is used to identify
|
||||
// the YogaTree that a YGNode belongs to.
|
||||
// This method will return the parent of the YGNode when a YGNode only belongs
|
||||
// to one YogaTree or nullptr when the YGNode is shared between two or more
|
||||
// YogaTrees.
|
||||
// the YogaTree that a YGNode belongs to. This method will return the parent
|
||||
// of the YGNode when a YGNode only belongs to one YogaTree or nullptr when
|
||||
// the YGNode is shared between two or more YogaTrees.
|
||||
YGNodeRef getOwner() const {
|
||||
return owner_;
|
||||
}
|
||||
|
223
yoga/Yoga.cpp
223
yoga/Yoga.cpp
@@ -1322,8 +1322,8 @@ static void YGNodeComputeFlexBasisForChild(
|
||||
child->getResolvedDimension(YGDimensionHeight), ownerHeight),
|
||||
paddingAndBorder));
|
||||
} else {
|
||||
// Compute the flex basis and hypothetical main size (i.e. the clamped
|
||||
// flex basis).
|
||||
// Compute the flex basis and hypothetical main size (i.e. the clamped flex
|
||||
// basis).
|
||||
childWidth = YGUndefined;
|
||||
childHeight = YGUndefined;
|
||||
childWidthMeasureMode = YGMeasureModeUndefined;
|
||||
@@ -1351,8 +1351,8 @@ static void YGNodeComputeFlexBasisForChild(
|
||||
childHeightMeasureMode = YGMeasureModeExactly;
|
||||
}
|
||||
|
||||
// The W3C spec doesn't say anything about the 'overflow' property,
|
||||
// but all major browsers appear to implement the following logic.
|
||||
// The W3C spec doesn't say anything about the 'overflow' property, but all
|
||||
// major browsers appear to implement the following logic.
|
||||
if ((!isMainAxisRow && node->getStyle().overflow == YGOverflowScroll) ||
|
||||
node->getStyle().overflow != YGOverflowScroll) {
|
||||
if (YGFloatIsUndefined(childWidth) && !YGFloatIsUndefined(width)) {
|
||||
@@ -1383,9 +1383,8 @@ static void YGNodeComputeFlexBasisForChild(
|
||||
}
|
||||
}
|
||||
|
||||
// If child has no defined size in the cross axis and is set to stretch,
|
||||
// set the cross
|
||||
// axis to be measured exactly with the available inner width
|
||||
// If child has no defined size in the cross axis and is set to stretch, set
|
||||
// the cross axis to be measured exactly with the available inner width
|
||||
|
||||
const bool hasExactWidth =
|
||||
!YGFloatIsUndefined(width) && widthMode == YGMeasureModeExactly;
|
||||
@@ -1484,9 +1483,8 @@ static void YGNodeAbsoluteLayoutChild(
|
||||
.unwrap() +
|
||||
marginRow;
|
||||
} else {
|
||||
// If the child doesn't have a specified width, compute the width based
|
||||
// on the left/right
|
||||
// offsets if they're defined.
|
||||
// If the child doesn't have a specified width, compute the width based on
|
||||
// the left/right offsets if they're defined.
|
||||
if (child->isLeadingPositionDefined(YGFlexDirectionRow) &&
|
||||
child->isTrailingPosDefined(YGFlexDirectionRow)) {
|
||||
childWidth = node->getLayout().measuredDimensions[YGDimensionWidth] -
|
||||
@@ -1506,9 +1504,8 @@ static void YGNodeAbsoluteLayoutChild(
|
||||
.unwrap() +
|
||||
marginColumn;
|
||||
} else {
|
||||
// If the child doesn't have a specified height, compute the height
|
||||
// based on the top/bottom
|
||||
// offsets if they're defined.
|
||||
// If the child doesn't have a specified height, compute the height based on
|
||||
// the top/bottom offsets if they're defined.
|
||||
if (child->isLeadingPositionDefined(YGFlexDirectionColumn) &&
|
||||
child->isTrailingPosDefined(YGFlexDirectionColumn)) {
|
||||
childHeight = node->getLayout().measuredDimensions[YGDimensionHeight] -
|
||||
@@ -1961,8 +1958,8 @@ static float YGNodeComputeFlexBasisForChildren(
|
||||
|
||||
// This function assumes that all the children of node have their
|
||||
// computedFlexBasis properly computed(To do this use
|
||||
// YGNodeComputeFlexBasisForChildren function).
|
||||
// This function calculates YGCollectFlexItemsRowMeasurement
|
||||
// YGNodeComputeFlexBasisForChildren function). This function calculates
|
||||
// YGCollectFlexItemsRowMeasurement
|
||||
static YGCollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues(
|
||||
const YGNodeRef& node,
|
||||
const YGDirection ownerDirection,
|
||||
@@ -1998,10 +1995,9 @@ static YGCollectFlexItemsRowValues YGCalculateCollectFlexItemsRowValues(
|
||||
mainAxisownerSize)
|
||||
.unwrap();
|
||||
|
||||
// If this is a multi-line flow and this item pushes us over the
|
||||
// available size, we've
|
||||
// hit the end of the current line. Break out of the loop and lay out
|
||||
// the current line.
|
||||
// If this is a multi-line flow and this item pushes us over the available
|
||||
// size, we've hit the end of the current line. Break out of the loop and
|
||||
// lay out the current line.
|
||||
if (sizeConsumedOnCurrentLineIncludingMinConstraint +
|
||||
flexBasisWithMinAndMaxConstraints + childMarginMainAxis >
|
||||
availableInnerMainDim &&
|
||||
@@ -2276,12 +2272,10 @@ static void YGDistributeFreeSpaceFirstPass(
|
||||
if (!YGFloatIsUndefined(baseMainSize) &&
|
||||
!YGFloatIsUndefined(boundMainSize) &&
|
||||
baseMainSize != boundMainSize) {
|
||||
// By excluding this item's size and flex factor from remaining,
|
||||
// this item's
|
||||
// min/max constraints should also trigger in the second pass
|
||||
// resulting in the
|
||||
// item's size calculation being identical in the first and second
|
||||
// passes.
|
||||
// By excluding this item's size and flex factor from remaining, this
|
||||
// item's min/max constraints should also trigger in the second pass
|
||||
// resulting in the item's size calculation being identical in the
|
||||
// first and second passes.
|
||||
deltaFreeSpace += boundMainSize - childFlexBasis;
|
||||
collectedFlexItemsValues.totalFlexShrinkScaledFactors -=
|
||||
flexShrinkScaledFactor;
|
||||
@@ -2307,12 +2301,10 @@ static void YGDistributeFreeSpaceFirstPass(
|
||||
if (!YGFloatIsUndefined(baseMainSize) &&
|
||||
!YGFloatIsUndefined(boundMainSize) &&
|
||||
baseMainSize != boundMainSize) {
|
||||
// By excluding this item's size and flex factor from remaining,
|
||||
// this item's
|
||||
// min/max constraints should also trigger in the second pass
|
||||
// resulting in the
|
||||
// item's size calculation being identical in the first and second
|
||||
// passes.
|
||||
// By excluding this item's size and flex factor from remaining, this
|
||||
// item's min/max constraints should also trigger in the second pass
|
||||
// resulting in the item's size calculation being identical in the
|
||||
// first and second passes.
|
||||
deltaFreeSpace += boundMainSize - childFlexBasis;
|
||||
collectedFlexItemsValues.totalFlexGrowFactors -= flexGrowFactor;
|
||||
}
|
||||
@@ -2324,25 +2316,22 @@ static void YGDistributeFreeSpaceFirstPass(
|
||||
|
||||
// Do two passes over the flex items to figure out how to distribute the
|
||||
// remaining space.
|
||||
// The first pass finds the items whose min/max constraints trigger,
|
||||
// freezes them at those
|
||||
// sizes, and excludes those sizes from the remaining space. The second
|
||||
// pass sets the size
|
||||
// of each flexible item. It distributes the remaining space amongst the
|
||||
// items whose min/max
|
||||
// constraints didn't trigger in pass 1. For the other items, it sets
|
||||
// their sizes by forcing
|
||||
// their min/max constraints to trigger again.
|
||||
//
|
||||
// This two pass approach for resolving min/max constraints deviates from
|
||||
// the spec. The
|
||||
// spec (https://www.w3.org/TR/CSS-flexbox-1/#resolve-flexible-lengths)
|
||||
// describes a process
|
||||
// that needs to be repeated a variable number of times. The algorithm
|
||||
// implemented here
|
||||
// won't handle all cases but it was simpler to implement and it mitigates
|
||||
// performance
|
||||
// concerns because we know exactly how many passes it'll do.
|
||||
// The first pass finds the items whose min/max constraints trigger, freezes
|
||||
// them at those sizes, and excludes those sizes from the remaining space.
|
||||
//
|
||||
// The second pass sets the size of each flexible item. It distributes the
|
||||
// remaining space amongst the items whose min/max constraints didn't trigger in
|
||||
// the first pass. For the other items, it sets their sizes by forcing their
|
||||
// min/max constraints to trigger again.
|
||||
//
|
||||
// This two pass approach for resolving min/max constraints deviates from the
|
||||
// spec. The spec
|
||||
// (https://www.w3.org/TR/CSS-flexbox-1/#resolve-flexible-lengths) describes a
|
||||
// process that needs to be repeated a variable number of times. The algorithm
|
||||
// implemented here won't handle all cases but it was simpler to implement and
|
||||
// it mitigates performance concerns because we know exactly how many passes
|
||||
// it'll do.
|
||||
//
|
||||
// At the end of this function the child nodes would have the proper size
|
||||
// assigned to them.
|
||||
@@ -2451,9 +2440,9 @@ static void YGJustifyMainAxis(
|
||||
}
|
||||
}
|
||||
|
||||
// In order to position the elements in the main axis, we have two
|
||||
// controls. The space between the beginning and the first element
|
||||
// and the space between each two elements.
|
||||
// In order to position the elements in the main axis, we have two controls.
|
||||
// The space between the beginning and the first element and the space between
|
||||
// each two elements.
|
||||
float leadingMainDim = 0;
|
||||
float betweenMainDim = 0;
|
||||
const YGJustify justifyContent = node->getStyle().justifyContent;
|
||||
@@ -2512,8 +2501,8 @@ static void YGJustifyMainAxis(
|
||||
child->isLeadingPositionDefined(mainAxis)) {
|
||||
if (performLayout) {
|
||||
// In case the child is position absolute and has left/top being
|
||||
// defined, we override the position to whatever the user said
|
||||
// (and margin/border).
|
||||
// defined, we override the position to whatever the user said (and
|
||||
// margin/border).
|
||||
child->setLayoutPosition(
|
||||
child->getLeadingPosition(mainAxis, availableInnerMainDim)
|
||||
.unwrap() +
|
||||
@@ -2523,8 +2512,8 @@ static void YGJustifyMainAxis(
|
||||
}
|
||||
} else {
|
||||
// Now that we placed the element, we need to update the variables.
|
||||
// We need to do that only for relative elements. Absolute elements
|
||||
// do not take part in that phase.
|
||||
// We need to do that only for relative elements. Absolute elements do not
|
||||
// take part in that phase.
|
||||
if (childStyle.positionType == YGPositionTypeRelative) {
|
||||
if (child->marginLeadingValue(mainAxis).unit == YGUnitAuto) {
|
||||
collectedFlexItemsValues.mainDim +=
|
||||
@@ -2547,9 +2536,8 @@ static void YGJustifyMainAxis(
|
||||
bool canSkipFlex =
|
||||
!performLayout && measureModeCrossDim == YGMeasureModeExactly;
|
||||
if (canSkipFlex) {
|
||||
// If we skipped the flex step, then we can't rely on the
|
||||
// measuredDims because
|
||||
// they weren't computed. This means we can't call
|
||||
// If we skipped the flex step, then we can't rely on the measuredDims
|
||||
// because they weren't computed. This means we can't call
|
||||
// YGNodeDimWithMargin.
|
||||
collectedFlexItemsValues.mainDim += betweenMainDim +
|
||||
child->getMarginForAxis(mainAxis, availableInnerWidth).unwrap() +
|
||||
@@ -2608,81 +2596,61 @@ static void YGJustifyMainAxis(
|
||||
|
||||
//
|
||||
// This is the main routine that implements a subset of the flexbox layout
|
||||
// algorithm
|
||||
// described in the W3C YG documentation: https://www.w3.org/TR/CSS3-flexbox/.
|
||||
// algorithm described in the W3C CSS documentation:
|
||||
// https://www.w3.org/TR/CSS3-flexbox/.
|
||||
//
|
||||
// Limitations of this algorithm, compared to the full standard:
|
||||
// * Display property is always assumed to be 'flex' except for Text nodes,
|
||||
// which
|
||||
// are assumed to be 'inline-flex'.
|
||||
// which are assumed to be 'inline-flex'.
|
||||
// * The 'zIndex' property (or any form of z ordering) is not supported. Nodes
|
||||
// are
|
||||
// stacked in document order.
|
||||
// are stacked in document order.
|
||||
// * The 'order' property is not supported. The order of flex items is always
|
||||
// defined
|
||||
// by document order.
|
||||
// defined by document order.
|
||||
// * The 'visibility' property is always assumed to be 'visible'. Values of
|
||||
// 'collapse'
|
||||
// and 'hidden' are not supported.
|
||||
// 'collapse' and 'hidden' are not supported.
|
||||
// * There is no support for forced breaks.
|
||||
// * It does not support vertical inline directions (top-to-bottom or
|
||||
// bottom-to-top text).
|
||||
//
|
||||
// Deviations from standard:
|
||||
// * Section 4.5 of the spec indicates that all flex items have a default
|
||||
// minimum
|
||||
// main size. For text blocks, for example, this is the width of the widest
|
||||
// word.
|
||||
// Calculating the minimum width is expensive, so we forego it and assume a
|
||||
// default
|
||||
// minimum main size of 0.
|
||||
// minimum main size. For text blocks, for example, this is the width of the
|
||||
// widest word. Calculating the minimum width is expensive, so we forego it
|
||||
// and assume a default minimum main size of 0.
|
||||
// * Min/Max sizes in the main axis are not honored when resolving flexible
|
||||
// lengths.
|
||||
// * The spec indicates that the default value for 'flexDirection' is 'row',
|
||||
// but
|
||||
// the algorithm below assumes a default of 'column'.
|
||||
// but the algorithm below assumes a default of 'column'.
|
||||
//
|
||||
// Input parameters:
|
||||
// - node: current node to be sized and layed out
|
||||
// - availableWidth & availableHeight: available size to be used for sizing
|
||||
// the node
|
||||
// or YGUndefined if the size is not available; interpretation depends on
|
||||
// layout
|
||||
// flags
|
||||
// the node or YGUndefined if the size is not available; interpretation
|
||||
// depends on layout flags
|
||||
// - ownerDirection: the inline (text) direction within the owner
|
||||
// (left-to-right or
|
||||
// right-to-left)
|
||||
// (left-to-right or right-to-left)
|
||||
// - widthMeasureMode: indicates the sizing rules for the width (see below
|
||||
// for explanation)
|
||||
// - heightMeasureMode: indicates the sizing rules for the height (see below
|
||||
// for explanation)
|
||||
// - performLayout: specifies whether the caller is interested in just the
|
||||
// dimensions
|
||||
// of the node or it requires the entire node and its subtree to be layed
|
||||
// out
|
||||
// (with final positions)
|
||||
// dimensions of the node or it requires the entire node and its subtree to
|
||||
// be layed out (with final positions)
|
||||
//
|
||||
// Details:
|
||||
// This routine is called recursively to lay out subtrees of flexbox
|
||||
// elements. It uses the
|
||||
// information in node.style, which is treated as a read-only input. It is
|
||||
// responsible for
|
||||
// setting the layout.direction and layout.measuredDimensions fields for the
|
||||
// input node as well
|
||||
// as the layout.position and layout.lineIndex fields for its child nodes.
|
||||
// The
|
||||
// elements. It uses the information in node.style, which is treated as a
|
||||
// read-only input. It is responsible for setting the layout.direction and
|
||||
// layout.measuredDimensions fields for the input node as well as the
|
||||
// layout.position and layout.lineIndex fields for its child nodes. The
|
||||
// layout.measuredDimensions field includes any border or padding for the
|
||||
// node but does
|
||||
// not include margins.
|
||||
// node but does not include margins.
|
||||
//
|
||||
// The spec describes four different layout modes: "fill available", "max
|
||||
// content", "min
|
||||
// content",
|
||||
// and "fit content". Of these, we don't use "min content" because we don't
|
||||
// support default
|
||||
// minimum main sizes (see above for details). Each of our measure modes maps
|
||||
// to a layout mode
|
||||
// from the spec (https://www.w3.org/TR/CSS3-sizing/#terms):
|
||||
// content", "min content", and "fit content". Of these, we don't use "min
|
||||
// content" because we don't support default minimum main sizes (see above
|
||||
// for details). Each of our measure modes maps to a layout mode from the
|
||||
// spec (https://www.w3.org/TR/CSS3-sizing/#terms):
|
||||
// - YGMeasureModeUndefined: max content
|
||||
// - YGMeasureModeExactly: fill available
|
||||
// - YGMeasureModeAtMost: fit content
|
||||
@@ -2924,9 +2892,9 @@ static void YGNodelayoutImpl(
|
||||
!performLayout && measureModeCrossDim == YGMeasureModeExactly;
|
||||
|
||||
// STEP 5: RESOLVING FLEXIBLE LENGTHS ON MAIN AXIS
|
||||
// Calculate the remaining available space that needs to be allocated.
|
||||
// If the main dimension size isn't known, it is computed based on
|
||||
// the line length, so there's no more space left to distribute.
|
||||
// Calculate the remaining available space that needs to be allocated. If
|
||||
// the main dimension size isn't known, it is computed based on the line
|
||||
// length, so there's no more space left to distribute.
|
||||
|
||||
bool sizeBasedOnContent = false;
|
||||
// If we don't measure with exact main dimension we want to ensure we don't
|
||||
@@ -2998,11 +2966,9 @@ static void YGNodelayoutImpl(
|
||||
// STEP 6: MAIN-AXIS JUSTIFICATION & CROSS-AXIS SIZE DETERMINATION
|
||||
|
||||
// At this point, all the children have their dimensions set in the main
|
||||
// axis.
|
||||
// Their dimensions are also set in the cross axis with the exception of
|
||||
// items
|
||||
// that are aligned "stretch". We need to compute these stretch values and
|
||||
// set the final positions.
|
||||
// axis. Their dimensions are also set in the cross axis with the exception
|
||||
// of items that are aligned "stretch". We need to compute these stretch
|
||||
// values and set the final positions.
|
||||
|
||||
YGJustifyMainAxis(
|
||||
node,
|
||||
@@ -3058,8 +3024,8 @@ static void YGNodelayoutImpl(
|
||||
}
|
||||
if (child->getStyle().positionType == YGPositionTypeAbsolute) {
|
||||
// If the child is absolutely positioned and has a
|
||||
// top/left/bottom/right set, override
|
||||
// all the previously computed positions to set it correctly.
|
||||
// top/left/bottom/right set, override all the previously computed
|
||||
// positions to set it correctly.
|
||||
const bool isChildLeadingPosDefined =
|
||||
child->isLeadingPositionDefined(crossAxis);
|
||||
if (isChildLeadingPosDefined) {
|
||||
@@ -3090,9 +3056,8 @@ static void YGNodelayoutImpl(
|
||||
const YGAlign alignItem = YGNodeAlignItem(node, child);
|
||||
|
||||
// If the child uses align stretch, we need to lay it out one more
|
||||
// time, this time
|
||||
// forcing the cross-axis size to be the computed cross size for the
|
||||
// current line.
|
||||
// time, this time forcing the cross-axis size to be the computed
|
||||
// cross size for the current line.
|
||||
if (alignItem == YGAlignStretch &&
|
||||
child->marginLeadingValue(crossAxis).unit != YGUnitAuto &&
|
||||
child->marginTrailingValue(crossAxis).unit != YGUnitAuto) {
|
||||
@@ -3713,8 +3678,8 @@ bool YGNodeCanUseCachedMeasurement(
|
||||
}
|
||||
|
||||
//
|
||||
// This is a wrapper around the YGNodelayoutImpl function. It determines
|
||||
// whether the layout request is redundant and can be skipped.
|
||||
// This is a wrapper around the YGNodelayoutImpl function. It determines whether
|
||||
// the layout request is redundant and can be skipped.
|
||||
//
|
||||
// Parameters:
|
||||
// Input parameters are the same as YGNodelayoutImpl (see above)
|
||||
@@ -3753,16 +3718,12 @@ bool YGLayoutNodeInternal(
|
||||
|
||||
// Determine whether the results are already cached. We maintain a separate
|
||||
// cache for layouts and measurements. A layout operation modifies the
|
||||
// positions
|
||||
// and dimensions for nodes in the subtree. The algorithm assumes that each
|
||||
// node
|
||||
// gets layed out a maximum of one time per tree layout, but multiple
|
||||
// measurements
|
||||
// may be required to resolve all of the flex dimensions.
|
||||
// We handle nodes with measure functions specially here because they are the
|
||||
// most
|
||||
// expensive to measure, so it's worth avoiding redundant measurements if at
|
||||
// all possible.
|
||||
// positions and dimensions for nodes in the subtree. The algorithm assumes
|
||||
// that each node gets layed out a maximum of one time per tree layout, but
|
||||
// multiple measurements may be required to resolve all of the flex
|
||||
// dimensions. We handle nodes with measure functions specially here because
|
||||
// they are the most expensive to measure, so it's worth avoiding redundant
|
||||
// measurements if at all possible.
|
||||
if (node->getMeasure() != nullptr) {
|
||||
const float marginAxisRow =
|
||||
node->getMarginForAxis(YGFlexDirectionRow, ownerWidth).unwrap();
|
||||
@@ -4058,10 +4019,8 @@ void YGNodeCalculateLayout(
|
||||
const float ownerHeight,
|
||||
const YGDirection ownerDirection) {
|
||||
// Increment the generation count. This will force the recursive routine to
|
||||
// visit
|
||||
// all dirty nodes at least once. Subsequent visits will be skipped if the
|
||||
// input
|
||||
// parameters don't change.
|
||||
// visit all dirty nodes at least once. Subsequent visits will be skipped if
|
||||
// the input parameters don't change.
|
||||
gCurrentGenerationCount++;
|
||||
node->resolveDimension();
|
||||
float width = YGUndefined;
|
||||
|
34
yoga/Yoga.h
34
yoga/Yoga.h
@@ -104,16 +104,16 @@ WIN_EXPORT void YGNodeCalculateLayout(
|
||||
|
||||
// Mark a node as dirty. Only valid for nodes with a custom measure function
|
||||
// set.
|
||||
// YG knows when to mark all other nodes as dirty but because nodes with
|
||||
// measure functions
|
||||
// depends on information not known to YG they must perform this dirty
|
||||
// marking manually.
|
||||
//
|
||||
// Yoga knows when to mark all other nodes as dirty but because nodes with
|
||||
// measure functions depend on information not known to Yoga they must perform
|
||||
// this dirty marking manually.
|
||||
WIN_EXPORT void YGNodeMarkDirty(const YGNodeRef node);
|
||||
|
||||
// This function marks the current node and all its descendants as dirty. This
|
||||
// function is added to test yoga benchmarks. This function is not expected to
|
||||
// be used in production as calling `YGCalculateLayout` will cause the
|
||||
// recalculation of each and every node.
|
||||
// Marks the current node and all its descendants as dirty.
|
||||
//
|
||||
// Intended to be used for Uoga benchmarks. Don't use in production, as calling
|
||||
// `YGCalculateLayout` will cause the recalculation of each and every node.
|
||||
WIN_EXPORT void YGNodeMarkDirtyAndPropogateToDescendants(const YGNodeRef node);
|
||||
|
||||
WIN_EXPORT void YGNodePrint(const YGNodeRef node, const YGPrintOptions options);
|
||||
@@ -317,11 +317,11 @@ WIN_EXPORT void YGNodeStyleSetMaxHeightPercent(
|
||||
const float maxHeight);
|
||||
WIN_EXPORT YGValue YGNodeStyleGetMaxHeight(const YGNodeRef node);
|
||||
|
||||
// Yoga specific properties, not compatible with flexbox specification
|
||||
// Aspect ratio control the size of the undefined dimension of a node.
|
||||
// Aspect ratio is encoded as a floating point value width/height. e.g. A value
|
||||
// of 2 leads to a node with a width twice the size of its height while a value
|
||||
// of 0.5 gives the opposite effect.
|
||||
// Yoga specific properties, not compatible with flexbox specification Aspect
|
||||
// ratio control the size of the undefined dimension of a node. Aspect ratio is
|
||||
// encoded as a floating point value width/height. e.g. A value of 2 leads to a
|
||||
// node with a width twice the size of its height while a value of 0.5 gives the
|
||||
// opposite effect.
|
||||
//
|
||||
// - On a node with a set width/height aspect ratio control the size of the
|
||||
// unset dimension
|
||||
@@ -377,8 +377,8 @@ WIN_EXPORT void YGAssertWithConfig(
|
||||
const YGConfigRef config,
|
||||
const bool condition,
|
||||
const char* message);
|
||||
// Set this to number of pixels in 1 point to round calculation results
|
||||
// If you want to avoid rounding - set PointScaleFactor to 0
|
||||
// Set this to number of pixels in 1 point to round calculation results If you
|
||||
// want to avoid rounding - set PointScaleFactor to 0
|
||||
WIN_EXPORT void YGConfigSetPointScaleFactor(
|
||||
const YGConfigRef config,
|
||||
const float pixelsInPoint);
|
||||
@@ -409,8 +409,8 @@ WIN_EXPORT bool YGConfigIsExperimentalFeatureEnabled(
|
||||
const YGConfigRef config,
|
||||
const YGExperimentalFeature feature);
|
||||
|
||||
// Using the web defaults is the prefered configuration for new projects.
|
||||
// Usage of non web defaults should be considered as legacy.
|
||||
// Using the web defaults is the prefered configuration for new projects. Usage
|
||||
// of non web defaults should be considered as legacy.
|
||||
WIN_EXPORT void YGConfigSetUseWebDefaults(
|
||||
const YGConfigRef config,
|
||||
const bool enabled);
|
||||
|
Reference in New Issue
Block a user