| Index: Source/core/editing/VisiblePosition.cpp
|
| diff --git a/Source/core/editing/VisiblePosition.cpp b/Source/core/editing/VisiblePosition.cpp
|
| index 93d79238dccc54ed3d2b34131ffe316e6a5a8755..99957b97a8e06be264755c166b6a8f6d906a7023 100644
|
| --- a/Source/core/editing/VisiblePosition.cpp
|
| +++ b/Source/core/editing/VisiblePosition.cpp
|
| @@ -659,13 +659,17 @@ void VisiblePosition::init(const PositionAlgorithm<Strategy>& position, EAffinit
|
|
|
| UChar32 VisiblePosition::characterAfter() const
|
| {
|
| - // We canonicalize to the first of two equivalent candidates, but the second of the two candidates
|
| - // is the one that will be inside the text node containing the character after this visible position.
|
| + // We canonicalize to the first of two equivalent candidates, but the second
|
| + // of the two candidates is the one that will be inside the text node
|
| + // containing the character after this visible position.
|
| Position pos = m_deepPosition.downstream();
|
| - if (!pos.containerNode() || !pos.containerNode()->isTextNode() || !pos.isOffsetInAnchor())
|
| + if (!pos.isOffsetInAnchor())
|
| + return 0;
|
| + Node* containerNode = pos.containerNode();
|
| + if (!containerNode || !containerNode->isTextNode())
|
| return 0;
|
| unsigned offset = static_cast<unsigned>(pos.offsetInContainerNode());
|
| - Text* textNode = pos.containerText();
|
| + Text* textNode = toText(containerNode);
|
| unsigned length = textNode->length();
|
| if (offset >= length)
|
| return 0;
|
|
|