I'd like to know under what circumstances does CiviCRM automatically set an address's Location Type to "Billing", under what circumstances does it automatically set the "Is billing" checkbox for an address.

For example, when completing a public-facing contribution form, or a webform, etc., how are these fields populated?

(I've read https://civicrm.stackexchange.com/questions/8664/why-is-there-a-location-type-and-a-checkbox-for-billing-addresses which aims to explain the *purpose* of these fields, how they might be used and understood, and why you might manually set them one way or another, but this is slightly different, since I want to know how they're *automatically* set by CiviCRM.)