+ // Policy is set to Fixed, so if the application / control has not set one of the dimensions,
+ // then we should use the natural size of the control rather than the full allocation.
+ if ( EqualsZero( size.width ) )
+ {
+ size.width = GetWidthForHeight( size.height );
+ }
+ else if ( EqualsZero( size.height ) )
+ {
+ size.height = GetHeightForWidth( size.width );
+ }
+ }
+ else
+ {
+ // If that is not set then set the size to the control's natural size
+ size = Vector2( GetNaturalSize() );
+ }
+ }
+ else
+ {
+ // Width is fixed so if the application / control has set it, then use that.
+ if ( !EqualsZero( mImpl->mNaturalSize.width ) )
+ {
+ size.width = mImpl->mNaturalSize.width;
+ }
+ else
+ {
+ // Otherwise, set the width to what has been allocated.
+ size.width = allocatedSize.width;
+ }