The fix made under JDK-8014863 is not full. JDK 7 and 8 still have some problems with line break calculation.
Steps to reproduce:
1. Run HTMLEditorTest.java (attached).
2. Place the cursor at the beginning of the first line and then type "one two ".
After the last space been entered the first line is incorrectly broken after the "this is" where we'd expect to see at least "this is a test" on the first line.