Index: third_party/WebKit/Source/core/editing/RelocatablePosition.cpp |
diff --git a/third_party/WebKit/Source/core/editing/RelocatablePosition.cpp b/third_party/WebKit/Source/core/editing/RelocatablePosition.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d19526231d1e1b4fb78df792f1ffa40e462c84e8 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/editing/RelocatablePosition.cpp |
@@ -0,0 +1,33 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "core/editing/RelocatablePosition.h" |
+ |
+namespace blink { |
+ |
+RelocatablePosition::RelocatablePosition() |
+ : m_range(nullptr) |
yosin_UTC9
2016/07/06 06:50:30
You don't need to initialize |Member<Range>|
|
+{ |
+} |
+ |
+RelocatablePosition::RelocatablePosition(const Position& position) |
+ : m_range(position.isNotNull() ? Range::create(*position.document(), position, position) : nullptr) |
+{ |
+} |
+ |
+RelocatablePosition::~RelocatablePosition() |
+{ |
+ if (m_range) |
yosin_UTC9
2016/07/06 06:50:30
We prefer early-return style.
|
+ m_range->dispose(); |
+} |
+ |
+Position RelocatablePosition::position() const |
+{ |
+ if (!m_range) |
+ return Position(); |
+ DCHECK(m_range->collapsed()); |
+ return m_range->startPosition(); |
+} |
+ |
+} // namespace blink |