Remove some code duplication in the Compositor

It is possible to share the code which creates root layers.
auto merge of #3964 : mrobinson/servo/code-duplication, r=larsbergstrom

It is possible to share the code which creates root layers.