Change layout to handle whitespace between inline elements in HTML file.

This matches the behaviour of other browsers.
Make perf_rainbow.html load ~20x faster by making the file loader read in 8 kB blocks.

This also makes the tests run significantly quicker.
Merge pull request #2966 from glennw/perf-rainbow

Make perf_rainbow.html load ~20x faster by making the file loader read i...
Merge pull request #2953 from glennw/inline-whitespace

Change layout to handle whitespace between inline elements in HTML file.