@@ -34,15 +34,11 @@ YGBaselineFunc YGNode::getBaseline() const {
34
34
return baseline_;
35
35
}
36
36
37
- YGStyle YGNode::getStyle () const {
37
+ YGStyle& YGNode::getStyle () {
38
38
return style_;
39
39
}
40
40
41
- YGLayout YGNode::getLayout () const {
42
- return layout_;
43
- }
44
-
45
- YGLayout& YGNode::getLayoutRef () {
41
+ YGLayout& YGNode::getLayout () {
46
42
return layout_;
47
43
}
48
44
@@ -248,21 +244,21 @@ YGNode::YGNode()
248
244
resolvedDimensions_({{YGValueUndefined, YGValueUndefined}}) {}
249
245
250
246
YGNode::YGNode (const YGNode& node)
251
- : context_(node.getContext() ),
252
- print_(node.getPrintFunc() ),
253
- hasNewLayout_(node.getHasNewLayout() ),
254
- nodeType_(node.getNodeType() ),
255
- measure_(node.getMeasure() ),
256
- baseline_(node.getBaseline() ),
257
- style_(node.getStyle() ),
258
- layout_(node.getLayout() ),
259
- lineIndex_(node.getLineIndex() ),
260
- parent_(node.getParent() ),
261
- children_(node.getChildren() ),
262
- nextChild_(node.getNextChild() ),
263
- config_(node.getConfig() ),
264
- isDirty_(node.isDirty() ),
265
- resolvedDimensions_(node.getResolvedDimensions() ) {}
247
+ : context_(node.context_ ),
248
+ print_(node.print_ ),
249
+ hasNewLayout_(node.hasNewLayout_ ),
250
+ nodeType_(node.nodeType_ ),
251
+ measure_(node.measure_ ),
252
+ baseline_(node.baseline_ ),
253
+ style_(node.style_ ),
254
+ layout_(node.layout_ ),
255
+ lineIndex_(node.lineIndex_ ),
256
+ parent_(node.parent_ ),
257
+ children_(node.children_ ),
258
+ nextChild_(node.nextChild_ ),
259
+ config_(node.config_ ),
260
+ isDirty_(node.isDirty_ ),
261
+ resolvedDimensions_(node.resolvedDimensions_ ) {}
266
262
267
263
YGNode::YGNode (const YGConfigRef newConfig) : YGNode() {
268
264
config_ = newConfig;
@@ -315,8 +311,8 @@ YGNode& YGNode::operator=(const YGNode& node) {
315
311
nodeType_ = node.getNodeType ();
316
312
measure_ = node.getMeasure ();
317
313
baseline_ = node.getBaseline ();
318
- style_ = node.getStyle () ;
319
- layout_ = node.getLayout () ;
314
+ style_ = node.style_ ;
315
+ layout_ = node.layout_ ;
320
316
lineIndex_ = node.getLineIndex ();
321
317
parent_ = node.getParent ();
322
318
children_ = node.getChildren ();
@@ -330,28 +326,28 @@ YGNode& YGNode::operator=(const YGNode& node) {
330
326
331
327
YGValue YGNode::marginLeadingValue (const YGFlexDirection axis) const {
332
328
if (YGFlexDirectionIsRow (axis) &&
333
- getStyle () .margin [YGEdgeStart].unit != YGUnitUndefined) {
334
- return getStyle () .margin [YGEdgeStart];
329
+ style_ .margin [YGEdgeStart].unit != YGUnitUndefined) {
330
+ return style_ .margin [YGEdgeStart];
335
331
} else {
336
- return getStyle () .margin [leading[axis]];
332
+ return style_ .margin [leading[axis]];
337
333
}
338
334
}
339
335
340
336
YGValue YGNode::marginTrailingValue (const YGFlexDirection axis) const {
341
337
if (YGFlexDirectionIsRow (axis) &&
342
- getStyle () .margin [YGEdgeEnd].unit != YGUnitUndefined) {
343
- return getStyle () .margin [YGEdgeEnd];
338
+ style_ .margin [YGEdgeEnd].unit != YGUnitUndefined) {
339
+ return style_ .margin [YGEdgeEnd];
344
340
} else {
345
- return getStyle () .margin [trailing[axis]];
341
+ return style_ .margin [trailing[axis]];
346
342
}
347
343
}
348
344
349
345
YGValue YGNode::resolveFlexBasisPtr () const {
350
- YGValue flexBasis = getStyle () .flexBasis ;
346
+ YGValue flexBasis = style_ .flexBasis ;
351
347
if (flexBasis.unit != YGUnitAuto && flexBasis.unit != YGUnitUndefined) {
352
348
return flexBasis;
353
349
}
354
- if (!YGFloatIsUndefined (getStyle () .flex ) && getStyle () .flex > 0 .0f ) {
350
+ if (!YGFloatIsUndefined (style_ .flex ) && style_ .flex > 0 .0f ) {
355
351
return config_->useWebDefaults ? YGValueAuto : YGValueZero;
356
352
}
357
353
return YGValueAuto;
@@ -361,10 +357,10 @@ void YGNode::resolveDimension() {
361
357
for (uint32_t dim = YGDimensionWidth; dim < YGDimensionCount; dim++) {
362
358
if (getStyle ().maxDimensions [dim].unit != YGUnitUndefined &&
363
359
YGValueEqual (
364
- getStyle ().maxDimensions [dim], getStyle () .minDimensions [dim])) {
365
- resolvedDimensions_[dim] = getStyle () .maxDimensions [dim];
360
+ getStyle ().maxDimensions [dim], style_ .minDimensions [dim])) {
361
+ resolvedDimensions_[dim] = style_ .maxDimensions [dim];
366
362
} else {
367
- resolvedDimensions_[dim] = getStyle () .dimensions [dim];
363
+ resolvedDimensions_[dim] = style_ .dimensions [dim];
368
364
}
369
365
}
370
366
}
0 commit comments