Move inline stylesheet parsing out of HTML parser.

Instead, use shared code to parse stylesheet content when it is inserted,
whether during parsing or dynamically by script.

Based on work by sanools in #1350.