Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Using ICU break iterator to simplify visual word movement implementat…
…ion. https://bugs.webkit.org/show_bug.cgi?id=78856 Reviewed by Ryosuke Niwa. Source/WebCore: This patch relies on ICU word break iterator and cursor visual movement by character to get the word break position in visual order. It reduces the complexity of old implementation. Test: editing/selection/move-by-word-visually-wrong-left-right.html * editing/FrameSelection.cpp: Exclude WinCE from visual word movement since isWordTextBreak is not implemented. (WebCore::FrameSelection::modifyMovingRight): (WebCore::FrameSelection::modifyMovingLeft): * editing/visible_units.cpp: (WebCore): (WebCore::previousLeafWithSameEditability): Just moving to the top without functionality change. (WebCore::enclosingNodeWithNonInlineRenderer): ditto. (WebCore::nextLeafWithSameEditability): ditto. (WebCore::previousRootInlineBox): return previous RootInlineBox which is in different renderer. (WebCore::nextRootInlineBox): return next RootInlineBox which is in different renderer. (WebCore::boxIndexInVector): (WebCore::previousBoxInLine): returns logically previous box in one line. (WebCore::logicallyPreviousBox): returns logically previous box. (WebCore::nextBoxInLine): returns logically next box in one line. (WebCore::logicallyNextBox): returns logically next box. (WebCore::wordBreakIteratorForMinOffsetBoundary): create word break iterator for position that is a box's min offset. (WebCore::wordBreakIteratorForMaxOffsetBoundary): create word break iterator for position that is a box's max offset. (WebCore::isLogicalStartOfWord): return whether a position is logically start of word. (WebCore::islogicalEndOfWord): return whether a position is logically end of word. (WebCore::visualWordPosition): returns the visual left or right word position. (WebCore::leftWordPosition): (WebCore::rightWordPosition): * platform/text/TextBreakIterator.h: Add isWordTextBreak(). (WebCore): * platform/text/TextBreakIteratorICU.cpp: (WebCore::isWordTextBreak): (WebCore): * platform/text/gtk/TextBreakIteratorGtk.cpp: (WebCore::isWordTextBreak): (WebCore): * platform/text/qt/TextBreakIteratorQt.cpp: (WebCore::isWordTextBreak): (WebCore): * platform/text/wince/TextBreakIteratorWinCE.cpp: (WebCore::isWordTextBreak): (WebCore): LayoutTests: * editing/selection/move-by-word-visually-inline-block-positioned-element-expected.txt: * editing/selection/move-by-word-visually-inline-block-positioned-element.html: The word break stops at the beginning of fixed positioned element, which is correct and consistent behavior. * editing/selection/move-by-word-visually-multi-line-expected.txt: * editing/selection/move-by-word-visually-multi-line.html: The word break does not stop at the end of a text if there is next line of text available under the same editable root, which is a consistent behavior cross the board. Add more test cases, including one with non InlineTextBox. * editing/selection/move-by-word-visually-single-space-inline-element-expected.txt: Fixing of previously missing or extra word break positions. * editing/selection/move-by-word-visually-single-space-one-element-expected.txt: * editing/selection/move-by-word-visually-single-space-one-element.html: Add a test case including bidi control character which renders wrong result since right-arrow could not reach a position which is the word break position. Add another test case containing non InlineTextBox. * editing/selection/move-by-word-visually-wrong-left-right-expected.txt: Added. * editing/selection/move-by-word-visually-wrong-left-right.html: Added. Add a test case which renders wrong result due to left/right-arrow returns wrong result. * editing/selection/resources/move-by-word-visually.js: (moveByWordOnEveryChar): Handle a special case when left/right arrow missing certain position. Canonical link: https://commits.webkit.org/98524@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@110965 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
613 additions
and 680 deletions.
- +33 −0 LayoutTests/ChangeLog
- +11 −11 LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element-expected.txt
- +11 −11 LayoutTests/editing/selection/move-by-word-visually-inline-block-positioned-element.html
- +22 −12 LayoutTests/editing/selection/move-by-word-visually-multi-line-expected.txt
- +9 −3 LayoutTests/editing/selection/move-by-word-visually-multi-line.html
- +12 −53 LayoutTests/editing/selection/move-by-word-visually-single-space-inline-element-expected.txt
- +15 −0 LayoutTests/editing/selection/move-by-word-visually-single-space-one-element-expected.txt
- +6 −0 LayoutTests/editing/selection/move-by-word-visually-single-space-one-element.html
- +2 −0 LayoutTests/editing/selection/move-by-word-visually-wrong-left-right-expected.txt
- +36 −0 LayoutTests/editing/selection/move-by-word-visually-wrong-left-right.html
- +11 −1 LayoutTests/editing/selection/resources/move-by-word-visually.js
- +49 −0 Source/WebCore/ChangeLog
- +5 −0 Source/WebCore/editing/FrameSelection.cpp
- +369 −589 Source/WebCore/editing/visible_units.cpp
- +1 −0 Source/WebCore/platform/text/TextBreakIterator.h
- +6 −0 Source/WebCore/platform/text/TextBreakIteratorICU.cpp
- +5 −0 Source/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp
- +5 −0 Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp
- +5 −0 Source/WebCore/platform/text/wince/TextBreakIteratorWinCE.cpp
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.