Simple line layout: Do not use invalid m_lastNonWhitespaceFragment while removing...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Mar 2017 21:02:15 +0000 (21:02 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Mar 2017 21:02:15 +0000 (21:02 +0000)
commitac710072f5a4fa3201fdde015d444605e21c54b7
tree22f0f11855ec815c521c57b9b2ded0fcc39c0e5b
parent347677345c72f70c7c496efba7c2aa06811227da
Simple line layout: Do not use invalid m_lastNonWhitespaceFragment while removing trailing whitespace.
https://bugs.webkit.org/show_bug.cgi?id=169288
rdar://problem/30576976

Reviewed by Antti Koivisto.

Source/WebCore:

When the current line has nothing but whitespace, m_lastNonWhitespaceFragment is invalid so
we should not use the start/end values to decide how many characters we need to revert.
This patch makes m_lastNonWhitespaceFragment optional. When it's invalid we just remove
all the runs from the current line since they are all considered whitespace runs.

Test: fast/text/simple-line-layout-line-is-all-whitespace.html

* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::revertAllRunsOnCurrentLine):
(WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):

LayoutTests:

* fast/text/simple-line-layout-line-is-all-whitespace-expected.txt: Added.
* fast/text/simple-line-layout-line-is-all-whitespace.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213534 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/text/simple-line-layout-line-is-all-whitespace-expected.txt [new file with mode: 0644]
LayoutTests/fast/text/simple-line-layout-line-is-all-whitespace.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/SimpleLineLayout.cpp