Break the compositing -> layout dependency

Break the compositing -> layout dependency as suggested on reddit, by being generic over LayoutTask.