@@ -20,7 +20,8 @@ static inline void setFlexStartLayoutPosition(
2020 const FlexDirection axis,
2121 const float containingBlockWidth) {
2222 child->setLayoutPosition (
23- child->getFlexStartMargin (axis, direction, containingBlockWidth) +
23+ child->style ().computeFlexStartMargin (
24+ axis, direction, containingBlockWidth) +
2425 parent->getLayout ().border (flexStartEdge (axis)) +
2526 parent->getLayout ().padding (flexStartEdge (axis)),
2627 flexStartEdge (axis));
@@ -36,7 +37,8 @@ static inline void setFlexEndLayoutPosition(
3637 getPositionOfOppositeEdge (
3738 parent->getLayout ().border (flexEndEdge (axis)) +
3839 parent->getLayout ().padding (flexEndEdge (axis)) +
39- child->getFlexEndMargin (axis, direction, containingBlockWidth),
40+ child->style ().computeFlexEndMargin (
41+ axis, direction, containingBlockWidth),
4042 axis,
4143 parent,
4244 child),
@@ -57,12 +59,13 @@ static inline void setCenterLayoutPosition(
5759 parent->getLayout ().padding (flexEndEdge (axis));
5860 const float childOuterSize =
5961 child->getLayout ().measuredDimension (dimension (axis)) +
60- child->getMarginForAxis (axis, containingBlockWidth);
62+ child->style (). computeMarginForAxis (axis, containingBlockWidth);
6163 child->setLayoutPosition (
6264 (parentContentBoxSize - childOuterSize) / 2 .0f +
6365 parent->getLayout ().border (flexStartEdge (axis)) +
6466 parent->getLayout ().padding (flexStartEdge (axis)) +
65- child->getFlexStartMargin (axis, direction, containingBlockWidth),
67+ child->style ().computeFlexStartMargin (
68+ axis, direction, containingBlockWidth),
6669 flexStartEdge (axis));
6770}
6871
@@ -150,30 +153,32 @@ static void positionAbsoluteChildLegacy(
150153 : ((resolveChildAlignment (parent, child) == Align::FlexEnd) ^
151154 (parent->style ().flexWrap () == Wrap::WrapReverse));
152155
153- if (child->isFlexEndPositionDefined (axis, direction) &&
154- !child->isFlexStartPositionDefined (axis, direction)) {
156+ if (child->style (). isFlexEndPositionDefined (axis, direction) &&
157+ !child->style (). isFlexStartPositionDefined (axis, direction)) {
155158 child->setLayoutPosition (
156159 containingNode->getLayout ().measuredDimension (dimension (axis)) -
157160 child->getLayout ().measuredDimension (dimension (axis)) -
158- containingNode->getFlexEndBorder (axis, direction) -
159- child->getFlexEndMargin (
161+ containingNode->style (). computeFlexEndBorder (axis, direction) -
162+ child->style (). computeFlexEndMargin (
160163 axis,
161164 direction,
162165 isAxisRow ? containingBlockWidth : containingBlockHeight) -
163- child->getFlexEndPosition (
166+ child->style (). computeFlexEndPosition (
164167 axis,
165168 direction,
166169 isAxisRow ? containingBlockWidth : containingBlockHeight),
167170 flexStartEdge (axis));
168171 } else if (
169- !child->isFlexStartPositionDefined (axis, direction) && shouldCenter) {
172+ !child->style ().isFlexStartPositionDefined (axis, direction) &&
173+ shouldCenter) {
170174 child->setLayoutPosition (
171175 (parent->getLayout ().measuredDimension (dimension (axis)) -
172176 child->getLayout ().measuredDimension (dimension (axis))) /
173177 2 .0f ,
174178 flexStartEdge (axis));
175179 } else if (
176- !child->isFlexStartPositionDefined (axis, direction) && shouldFlexEnd) {
180+ !child->style ().isFlexStartPositionDefined (axis, direction) &&
181+ shouldFlexEnd) {
177182 child->setLayoutPosition (
178183 (parent->getLayout ().measuredDimension (dimension (axis)) -
179184 child->getLayout ().measuredDimension (dimension (axis))),
@@ -218,25 +223,29 @@ static void positionAbsoluteChildImpl(
218223 // to the flex-start edge because this algorithm works by positioning on the
219224 // flex-start edge and then filling in the flex-end direction at the end if
220225 // necessary.
221- if (child->isInlineStartPositionDefined (axis, direction)) {
226+ if (child->style (). isInlineStartPositionDefined (axis, direction)) {
222227 const float positionRelativeToInlineStart =
223- child->getInlineStartPosition (axis, direction, containingBlockSize) +
224- containingNode->getInlineStartBorder (axis, direction) +
225- child->getInlineStartMargin (axis, direction, containingBlockSize);
228+ child->style ().computeInlineStartPosition (
229+ axis, direction, containingBlockSize) +
230+ containingNode->style ().computeInlineStartBorder (axis, direction) +
231+ child->style ().computeInlineStartMargin (
232+ axis, direction, containingBlockSize);
226233 const float positionRelativeToFlexStart =
227234 inlineStartEdge (axis, direction) != flexStartEdge (axis)
228235 ? getPositionOfOppositeEdge (
229236 positionRelativeToInlineStart, axis, containingNode, child)
230237 : positionRelativeToInlineStart;
231238
232239 child->setLayoutPosition (positionRelativeToFlexStart, flexStartEdge (axis));
233- } else if (child->isInlineEndPositionDefined (axis, direction)) {
240+ } else if (child->style (). isInlineEndPositionDefined (axis, direction)) {
234241 const float positionRelativeToInlineStart =
235242 containingNode->getLayout ().measuredDimension (dimension (axis)) -
236243 child->getLayout ().measuredDimension (dimension (axis)) -
237- containingNode->getInlineEndBorder (axis, direction) -
238- child->getInlineEndMargin (axis, direction, containingBlockSize) -
239- child->getInlineEndPosition (axis, direction, containingBlockSize);
244+ containingNode->style ().computeInlineEndBorder (axis, direction) -
245+ child->style ().computeInlineEndMargin (
246+ axis, direction, containingBlockSize) -
247+ child->style ().computeInlineEndPosition (
248+ axis, direction, containingBlockSize);
240249 const float positionRelativeToFlexStart =
241250 inlineStartEdge (axis, direction) != flexStartEdge (axis)
242251 ? getPositionOfOppositeEdge (
@@ -303,10 +312,10 @@ void layoutAbsoluteChild(
303312 SizingMode childWidthSizingMode = SizingMode::MaxContent;
304313 SizingMode childHeightSizingMode = SizingMode::MaxContent;
305314
306- auto marginRow =
307- child-> getMarginForAxis ( FlexDirection::Row, containingBlockWidth);
308- auto marginColumn =
309- child-> getMarginForAxis ( FlexDirection::Column, containingBlockWidth);
315+ auto marginRow = child-> style (). computeMarginForAxis (
316+ FlexDirection::Row, containingBlockWidth);
317+ auto marginColumn = child-> style (). computeMarginForAxis (
318+ FlexDirection::Column, containingBlockWidth);
310319
311320 if (child->hasDefiniteLength (Dimension::Width, containingBlockWidth)) {
312321 childWidth = child->getResolvedDimension (Dimension::Width)
@@ -316,15 +325,19 @@ void layoutAbsoluteChild(
316325 } else {
317326 // If the child doesn't have a specified width, compute the width based on
318327 // the left/right offsets if they're defined.
319- if (child->isFlexStartPositionDefined (FlexDirection::Row, direction) &&
320- child->isFlexEndPositionDefined (FlexDirection::Row, direction)) {
328+ if (child->style ().isFlexStartPositionDefined (
329+ FlexDirection::Row, direction) &&
330+ child->style ().isFlexEndPositionDefined (
331+ FlexDirection::Row, direction)) {
321332 childWidth =
322333 containingNode->getLayout ().measuredDimension (Dimension::Width) -
323- (containingNode->getFlexStartBorder (FlexDirection::Row, direction) +
324- containingNode->getFlexEndBorder (FlexDirection::Row, direction)) -
325- (child->getFlexStartPosition (
334+ (containingNode->style ().computeFlexStartBorder (
335+ FlexDirection::Row, direction) +
336+ containingNode->style ().computeFlexEndBorder (
337+ FlexDirection::Row, direction)) -
338+ (child->style ().computeFlexStartPosition (
326339 FlexDirection::Row, direction, containingBlockWidth) +
327- child->getFlexEndPosition (
340+ child->style (). computeFlexEndPosition (
328341 FlexDirection::Row, direction, containingBlockWidth));
329342 childWidth = boundAxis (
330343 child,
@@ -343,16 +356,19 @@ void layoutAbsoluteChild(
343356 } else {
344357 // If the child doesn't have a specified height, compute the height based
345358 // on the top/bottom offsets if they're defined.
346- if (child->isFlexStartPositionDefined (FlexDirection::Column, direction) &&
347- child->isFlexEndPositionDefined (FlexDirection::Column, direction)) {
359+ if (child->style ().isFlexStartPositionDefined (
360+ FlexDirection::Column, direction) &&
361+ child->style ().isFlexEndPositionDefined (
362+ FlexDirection::Column, direction)) {
348363 childHeight =
349364 containingNode->getLayout ().measuredDimension (Dimension::Height) -
350- (containingNode->getFlexStartBorder (
365+ (containingNode->style (). computeFlexStartBorder (
351366 FlexDirection::Column, direction) +
352- containingNode->getFlexEndBorder (FlexDirection::Column, direction)) -
353- (child->getFlexStartPosition (
367+ containingNode->style ().computeFlexEndBorder (
368+ FlexDirection::Column, direction)) -
369+ (child->style ().computeFlexStartPosition (
354370 FlexDirection::Column, direction, containingBlockHeight) +
355- child->getFlexEndPosition (
371+ child->style (). computeFlexEndPosition (
356372 FlexDirection::Column, direction, containingBlockHeight));
357373 childHeight = boundAxis (
358374 child,
@@ -414,9 +430,11 @@ void layoutAbsoluteChild(
414430 depth,
415431 generationCount);
416432 childWidth = child->getLayout ().measuredDimension (Dimension::Width) +
417- child->getMarginForAxis (FlexDirection::Row, containingBlockWidth);
433+ child->style ().computeMarginForAxis (
434+ FlexDirection::Row, containingBlockWidth);
418435 childHeight = child->getLayout ().measuredDimension (Dimension::Height) +
419- child->getMarginForAxis (FlexDirection::Column, containingBlockWidth);
436+ child->style ().computeMarginForAxis (
437+ FlexDirection::Column, containingBlockWidth);
420438 }
421439
422440 calculateLayoutInternal (
@@ -479,11 +497,12 @@ void layoutAbsoluteDescendants(
479497 const float containingBlockWidth = absoluteErrata
480498 ? containingNodeAvailableInnerWidth
481499 : containingNode->getLayout ().measuredDimension (Dimension::Width) -
482- containingNode->getBorderForAxis (FlexDirection::Row);
500+ containingNode->style (). computeBorderForAxis (FlexDirection::Row);
483501 const float containingBlockHeight = absoluteErrata
484502 ? containingNodeAvailableInnerHeight
485503 : containingNode->getLayout ().measuredDimension (Dimension::Height) -
486- containingNode->getBorderForAxis (FlexDirection::Column);
504+ containingNode->style ().computeBorderForAxis (
505+ FlexDirection::Column);
487506
488507 layoutAbsoluteChild (
489508 containingNode,
0 commit comments