[squeak-dev] The Trunk: Morphic-mt.1718.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jan 25 15:20:12 UTC 2021


Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1718.mcz

==================== Summary ====================

Name: Morphic-mt.1718
Author: mt
Time: 25 January 2021, 4:20:06.658158 pm
UUID: 96f371e0-9b54-7949-b083-894f3322467b
Ancestors: Morphic-mt.1717

Fixes #testShrinkWrapIssue. Thanks to Javier (jdr) for pointing this out!

=============== Diff against Morphic-mt.1717 ===============

Item was changed:
  ----- Method: Morph>>doLayoutIn: (in category 'layout') -----
  doLayoutIn: layoutBounds 
  	"Compute a new layout based on the given layout bounds."
  
  	| box priorBounds |
  	"0) Quick return. No children means no effect in layout policies. Use #minWidth and #minHeight to implement #shrinkWrap for morphs without submorphs."
  	self hasSubmorphs ifFalse: [^ fullBounds := self outerBounds].
  	
  	"X.1) Prepare redraw. Testing for #bounds or #layoutBounds would be sufficient to figure out if we need an invalidation afterwards but #outerBounds is what we need for all leaf nodes so we use that"
  	priorBounds := self outerBounds.
  
  	"1) Give our children a chance to manually adjust *before* layout (cell) computation. This allows morphs to layout in their owner without having to use a layout policy."
  	self submorphsDo: [:m | m ownerChanged].
  
  	"2) Compute the new layout. This goes down the entire morph hierarchy. See #layoutInBounds: and #minExtent, which are the usual layout-policy callbacks."
+ 	self layoutPolicy ifNil: [self submorphsDo: [:m | m fullBounds]] ifNotNil: [:layout |
- 	self layoutPolicy ifNotNil: [:layout |
  		
  		"2.1) Compute the new layout."
  		self removeProperty: #doLayoutAgain.		
  		layout layout: self in: layoutBounds.
  		
  		"2.2) Do one additional run on the layout if requested in #layoutInBounds:."
  		(self hasProperty: #doLayoutAgain) ifTrue: [
  			self removeProperty: #doLayoutAgain.		
  			layout flushLayoutCache.
  			layout layout: self in: layoutBounds].
  		self assert: (self hasProperty: #doLayoutAgain) not].
  		
  	"3) Watch out for minimal extent and apply #shrinkWrap constraints."
  	self adjustLayoutBounds.
  	
  	"4) Compute and set the new full bounds. IMPORTANT to finish layout computation."
  	fullBounds := self privateFullBounds.
  	
  	"X.2) Redraw."
  	box := self outerBounds.
  	box = priorBounds ifFalse: [
  		self invalidRect: (priorBounds quickMerge: box)].!



More information about the Squeak-dev mailing list