Add a layout debug module. This outputs a trace of the layout process to a JSON
file which can be viewed in an external tool. It provides a timelapse view of
how the flow tree and fragments changed during the layout process, which makes
it easier to debug layout bugs.
Change scope macro to be a no-op in release builds.
Merge pull request #3206 from glennw/layout-trace-enc

Add an initial pass at a layout debug module.