Chromium Code Reviews| 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_), |