Serialize namespaced type/* selectors according to CSSOM spec.

See https://drafts.csswg.org/cssom/#serializing-selectors.

The serialize-namespaced-type-selectors.html test is a stripped version
of this pull request: https://github.com/w3c/csswg-test/pull/1020
Gecko (Firefox 43) passes all those tests.

As part of this we are fixing problems with universal selectors being
incorrectly marked as explicit (for serialization) in certain cases.

When we have pseudo elements which require an implicit shadow combinator
to match across shadow boundaries, we need to add an implicit universal
selector to make the combinator combine the pseudo with some parent when
the original selector doesn't have any other simple selectors.

video::cue(i) can add the combinator between video and ::cue(i), while
::cue(i) requires a universal selector in the internal representation
to have ::cue(i) -> /implicit-shadow-crossing/ -> *.

For ::cue(i), the universal selector were marked correctly as implicit
to avoid it being serialized as *::cue(i). However, with an explicit
universal selector in the source *::cue(i), the universal selector were
marked as explicit due to an incorrect isNull() check. Explicit
universal selectors were already dropped from the serialization of
selectors like *::before.

BUG=579043

Review URL: https://codereview.chromium.org/1607873002

Cr-Commit-Position: refs/heads/master@{#371363}
8 files changed