Search the non-ceiling edges for non-bubbles, and then check for non-bubble paths between these nodes.
In this case, there is a path from the top-left corner (non-bubble touching the non-ceiling left wall) to the 4th spot on the bottom edge consisting entirely of non-bubbles. This means that everything along the edge between them (down the left side, across the bottom) is disconnected and should fall (along with everything attached to those). Simply grab the first bubble along the outer page (the 2 at the start of the second row), and drop it and every bubble connected to it.
There is no path from any of the outer non-bubbles to the non-bubble on the right edge, so we don't drop anything over there.