From b6b0bcccfc3ff793bc0a6e7286314ed7b765b6b4 Mon Sep 17 00:00:00 2001 From: Martin Dias Date: Thu, 5 Oct 2023 09:50:14 -0300 Subject: [PATCH] Reformat doUpdateLayout --- src/Bloc/BlSpace.class.st | 67 +++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/src/Bloc/BlSpace.class.st b/src/Bloc/BlSpace.class.st index bd48ba0f7..8149cb57d 100644 --- a/src/Bloc/BlSpace.class.st +++ b/src/Bloc/BlSpace.class.st @@ -844,43 +844,54 @@ BlSpace >> doUpdateFocus [ { #category : #'change - layout' } BlSpace >> doUpdateLayout [ + | elementsToLayout aBlElementBoundsUpdater | - + self elementsNeedingLayout copy do: [ :eachElement | - eachElement privatePreviousMeasurementSpec - ifNil: [ - self elementsNeedingLayout remove: eachElement. - eachElement requestLayout ] ]. - - elementsToLayout := self elementsNeedingLayout reject: [ :eachElement | - | shouldIgnore | - - shouldIgnore := false. - - self elementsNeedingLayout do: [ :eachPotentialParent | - (eachElement hasParent: eachPotentialParent) - ifTrue: [ - eachElement - allParentsTo: eachPotentialParent - do: [ :eachParent | eachParent privateRequestingLayout: true ]. - shouldIgnore := true ] ]. - - shouldIgnore ]. - - "we should clear the elements needing layout before we compute layout to support multiple layout passes" + eachElement privatePreviousMeasurementSpec ifNil: [ + self elementsNeedingLayout remove: eachElement. + eachElement requestLayout ] ]. + + elementsToLayout := + self elementsNeedingLayout reject: [ :eachElement | + | shouldIgnore | + shouldIgnore := false. + + self elementsNeedingLayout do: [ :eachPotentialParent | + (eachElement hasParent: eachPotentialParent) + ifTrue: [ + eachElement + allParentsTo: eachPotentialParent + do: [ :eachParent | + eachParent privateRequestingLayout: true ]. + shouldIgnore := true ] ]. + + shouldIgnore ]. + + "we should clear the elements needing layout before we compute layout + to support multiple layout passes" self elementsNeedingLayout removeAll. - elementsToLayout := elementsToLayout - collect: [ :eachElement | eachElement -> eachElement compositionDepth ] as: Array. - elementsToLayout := (elementsToLayout sort: [ :a :b | a value > b value ]) collect: [ :each | each key ]. + elementsToLayout := + elementsToLayout + collect: [ :eachElement | eachElement -> eachElement compositionDepth ] + as: Array. + elementsToLayout := + (elementsToLayout + sort: [ :a :b | a value > b value ]) + collect: [ :each | each key ]. aBlElementBoundsUpdater := BlElementBoundsUpdater new. elementsToLayout do: [ :eachElement | - self doUpdateLayoutBoundary: eachElement context: aBlElementBoundsUpdater ]. + self + doUpdateLayoutBoundary: eachElement + context: aBlElementBoundsUpdater ]. - self root isLayoutRequested - ifTrue: [ self doUpdateLayout: self root context: aBlElementBoundsUpdater ]. + self root isLayoutRequested ifTrue: [ + self + doUpdateLayout: self root + context: aBlElementBoundsUpdater ]. aBlElementBoundsUpdater commitChanges ]