[squeak-dev] The Trunk: Morphic-cmfcmf.1490.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jul 5 15:36:34 UTC 2019

David T. Lewis uploaded a new version of Morphic to project The Trunk:

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

Name: Morphic-cmfcmf.1490
Author: cmfcmf
Time: 30 June 2019, 12:04:13.370226 pm
UUID: ab2320d7-f8f4-df46-a786-ec28230e912c
Ancestors: Morphic-pre.1489

When wrapping a Morph into a flex shell, first add the flex shell to the Morph's owner (and thus to the Morph's world) before making the Morph a submorph of the flex shell.
This avoids unnecessarily sending outOfWorld: to the Morph when adding it to the new flex shell (which doesn't have a world after creation) and intoWorld: when adding the flex shell to the Morph's owner right thereafter.

=============== Diff against Morphic-pre.1489 ===============

Item was changed:
  ----- Method: Morph>>addFlexShell (in category 'rotate scale and flex') -----
  	"Wrap a rotating and scaling shell around this morph."
  	| oldHalo myWorld flexMorph anIndex |
  	oldHalo:= self halo.
  	myWorld := self world.
  	self owner
  		ifNil: [flexMorph := self newTransformationMorph asFlexOf: self]
  		ifNotNil: [:myOwner |
  			anIndex := myOwner submorphIndexOf: self.
+ 			"Avoid triggering outOfWorld: on self by first adding flexMorph to myOwner and only then making myself a submorph of flexMorph via asFlexOf:"
+ 			flexMorph := self newTransformationMorph.
- 			flexMorph := self newTransformationMorph asFlexOf: self.
  			myOwner addMorph: flexMorph asElementNumber: anIndex.
+ 			flexMorph asFlexOf: self.
  			myWorld ifNotNil: [myWorld startSteppingSubmorphsOf: flexMorph]].
  	self transferStateToRenderer: flexMorph.
  	oldHalo ifNotNil: [oldHalo setTarget: flexMorph].
  	^ flexMorph!

More information about the Squeak-dev mailing list