Trim whitespace during head and tail string elision.

All string elision that removes the head or tail of a string will now
remove any whitespace adjacent to the elision point as well.

Furthermore, eliding the beginning of a string will never result in more
unicode codepoints or bytes than was initially requested. Previously,
it was possible to end up including a character with combining marks or
a character whose codepoint was split by the target number of
characters.

This does affect filename elision. For example, eliding "foo bar.gif" to
the width of 9 characters results in "foo….gif" rather than "foo ….gif",
because the filename elision logic elides the tail of the base filename
rather than eliding the middle of the full filename.

Bug: 897967
Change-Id: I0e5e170b656c185a91de64ef042d01ec3920ceb8
Reviewed-on: https://chromium-review.googlesource.com/c/1387737
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Michael Wasserman <msw@chromium.org>
Commit-Queue: Dana Fried <dfried@chromium.org>
Cr-Commit-Position: refs/heads/master@{#621337}
9 files changed