REGRESSION(macOS Mojave): move-by-word-visually-multi-line.html fails
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Jun 2018 20:15:28 +0000 (20:15 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Jun 2018 20:15:28 +0000 (20:15 +0000)
commitbb3b07736fcc9e636b23301479fa048f0ba57685
tree2621182216a4d5b0ab7faa91095052c3a57282f2
parent145b3fb25be4af0259df5f68733a0287a2b595e8
REGRESSION(macOS Mojave): move-by-word-visually-multi-line.html fails
https://bugs.webkit.org/show_bug.cgi?id=186454

Reviewed by Darin Adler.

Source/WebCore:

Like r232635, this patch fixes a selection test failure caused by the change in ICU's behavior in macOS Mojave,
which caused isWordTextBreak to return true in more cases.

In this particular failing test case, previousTextOrLineBreakBox and nextTextOrLineBreakBox were failing to find
an inline text box when it found an inline box for a BR, which was mentioned by an existing FIXME comment.
Consequently, visualWordPosition were erroneously detecting the end of a word followed by a blank line created by
a BR as a valid word boundary to move when the Windows editing behavior is enacted.

Addressed the FIXME comment by finding the next inline text box skipping all inline boxes for BRs. Renamed
misleadingly named previousBoxInDifferentBlock and nextBoxInDifferentBlock to previousBoxInDifferentLine and
nextBoxInDifferentLine respectively, and set them to true as they're really indicating whether line boxes
belong to a distinct line or not; whether an inline box belong to two (render) blocks or not is irrelevant.

Finally, this patch fixes a bug in visualWordPosition that it was failing to skip blank lines when a word break is
found as we traversed past a line break. In those cases, we must skip all line breaks before stopping.

Tests: editing/selection/move-by-word-visually-mac.html
       editing/selection/move-by-word-visually-multi-line.htm

* editing/VisibleUnits.cpp:
(WebCore::CachedLogicallyOrderedLeafBoxes::previousTextOrLineBreakBox):
(WebCore::CachedLogicallyOrderedLeafBoxes::nextTextOrLineBreakBox):
(WebCore::CachedLogicallyOrderedLeafBoxes::boxIndexInLeaves const):
(WebCore::logicallyPreviousBox):
(WebCore::logicallyNextBox):
(WebCore::wordBreakIteratorForMinOffsetBoundary):
(WebCore::wordBreakIteratorForMaxOffsetBoundary):
(WebCore::visualWordPosition):

LayoutTests:

Added a multi-line test case which causes a failure under Mac editing behavior. The test case is symmetric to ml_1.

* editing/selection/move-by-word-visually-mac-expected.txt:
* editing/selection/move-by-word-visually-mac.html:
* editing/selection/move-by-word-visually-multi-line-expected.txt:
* editing/selection/move-by-word-visually-multi-line.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232662 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/editing/selection/move-by-word-visually-mac-expected.txt
LayoutTests/editing/selection/move-by-word-visually-mac.html
LayoutTests/editing/selection/move-by-word-visually-multi-line-expected.txt
LayoutTests/editing/selection/move-by-word-visually-multi-line.html
Source/WebCore/ChangeLog
Source/WebCore/editing/VisibleUnits.cpp