charactersAroundPosition can be wrong because it crosses editing boundaries
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Aug 2016 21:11:55 +0000 (21:11 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Aug 2016 21:11:55 +0000 (21:11 +0000)
commitc7511cf0dbcf0bb2f0c8d980ab775caf951fd89d
tree95a291ccafb44604e4d02d28566e7d4314ef9e58
parent274b44eafda7ddaed8205172bb3484a9e37b5c2a
charactersAroundPosition can be wrong because it crosses editing boundaries
https://bugs.webkit.org/show_bug.cgi?id=161215
-and corresponding-
rdar://problem/27933564

Reviewed by Ryosuke Niwa.

Source/WebCore:

charactersAroundPosition() should not cross editing boundaries. This patch fixes
that by making nextCharacterBoundaryInDirection() take an
EditingBoundaryCrossingRule parameter to pass onto VisiblePosition::next() and
VisiblePosition::previous().

* editing/VisibleUnits.cpp:
(WebCore::nextCharacterBoundaryInDirection):
(WebCore::positionOfNextBoundaryOfGranularity):
(WebCore::charactersAroundPosition):

LayoutTests:

New test.
* editing/mac/spelling/accept-candidate-without-crossing-editing-boundary-expected.txt: Added.
* editing/mac/spelling/accept-candidate-without-crossing-editing-boundary.html: Added.

This test is going back to its pre-https://trac.webkit.org/changeset/195078 state.
That change caused this test to have a different layout because it caused more
layouts to happen. Now that we don’t allow the call to charactersAroundPosition()
to cross editing boundaries, those layouts don’t happen, and we have the old
behavior back.
* platform/mac/fast/dom/focus-contenteditable-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205044 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary-expected.txt [new file with mode: 0644]
LayoutTests/editing/mac/spelling/accept-candidate-without-crossing-editing-boundary.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/dom/focus-contenteditable-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/editing/VisibleUnits.cpp