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

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

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.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..fc19416d213765fc6b7b97b174389cf3b8983392
--- /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/CoreExport.h"
+#include "core/dom/Range.h"
+
+namespace blink {
+
+// |RelocatablePosition| is a helper class for keeping track of a |Position| in
+// a document upon DOM tree changes even if the given |Position|'s original
+// 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 CORE_EXPORT RelocatablePosition final {
+ STACK_ALLOCATED();
+public:
+ explicit RelocatablePosition(const Position&);
+ ~RelocatablePosition();
+
+ Position position() const;
+
+private:
+ const Member<Range> m_range;
+
+ DISALLOW_COPY_AND_ASSIGN(RelocatablePosition);
+};
+
+} // namespace blink
+
+#endif // RelocatablePosition_h
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/editing/RelocatablePosition.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698