'From Squeak3.2alpha of 2 October 2001 [latest update: #4602] on 11 December 2001 at 10:23:13 pm'! "Change Set: SecureBorderStyle-ar Date: 11 December 2001 Author: Andreas Raab Secure morphs against the use of invalid border styles."! !Morph methodsFor: 'accessing' stamp: 'ar 12/11/2001 22:14'! borderStyle: newStyle newStyle = self borderStyle ifFalse:[ (self canDrawBorder: newStyle) ifFalse:[ "Replace the suggested border with a simple one" ^self borderStyle: (BorderStyle width: newStyle width color: (newStyle trackColorFrom: self) color)]. self setProperty: #borderStyle toValue: newStyle. self changed].! ! !BorderedMorph methodsFor: 'accessing' stamp: 'ar 12/11/2001 22:14'! borderStyle: aBorderStyle "Work around the borderWidth/borderColor pair" aBorderStyle = self borderStyle ifTrue:[^self]. "secure against invalid border styles" (self canDrawBorder: aBorderStyle) ifFalse:[ "Replace the suggested border with a simple one" ^self borderStyle: (BorderStyle width: aBorderStyle width color: (aBorderStyle trackColorFrom: self) color)]. aBorderStyle width = self borderStyle width ifFalse:[self changed]. (aBorderStyle == nil or:[aBorderStyle == BorderStyle default]) ifTrue:[ self removeProperty: #borderStyle. borderWidth _ 0. ^self changed]. self setProperty: #borderStyle toValue: aBorderStyle. borderWidth _ aBorderStyle width. aBorderStyle style == #simple ifTrue:[borderColor _ aBorderStyle color] ifFalse:[borderColor _ aBorderStyle style]. self changed. ! !