Mantis - Squeak
Viewing Issue Advanced Details
7685 Morphic major always 01-13-12 15:43 01-13-12 16:26
unoduetre  
 
normal  
new 4.2  
open  
none    
none  
0007685: Two (maybe unrelated) bugs with morphs layout
Consider the following code (do not run it yet):

"step1"
morph1:=Morph new.
morph1 position: 100 @ 100.
morph1 extent: 100 @ 100.
morph1 color: Color blue.
morph1 layoutPolicy: TableLayout new.
morph1 openInWorld.

"step2"
morph2:=Morph new.
morph2 height: 75.
morph2 color: Color red.
morph2 hResizing: #spaceFill.
morph1 addMorph: morph2.

"step3"
morph3:=Morph new.
morph3 position: 175 @ 100.
morph3 height: 50.
morph3 color: Color green.
morph2 addMorph: morph3.

"step4"
morph1 width: morph1 width + 25.

"step5"
morph1 width: morph1 width + 25.

Now in the Workspace run step1, step2, step3 and step4, but do NOT run them at once. You should see what is in the image Bug1.gif (attached).
This is wrong because of
morph2 hResizing: #spaceFill.
Now if you do step5 you will see what is in the image Step5.gif
You should notice the big jump by 50 pixels (instead of 25).
The source of this bug is the following line

cellBounds = self fullBounds ifTrue:[^self]. "already up to date"

in Morph>>layoutInBounds:

Now please consider the second bug.
Run step1, step2, step3 at once in workspace.
You should see what is in the image Bug2.gif
 Bug1.gif [^] (1,236 bytes) 01-13-12 15:43
 Step5.gif [^] (1,214 bytes) 01-13-12 15:44
 Bug2.gif [^] (1,663 bytes) 01-13-12 15:44

Notes
(0014213)
unoduetre   
01-13-12 15:46   
Also notice what happens if you change steps 4 and 5 to:
morph1 width: morph1 width + 26.
(0014214)
unoduetre   
01-13-12 16:26   
Even after removing:

cellBounds = self fullBounds ifTrue:[^self]. "already up to date"

The following line still causes problems:

cellBounds extent = self fullBounds extent "nice fit"
ifTrue:[^self position: cellBounds origin].

The bug number 1 is removed by commenting both line, but I don't know if it is a good idea, because I don't know Morphic enough. Do those lines really speed things up? Are the conditions of this bug too specific to repair it?