Trim whitespace when annotating

We should assume that the user doesn't want to annotate trailing
whitespace, as we do with the link inspector.

Fix trimOuterSpaceFromRange to detect any whitespace character.

Fix getCharacterData to always return a string.

Fix various documentation lies and omissions.

Add tests for getCharacterData and getText.

Change-Id: I16488b1afada9e8dd41482ce5b6d186544a94040
Merge "Trim whitespace when annotating"