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

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

Issue 2123893002: Introduce class RelocatablePosition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add CORE_EXPORT Created 4 years, 5 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/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..1751cf3d6afaace89552f024284ef5bcd965f728
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/RelocatablePosition.cpp
@@ -0,0 +1,29 @@
+// 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(const Position& position)
+ : m_range(position.isNotNull() ? Range::create(*position.document(), position, position) : nullptr)
+{
+}
+
+RelocatablePosition::~RelocatablePosition()
+{
+ if (!m_range)
+ return;
+ m_range->dispose();
+}
+
+Position RelocatablePosition::position() const
+{
+ if (!m_range)
+ return Position();
+ DCHECK(m_range->collapsed());
+ return m_range->startPosition();
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698