Restore a collapsed trailing space of text used for line break

When a text is wrapped during layout, the trailing space of the
text can be collapsed and a line break is inserted instead of
the space. In this case, we need to restore the collapsed space
when we copy the text. This problem was fixed in the below CL:
https://codereview.chromium.org/2193033004/

However, the CL only deals with the case that the sibling of
the text is an inline element:
<p>My favorite browser is <del>ABC</del> <ins>Chrome</ins>!</p>
<p>Counter: <span id="counter">10</span></p>
<dfn>world <kbd>Blink</kbd></dfn>
<div>Copy this area <a href="http://foo/">AVeryLongWordThatWillWrap</a></div>

In addition, the previous fix has the unintended effect that the
trailing space can be restored even if there is no line break.

This CL can additionally handle the following case:
<div style="width: 2em;"><b><i>foo </i></b>bar</div>
It also removes the unintended effect.

BUG=318925
TEST=editing/pasteboard/preserve-trailing-space.html

Review-Url: https://codereview.chromium.org/2280513004
Cr-Commit-Position: refs/heads/master@{#416883}
10 files changed