script: Inline `is_element_for_layout` and friends.

8% improvement on style recalc on Wikipedia.
auto merge of #2626 : pcwalton/servo/inline-get-element, r=jdm

8% improvement on style recalc on Wikipedia.

r? @Ms2ger