How does WIFI Positioning System work without GPS nor Internet?

I read this great post about WPS that stated:

It’s possible to do Wi-Fi geolocation without an Internet connection, but to do that, you’d have to cache a copy of the database, which might be too big. But a smartphone might have an optimization where it caches sections of the database for the city/area it already knows you’re in, so that even if you don’t have an Internet connection later in the same day in the same region, it can still look up your current position using the cached part of the database. If law enforcement gets a hold of your phone, they could possibly look at what areas your phone has cached as evidence of where your phone was on what date within the last few days.

I have this doubt:….which devices do this? do smartphones do this? all brands? When is this done? such as, “when a smartphone hits a new city area, it downloads this database asap just in case it may need it later if it has no GPS signal and no internet”.

Any explanation much appreciated.