Bug 1010162 - Follow up 1008144 - Decouple layout logic from app r=kgrandon