Check the selection is in the correct surface

Previously, if the selection was in another surface, RangeState would silently
use a DM offset computed from the wrong document.

Change-Id: I87cff916690aca2094788bce7f97c95b594818eb
Merge "Check the selection is in the correct surface"