What's that white stuff in my coffee?

When I get a cup of coffee in a Styrofoam cup there is often (but not always) a white foam that forms around the outer edge of the drink. Happens when I get hot soup in Styrofoam too. What is that stuff? Is it just tiny bubbles that form somehow or is the cup actually dissolving? And if the cup is dissolving, aren’t I drinking plastic?

Anybody else ever wonder?

To help your research, you should be looking up info on polystyrene, not Styrofoam.
Some clarification from Wikipedia:

In the United States, the word styrofoam is often used as a generic term for expanded polystyrene foam, such as disposable coffee cups, coolers or cushioning material in packaging, which are typically white and are made of expanded polystyrene beads. This is different from the extruded polystyrene used for Styrofoam insulation. The polystyrene foam used for craft applications, which can be identified by its roughness and by the fact that it “crunches” when cut

Jumping back in to add this: I am guessing that the irregular surface presented by the polystyrene container to the liquid allows bubbles to form and hold on, letting them chain together. Contrast this to the slick/smooth glass and ceramic surfaces which seem to be bubble unfriendly.

Could be related to coffee oils.
Lemon oil is known to mess with styrofoam:

Cecil on lemon oil and polystyrene cups:
Why does tea make holes in plastic foam cups?
Someone else:
Polystyrene Fact & Fiction

I see no reason why coffee bean oils couldn’t do something similar.

Thanks. The link to Cecil’s article is interesting. He tackled the question of what breaks down the polystyrene (20 years ago!) but ends with this: “Suspiciously, however, nobody said anything about the “brownish white foam” you mention, leading me to think maybe the researchers weren’t patronizing the right restaurants.” If even Cecil doesn’t know what it is, I don’t think I want to be drinking it.