Use named constants for movement direction rather than magic numbers
Crop range selection to the anchor root

Fix an unhandled case if the anchor and focus points of a range were in
two separate roots. The select range logic will now clip the range to
the closest valid edge within the anchor's root.
Use the start node rather than cursor for word boundary expansion

The SelectionController interfaces allow word-expansion to occur on
arbitrary ranges that may not be tied directly to the cursor (e.g., when
used via the selectRange interface). This means the correct root to use
in all circumstances is the starting node & offset.