layout: Support more types of selectors for style sharing.

This helps avoid problems with style sharing in common cases, often
caused by the user agent stylesheet.
auto merge of #3838 : pcwalton/servo/style-sharing-enhancements, r=SimonSapin

This helps avoid problems with style sharing in common cases, often
caused by the user agent stylesheet.

r? @SimonSapin