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

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

Issue 2127503002: Use RelocatablePosition in CompositeEditCommand::moveParagraphs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use RelocatablePosition 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..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

Powered by Google App Engine
This is Rietveld 408576698