@@ -274,13 +274,15 @@ private function renderBlockContainer(
274274 );
275275 }
276276
277- $ renderedHeight = $ localClipBox === null
278- ? $ this ->boxResolver ->resolveAutoContainerHeight ($ box ['height ' ], $ padding , $ contentHeight )
279- : $ this ->boxResolver ->resolveFixedContainerHeight ($ box ['height ' ], $ padding , $ contentHeight );
280-
281- $ this ->appendDecoration ($ style , $ box , $ renderedHeight , $ canvasHeight , $ decorations );
282-
283- return $ renderedHeight ;
277+ return $ this ->finalizeContainerRendering (
278+ $ style ,
279+ $ box ,
280+ $ padding ,
281+ $ contentHeight ,
282+ $ localClipBox ,
283+ $ canvasHeight ,
284+ $ decorations ,
285+ );
284286 }
285287
286288 /**
@@ -324,12 +326,15 @@ private function renderFlexContainer(
324326 );
325327
326328 if ($ items === []) {
327- $ renderedHeight = $ localClipBox === null
328- ? $ this ->boxResolver ->resolveAutoContainerHeight ($ box ['height ' ], $ padding , 0.0 )
329- : $ this ->boxResolver ->resolveFixedContainerHeight ($ box ['height ' ], $ padding , 0.0 );
330- $ this ->appendDecoration ($ style , $ box , $ renderedHeight , $ canvasHeight , $ decorations );
331-
332- return $ renderedHeight ;
329+ return $ this ->finalizeContainerRendering (
330+ $ style ,
331+ $ box ,
332+ $ padding ,
333+ 0.0 ,
334+ $ localClipBox ,
335+ $ canvasHeight ,
336+ $ decorations ,
337+ );
333338 }
334339
335340 $ metrics = $ this ->flexPlanner ->calculateMetrics ($ items , $ direction , $ justifyContent , $ gap , $ contentBox );
@@ -359,9 +364,37 @@ private function renderFlexContainer(
359364 }
360365
361366 $ contentHeight = $ direction === 'row ' ? $ metrics ['crossAxisSize ' ] : $ metrics ['totalMainAxisSize ' ];
367+
368+ return $ this ->finalizeContainerRendering (
369+ $ style ,
370+ $ box ,
371+ $ padding ,
372+ $ contentHeight ,
373+ $ localClipBox ,
374+ $ canvasHeight ,
375+ $ decorations ,
376+ );
377+ }
378+
379+ /**
380+ * @param array{x: float, y: float, width: float, height: float} $box
381+ * @param array{top: float, right: float, bottom: float, left: float} $padding
382+ * @param list<LayoutDecoration> $decorations
383+ * @param array{x: float, y: float, width: float, height: float}|null $localClipBox
384+ */
385+ private function finalizeContainerRendering (
386+ StyleMap $ style ,
387+ array $ box ,
388+ array $ padding ,
389+ float $ contentHeight ,
390+ ?array $ localClipBox ,
391+ float $ canvasHeight ,
392+ array &$ decorations ,
393+ ): float {
362394 $ renderedHeight = $ localClipBox === null
363395 ? $ this ->boxResolver ->resolveAutoContainerHeight ($ box ['height ' ], $ padding , $ contentHeight )
364396 : $ this ->boxResolver ->resolveFixedContainerHeight ($ box ['height ' ], $ padding , $ contentHeight );
397+
365398 $ this ->appendDecoration ($ style , $ box , $ renderedHeight , $ canvasHeight , $ decorations );
366399
367400 return $ renderedHeight ;
0 commit comments