[layout] Port sanitize() to use dispatch() Needed some rework of Extension table. Hopefully I got it right, and the new template usage doesn't break any compilers...