There is no specification for this, but there are relevant
WPT tests in `selection/contenteditable`. This PR implements
the required changes to make sure that when such an element
is focused (programmatically), it selects the correct node.
The implementation is therefore entirely reverse-engineered
based on existing browser behavior and commented to hopefully
make it make sense.
Part of #7492
Part of #12776
Part of #25005
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>