39 Node(Node&& node)
noexcept;
43 Node(
const Node& node) =
default;
55 return alwaysFormsContainingBlock_;
67 return measureFunc_ !=
nullptr;
77 return baselineFunc_ !=
nullptr;
80 float baseline(
float width,
float height)
const;
82 float dimensionWithMargin(
FlexDirection axis,
float widthSize);
91 auto usedValue = getProcessedDimension(
dimension).resolve(ownerSize);
92 return usedValue.isDefined() && usedValue.unwrap() >= 0.0f;
96 return config_->hasErrata(errata);
100 return contentsChildrenCount_ != 0;
130 return isReferenceBaseline_;
146 return children_.at(index);
150 return children_.size();
158 if (contentsChildrenCount_ == 0) {
159 return children_.size();
162 for (
auto iter = getLayoutChildren().begin();
163 iter != getLayoutChildren().end();
180 return processedDimensions_[
static_cast<size_t>(
dimension)];
186 float referenceLength,
187 float ownerWidth)
const {
189 getProcessedDimension(
dimension).resolve(referenceLength);
190 if (style_.boxSizing() == BoxSizing::BorderBox) {
199 (dimensionPaddingAndBorder.
isDefined() ? dimensionPaddingAndBorder
210 alwaysFormsContainingBlock_ = alwaysFormsContainingBlock;
214 hasNewLayout_ = hasNewLayout;
218 nodeType_ = nodeType;
224 baselineFunc_ = baseLineFunc;
228 dirtiedFunc_ = dirtiedFunc;
240 lineIndex_ = lineIndex;
244 isReferenceBaseline_ = isReferenceBaseline;
255 void setDirty(
bool isDirty);
256 void setChildren(
const std::vector<Node*>& children);
257 void setLayoutLastOwnerDirection(
Direction direction);
258 void setLayoutComputedFlexBasis(
FloatOptional computedFlexBasis);
259 void setLayoutComputedFlexBasisGeneration(
260 uint32_t computedFlexBasisGeneration);
261 void setLayoutMeasuredDimension(
float measuredDimension,
Dimension dimension);
262 void setLayoutHadOverflow(
bool hadOverflow);
263 void setLayoutDimension(
float lengthValue,
Dimension dimension);
264 void setLayoutDirection(
Direction direction);
267 void setLayoutPadding(
float padding,
PhysicalEdge edge);
268 void setLayoutPosition(
float position,
PhysicalEdge edge);
269 void setPosition(
Direction direction,
float ownerWidth,
float ownerHeight);
276 float referenceLength,
277 float ownerWidth)
const;
278 void processDimensions();
280 void clearChildren();
282 void replaceChild(Node* oldChild, Node* newChild);
283 void replaceChild(Node* child,
size_t index);
284 void insertChild(Node* child,
size_t index);
286 bool removeChild(Node* child);
287 void removeChild(
size_t index);
289 void cloneChildrenIfNeeded();
290 void cloneContentsChildrenIfNeeded();
291 void markDirtyAndPropagate();
292 float resolveFlexGrow()
const;
293 float resolveFlexShrink()
const;
294 bool isNodeFlexible();
297 float relativePosition(
300 float axisSize)
const;
306 void useWebDefaults() {
307 style_.setFlexDirection(FlexDirection::Row);
308 style_.setAlignContent(Align::Stretch);
316 void* context_ =
nullptr;
322 size_t lineIndex_ = 0;
323 size_t contentsChildrenCount_ = 0;
324 Node* owner_ =
nullptr;
327 std::array<Style::SizeLength, 2> processedDimensions_{
328 {StyleSizeLength::undefined(), StyleSizeLength::undefined()}};
332 return static_cast<Node*
>(ref);
336 return static_cast<const Node*
>(ref);
typedefYG_EXTERN_C_BEGIN struct YGNode * YGNodeRef
Definition YGConfig.h:19
#define YG_EXPORT
Definition YGMacros.h:35
float(* YGBaselineFunc)(YGNodeConstRef node, float width, float height)
Definition YGNode.h:226
float YGMeasureMode float availableHeight
Definition YGNode.h:293
void(* YGDirtiedFunc)(YGNodeConstRef node)
Definition YGNode.h:105
float availableWidth
Definition YGNode.h:291
float YGMeasureMode float YGMeasureMode float YGMeasureMode float float float float float YGConfigRef config
Definition YGNode.h:302
YGSize(* YGMeasureFunc)(YGNodeConstRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode)
Definition YGNode.h:204
float YGMeasureMode heightMode
Definition YGNode.h:292
Definition LayoutableChildren.h:21
Node & operator=(const Node &)=delete
bool alwaysFormsContainingBlock() const
Definition Node.h:54
bool isDirty_
Definition Node.h:313
LayoutResults & getLayout()
Definition Node.h:117
size_t getLayoutChildCount() const
Definition Node.h:157
const Config * config_
Definition Node.h:326
void setHasNewLayout(bool hasNewLayout)
Definition Node.h:213
bool isDirty() const
Definition Node.h:175
void setNodeType(NodeType nodeType)
Definition Node.h:217
void setBaselineFunc(YGBaselineFunc baseLineFunc)
Definition Node.h:223
Style style_
Definition Node.h:320
Style & style()
Definition Node.h:108
void setDirtiedFunc(YGDirtiedFunc dirtiedFunc)
Definition Node.h:227
NodeType nodeType_
Definition Node.h:315
void setAlwaysFormsContainingBlock(bool alwaysFormsContainingBlock)
Definition Node.h:209
Style::SizeLength getProcessedDimension(Dimension dimension) const
Definition Node.h:179
std::vector< Node * > children_
Definition Node.h:325
void setLayout(const LayoutResults &layout)
Definition Node.h:235
YGDirtiedFunc getDirtiedFunc() const
Definition Node.h:103
FloatOptional getResolvedDimension(Direction direction, Dimension dimension, float referenceLength, float ownerWidth) const
Definition Node.h:183
bool isReferenceBaseline_
Definition Node.h:312
bool hasDefiniteLength(Dimension dimension, float ownerSize)
Definition Node.h:90
bool getHasNewLayout() const
Definition Node.h:58
size_t getChildCount() const
Definition Node.h:149
Node * getChild(size_t index) const
Definition Node.h:145
bool hasBaselineFunc() const noexcept
Definition Node.h:76
bool hasNewLayout_
Definition Node.h:311
LayoutResults layout_
Definition Node.h:321
bool hasMeasureFunc() const noexcept
Definition Node.h:66
Node * getOwner() const
Definition Node.h:137
NodeType getNodeType() const
Definition Node.h:62
const Config * getConfig() const
Definition Node.h:171
Node(const Config *config)
LayoutableChildren getLayoutChildren() const
Definition Node.h:153
bool hasErrata(Errata errata) const
Definition Node.h:95
void setIsReferenceBaseline(bool isReferenceBaseline)
Definition Node.h:243
const LayoutResults & getLayout() const
Definition Node.h:121
void setStyle(const Style &style)
Definition Node.h:231
size_t getLineIndex() const
Definition Node.h:125
Node & operator=(Node &&) noexcept=default
void * getContext() const
Definition Node.h:50
bool alwaysFormsContainingBlock_
Definition Node.h:314
bool isReferenceBaseline() const
Definition Node.h:129
const std::vector< Node * > & getChildren() const
Definition Node.h:141
bool hasContentsChildren() const
Definition Node.h:99
void setContext(void *context)
Definition Node.h:205
Node(const Node &node)=default
const Style & style() const
Definition Node.h:112
void setOwner(Node *owner)
Definition Node.h:247
void setLineIndex(size_t lineIndex)
Definition Node.h:239
Definition StyleSizeLength.h:29
Definition Benchmark.cpp:19
Direction
Definition Direction.h:18
NodeType
Definition NodeType.h:18
FlexDirection resolveDirection(const FlexDirection flexDirection, const Direction direction)
Definition FlexDirection.h:31
Dimension dimension(FlexDirection flexDirection)
Definition FlexDirection.h:105
FlexDirection
Definition FlexDirection.h:18
MeasureMode
Definition MeasureMode.h:18
Dimension
Definition Dimension.h:18
Errata
Definition Errata.h:18
Config * resolveRef(const YGConfigRef ref)
Definition Config.h:84
PhysicalEdge
Definition PhysicalEdge.h:14
Definition FloatOptional.h:15
constexpr bool isDefined() const
Definition FloatOptional.h:36
Definition LayoutResults.h:22