TextManipulationController range of paragraph may be wrong after r262601
https://bugs.webkit.org/show_bug.cgi?id=212874
Reviewed by Wenson Hsieh.
Source/WebCore:
Start and end position of item are not properly set in r262601.
Test: TextManipulation.CompleteTextManipulationSuccedsWhenContentOutOfParagraphIsAdded
* editing/TextManipulationController.cpp:
(WebCore::TextManipulationController::addItemIfPossible):
Tools:
* TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm:
(TestWebKitAPI::TEST):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@262780 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/editing/TextManipulationController.cpp b/Source/WebCore/editing/TextManipulationController.cpp
index a2b2002..08479d1b 100644
--- a/Source/WebCore/editing/TextManipulationController.cpp
+++ b/Source/WebCore/editing/TextManipulationController.cpp
@@ -398,8 +398,9 @@
if (index == end)
return;
- auto startPosition = firstPositionInOrBeforeNode(units.first().node.ptr());
- auto endPosition = positionAfterNode(units.last().node.ptr());
+ ASSERT(end);
+ auto startPosition = firstPositionInOrBeforeNode(units[index].node.ptr());
+ auto endPosition = positionAfterNode(units[end - 1].node.ptr());
Vector<ManipulationToken> tokens;
for (; index < end; ++index)
tokens.appendVector(WTFMove(units[index].tokens));