Move the caret invalidation from CharacterDataChanged to CharacterDataWillChange so that the text doesn't change under the caret before invalidation. Bug 887631, r=ehsan, a=abillings