The Trunk: Morphic-mt.1485.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-mt.1485.mcz

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

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

Name: Morphic-mt.1485
Author: mt
Time: 24 April 2019, 11:10:53.74187 am
UUID: ddfc0442-d803-f04f-9267-a248ef94916e
Ancestors: Morphic-cmm.1484

Fixes a minor update/performance issue in SketchMorph, which affects the buttons of system windows.

I *think* it is never a good idea to overwrite #layoutChanged with such side effects. There are other examples in the code base. We should refactor that in the (near) future.

WHY? The message #layoutChanged should mean "Hey! My bounds have changed. Consider this in the next layout computation." It should not *do* the actual change but only tell others about it *after* it has happened.

=============== Diff against Morphic-cmm.1484 ===============

Item was changed:
  ----- Method: SketchMorph>>layoutChanged (in category 'layout') -----
  layoutChanged
  "Update rotatedForm and compute new bounds."
+
+ | priorBounds |
+ fullBounds ifNotNil: [self changed].
+
+ priorBounds := bounds.
+
+ self flag: #refactor. "mt: Such side-effects in #layoutChanged can have a severe impact on performance. Better not overwrite it but manage the rotatedForm elsewhere and from there call #layoutChanged if bounds change. Also, just overwrite #extent to use the extent of the rotated form."
- self changed.
  self generateRotatedForm.
  bounds := bounds origin extent: rotatedForm extent.
+
+ priorBounds ~= bounds
+ ifTrue: [super layoutChanged].
+
- super layoutChanged.
  self changed.
  !