Trailing space characters in an editable text node are sometimes ignored (as normal for HTML) and sometimes rendered (as if in CSS "white-space: pre").
Repro:
1. Go to: https://output.jsbin.com/qepatof
2. Click in the red box to focus it.
3. Move cursor to end of the text by holding right arrow key.
4. Type "x" once.
Expected result:
The last word in the box should be "xxxx".
Actual result:
The "x" is a word by itself.
The green boxes have what I believe is the correct behavior. Note that all three boxes have the same DOM content; only their sizes are different. The whitespace interpretation depends on the line wrapping, which is very weird.
Setting "line-break: normal" on the div corrects the problem. This implicates the "-webkit-line-break: after-white-space" style that is added in HTMLElement::CollectStyleForPresentationAttribute. See also issue 427135 which aims to remove this.
Discovered while looking at editing/inserting/typing-at-end-of-line.html. There shouldn't be two spaces before "have", but there have been since http://crrev.com/9638d384.
Comment 1 by yosin@chromium.org
, Jun 9 2017Components: -Blink>Editing Blink>Editing>Command
Status: Available (was: Unconfirmed)