jquery.textSelection: Add 'replaceSelection' method
replaceSelection is a little brother of encapsulateSelection.
It can't do as much, but tries really hard to do it well.
Alternative textSelection APIs can implement it in an optimized
way if they can more efficiently replace small fragments of the
textfield's contents than the entire thing.
Additionally:
* encapsulateSelection uses replaceSelection internally.
* setContents now also preserves the scroll position.
* setContents is now chainable.
Bug: T185917
Change-Id: I05086ddce2ddd857ff88eba75cfdb6bf877bd924