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

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

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.h
diff --git a/third_party/WebKit/Source/core/editing/RelocatablePosition.h b/third_party/WebKit/Source/core/editing/RelocatablePosition.h
new file mode 100644
index 0000000000000000000000000000000000000000..f3692ded14cb9d5be409311a347f233261f93db8
--- /dev/null
+++ b/third_party/WebKit/Source/core/editing/RelocatablePosition.h
@@ -0,0 +1,34 @@
+// 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.
+
+#ifndef RelocatablePosition_h
+#define RelocatablePosition_h
+
+#include "core/dom/Range.h"
+
+namespace blink {
+
+// |RelocatablePosition| is a helper class for keeping track of a |Position| in
+// a document upon DOM changes even if the given |Position|'s anchor node is
+// moved out of document. The class is implemented by using a temporary |Range|
+// object to keep track of the |Position|, and disposing the |Range| when out
+// of scope.
+class RelocatablePosition final {
+public:
+ RelocatablePosition();
yosin_UTC9 2016/07/06 06:50:30 Do we really need default ctor? Since, |Relocatabl
+ explicit RelocatablePosition(const Position&);
+ ~RelocatablePosition();
+
+ Position position() const;
+
+private:
+ const Member<Range> m_range;
+
+ STACK_ALLOCATED();
yosin_UTC9 2016/07/06 06:50:30 nit: It seems |STACK_ALLOCATED()| usually at top.
+ DISALLOW_COPY_AND_ASSIGN(RelocatablePosition);
+};
+
+} // namespace blink
+
+#endif // RelocatablePosition_h

Powered by Google App Engine
This is Rietveld 408576698