Ensures that text positions are at a grapheme boundary and not at a low surrogate pair

This patch changes the way that CreateNext/PreviousCharacterPosition work so that they don't move by a single UTF16 code point but,
similar to how the left / right cursor keys work, by a grapheme cluster.
A grapheme cluster is what a person familiar with a particular language would call a single character.
For example, it could include a UTF16 code point for a letter and more UTF16 code points for diacritics,
or it could include a surrogate pair for characters outside the basic multilingual plain.

This patch also disallows creating text positions that are not at a grapheme cluster boundary,
so that text positions can never point in the middle of a character such as at
a low surrogate pair.

To avoid introducing performance regressions, this patch caches
the inner text of the position's anchor node, after it has been retrieved for the first time.
The break iterator is also cached.

An upcoming patch will ensure that AXPositions are invalidated when the AXTree changes.
This has always been the case, but the upcoming patch will ensure that this is captured and enforced in code too,
especially now that AXPosition includes a handful of cached members.

Furthermore, I took the opportunity to correct the copy constructors which cannot be defaulted since
AXTreeID is non-copiable and improve the assignment operator using the copy and swap idiom.

[email protected], [email protected]

Change-Id: Iba12e0d214cd0d4a604597f9bb17a1a78992584f
Bug: 720370
Change-Id: Iba12e0d214cd0d4a604597f9bb17a1a78992584f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1796047
Reviewed-by: Nektarios Paisios <[email protected]>
Reviewed-by: Kevin Babbitt <[email protected]>
Reviewed-by: Kurt Catti-Schmidt <[email protected]>
Commit-Queue: Nektarios Paisios <[email protected]>
Cr-Commit-Position: refs/heads/master@{#711983}
10 files changed