Check the selection has collapsed after pasting

In Chrome you can paste the empty string which triggers
the paste events but doesn't change the paste target. This
results in the insertion of the context character on empty
lines. To avoid this we can detect if the selection we put
around the context character is still there and abort the
paste.

Bug: 58138
Change-Id: Ib73465a2376cd316dbac6ce2567ecb64bc500307
(cherry picked from commit 80f5f1245138da7e22f7fa82a5965f16bce910c6)
Merge "Check the selection has collapsed after pasting" into wmf/1.23wmf6