(Abridged) We use HIFI maps of the 987 GHz H2O 2(02)-1(11) emission to measure the sizes and shapes of 19 high-mass protostellar envelopes. To identify infall, we use HIFI spectra of the optically thin C18O 9-8 and H2O-18 1(11)-0(00) lines. The high-J C18O line traces the warm central material and redshifted H2O-18 1(11)-0(00) absorption indicates material falling onto the warm core. We probe small-scale chemical differentiation by comparing H2O 752 and 987 GHz spectra with those of H2O-18. Our measured radii of the central part of the H2O 2(02)-1(11) emission are 30-40% larger than the predictions from spherical envelope models, and axis ratios are <2, which we consider good agreement. For 11 of the 19 sources, we find a significant redshift of the H2O-18 1(11)-0(00) line relative to C18O 9-8. The inferred infall velocities are 0.6-3.2 km/s, and estimated mass inflow rates range from 7e-5 to 2e-2 M0/yr, with the highest mass inflow rates occurring toward the sources with the highest masses, and possibly the youngest ages. The other sources show either expanding motions or H2O-18 lines in emission. The H2O-18 1(11)-0(00) line profiles are remarkably similar to the differences between the H2O 2(02)-1(11) and 2(11)-2(02) profiles, suggesting that the H2O-18 line and the H2O 2(02)-1(11) absorption originate just inside the radius where water evaporates from grains, typically 1000-5000 au from the center. In some sources, the H2O-18 line is detectable in the outflow, where no C18O emission is seen. Together, the H2O-18 absorption and C18O emission profiles show that the water abundance around high-mass protostars has at least three levels: low in the cool outer envelope, high within the 100 K radius, and very high in the outflowing gas. Thus, despite the small regions, the combination of lines presented here reveals systematic inflows and chemical information about the outflows.