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

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

Issue 2949763002: Introduce Position constructor with const Node& (Closed)
Patch Set: 2017-06-20T13:43:23 Created 3 years, 6 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
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 eab61e4ba6df3f245d5175760b3664b13d1dca26..4e4e69fedc9fb1acf33d7f80b3e6fead711ea22e 100644
--- a/third_party/WebKit/Source/core/editing/Position.cpp
+++ b/third_party/WebKit/Source/core/editing/Position.cpp
@@ -113,8 +113,9 @@ PositionTemplate<Strategy>::PositionTemplate(Node* anchor_node,
}
template <typename Strategy>
-PositionTemplate<Strategy>::PositionTemplate(Node* anchor_node, int offset)
- : anchor_node_(anchor_node),
+PositionTemplate<Strategy>::PositionTemplate(const Node* anchor_node,
+ int offset)
+ : anchor_node_(const_cast<Node*>(anchor_node)),
Xiaocheng 2017/06/20 17:58:10 I'm not a fan of this... It makes code less intuit
yosin_UTC9 2017/06/21 04:27:02 Discuss offline. We agree on |Position| is constan
offset_(offset),
anchor_type_(PositionAnchorType::kOffsetInAnchor) {
if (anchor_node_)
@@ -127,6 +128,11 @@ PositionTemplate<Strategy>::PositionTemplate(Node* anchor_node, int offset)
}
template <typename Strategy>
+PositionTemplate<Strategy>::PositionTemplate(const Node& anchor_node,
+ int offset)
+ : PositionTemplate(&anchor_node, offset) {}
+
+template <typename Strategy>
PositionTemplate<Strategy>::PositionTemplate(const PositionTemplate& other)
: anchor_node_(other.anchor_node_),
offset_(other.offset_),
« no previous file with comments | « third_party/WebKit/Source/core/editing/Position.h ('k') | third_party/WebKit/Source/core/editing/SelectionEditor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698