Optimize reflow by changing enums to traits and inlining more
auto merge of #1132 : pcwalton/servo/optimize-reflow, r=larsbergstrom

r? @metajack