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

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

Issue 2949763002: Introduce Position constructor with const Node& (Closed)
Patch Set: 2017-06-21T13:23:13 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 1627ec17ae4afb493c3dca4d6c69ec9f1fc7b029..13777618de2d1b135122fdda1ef209f4fc7d0a28 100644
--- a/third_party/WebKit/Source/core/editing/Position.cpp
+++ b/third_party/WebKit/Source/core/editing/Position.cpp
@@ -112,9 +112,13 @@ PositionTemplate<Strategy>::PositionTemplate(Node* anchor_node,
DCHECK_NE(anchor_type_, PositionAnchorType::kOffsetInAnchor);
}
+// TODO(editing-dev): Once we change type of |anchor_node_| to
+// |Member<const Node>|, we should get rid of |const_cast<Node*>()|.
+// See http://crbug.com/735327
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)),
offset_(offset),
anchor_type_(PositionAnchorType::kOffsetInAnchor) {
if (anchor_node_)
@@ -127,6 +131,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