Auto-size the thumbnail list and reduce re-calculations.

- Use white-space property more effectively to automatically size the thumbnail
  list.  This allows us to use automatic with/height, which is more flexible
  (and correctly accounts for border sizes too).
- Only change thumbnail settings if layout changes.
Move padding from js to css (no longer necessary, thanks to auto-sizing).