[@scope] Let ::From/To return CSSSelector*, improve serialization

This CL prepares for representing the ::From selector as something
that's not a CSSSelectorList (a StyleRule).

The return value of From/To is now nullptr both when there is no list
at all (e.g. implicit scopes) and when there's an empty list (which
can happen via forgiving parsing). However, this distinction is
probably not needed. The only practical consequence is that during
serialization we now drop the "to" part of the prelude if the
associated (forgiving) selector list is empty. But this serialization
is actually better, since it more closely follows the general
CSSOM principle of serializing the shortest representation.

Bug: 1280240
Change-Id: Ibb0627b84f98731faf0807699613c44b3a2805e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4274103
Reviewed-by: Steinar H Gunderson <sesse@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1108485}
diff --git a/css/css-cascade/at-scope-parsing.html b/css/css-cascade/at-scope-parsing.html
index c01365e..6fc6ac8 100644
--- a/css/css-cascade/at-scope-parsing.html
+++ b/css/css-cascade/at-scope-parsing.html
@@ -47,7 +47,7 @@
   test_valid('@scope (div::before)', '@scope ()');
   test_valid('@scope (div::after)', '@scope ()');
   test_valid('@scope (slotted(div))', '@scope ()');
-  test_valid('@scope (.a) to (div::before)', '@scope (.a) to ()');
+  test_valid('@scope (.a) to (div::before)', '@scope (.a)');
 
   test_invalid('@scope (.a) unknown (.c)');
   test_invalid('@scope (.a) to unknown (.c)');