Bug 1012578 - Abstract grid rendering logic for use in multiple apps

https://bugzilla.mozilla.org/show_bug.cgi?id=1012578