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

Unified Diff: Source/core/editing/serializers/StyledMarkupSerializer.cpp

Issue 1310043003: Introduce previousPositionOf() for VisiblePosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-28T16:28:03 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 | « Source/core/editing/commands/TypingCommand.cpp ('k') | Source/core/editing/spellcheck/SpellChecker.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/serializers/StyledMarkupSerializer.cpp
diff --git a/Source/core/editing/serializers/StyledMarkupSerializer.cpp b/Source/core/editing/serializers/StyledMarkupSerializer.cpp
index 86205e83a8334c968a8a7bb404feaa556c3519dd..23a3a5591590e51159fa52ea6152d26f8aa9882c 100644
--- a/Source/core/editing/serializers/StyledMarkupSerializer.cpp
+++ b/Source/core/editing/serializers/StyledMarkupSerializer.cpp
@@ -145,9 +145,9 @@ static bool needInterchangeNewlineAfter(const VisiblePosition& v)
static bool needInterchangeNewlineAt(const VisiblePosition& v)
{
- // FIXME: |v.previous()| works on a DOM tree. We need to fix this to work on
- // a composed tree.
- return needInterchangeNewlineAfter(v.previous());
+ // TODO(yosin) |previousPositionOf(v)| works on a DOM tree. We need to fix
+ // this to work on a composed tree.
+ return needInterchangeNewlineAfter(previousPositionOf(v));
}
template<typename Strategy>
@@ -179,7 +179,7 @@ String StyledMarkupSerializer<Strategy>::createMarkup()
VisiblePosition visibleEnd(m_end);
if (shouldAnnotate() && needInterchangeNewlineAfter(visibleStart)) {
markupAccumulator.appendInterchangeNewline();
- if (visibleStart.deepEquivalent() == visibleEnd.previous().deepEquivalent())
+ if (visibleStart.deepEquivalent() == previousPositionOf(visibleEnd).deepEquivalent())
return markupAccumulator.takeResults();
firstNode = visibleStart.next().deepEquivalent().anchorNode();
« no previous file with comments | « Source/core/editing/commands/TypingCommand.cpp ('k') | Source/core/editing/spellcheck/SpellChecker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698