Initial attempt at rerolling patch from PR-2610
auto merge of #4006 : letharion/servo/Bitfield-to-bitflags, r=jdm

This is my attempt at solving #3690 

Initially, this is simply a naive attempt at re-rolling the changes from PR-2610. To my surprise, not only did it compile cleanly, the few local test failures I had seemed completely unrelated to what I was doing (mostly timeouts), so I'm making a PR of this.