Outside of compositor, store window size in CSS px

This fixes an issue where the CSS viewport was too large on high-DPI displays
because it was set to the window size in device pixels, instead of px.  This
patch ensures that the window size is converted from device pixels to px
before being passed to script/layout code.

The Window trait now exposes the window size in both device pixels and
density-independent screen coordinates, with clearer method names.