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

Unified Diff: third_party/WebKit/Source/core/editing/Position.cpp

Issue 2296863003: Update PositionTemplate::toAnchorTypeAndOffsetString(). (Closed)
Patch Set: Created 4 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 | « third_party/WebKit/Source/core/editing/Position.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/Position.cpp
diff --git a/third_party/WebKit/Source/core/editing/Position.cpp b/third_party/WebKit/Source/core/editing/Position.cpp
index c7c0a81a8ab1bffa7da96ed81d3d66e83049917d..18a9f303973b34d818b0702c5ec2ceab6ddfabf0 100644
--- a/third_party/WebKit/Source/core/editing/Position.cpp
+++ b/third_party/WebKit/Source/core/editing/Position.cpp
@@ -574,34 +574,32 @@ Position toPositionInDOMTree(const PositionInFlatTree& position)
}
}
-#ifndef NDEBUG
-
template <typename Strategy>
String PositionTemplate<Strategy>::toAnchorTypeAndOffsetString() const
{
- StringBuilder builder;
switch (anchorType()) {
- case PositionAnchorType::OffsetInAnchor:
- builder.append("offset");
- break;
+ case PositionAnchorType::OffsetInAnchor: {
+ StringBuilder builder;
+ builder.append("offsetInAnchor[");
+ builder.append(m_offset);
+ builder.append("]");
+ return builder.toString();
+ }
case PositionAnchorType::BeforeChildren:
- builder.append("beforeChildren");
- break;
+ return "beforeChildren";
case PositionAnchorType::AfterChildren:
- builder.append("afterChildren");
- break;
+ return "afterChildren";
case PositionAnchorType::BeforeAnchor:
- builder.append("before");
- break;
+ return "beforeAnchor";
case PositionAnchorType::AfterAnchor:
- builder.append("after");
- break;
+ return "afterAnchor";
}
- builder.append(", offset:");
- builder.append(m_offset);
- return builder.toString();
+ NOTREACHED();
+ return emptyString();
}
+#ifndef NDEBUG
+
template <typename Strategy>
void PositionTemplate<Strategy>::showTreeForThis() const
{
@@ -629,10 +627,7 @@ static std::ostream& printPosition(std::ostream& ostream, const PositionType& po
{
if (position.isNull())
return ostream << "null";
- ostream << position.anchorNode() << "@";
- if (position.isOffsetInAnchor())
- return ostream << position.offsetInContainerNode();
- return ostream << position.anchorType();
+ return ostream << position.anchorNode() << "@" << position.toAnchorTypeAndOffsetString().utf8().data();
}
std::ostream& operator<<(std::ostream& ostream, PositionAnchorType anchorType)
« no previous file with comments | « third_party/WebKit/Source/core/editing/Position.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698