Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Unified Diff: Source/core/editing/VisiblePosition.cpp

Issue 1259243007: Make VisiblePosition::characterAfter() not to use Position::containerText() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-04T10:45:01 Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698