OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef RelocatablePosition_h |
| 6 #define RelocatablePosition_h |
| 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "core/dom/Range.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 // |RelocatablePosition| is a helper class for keeping track of a |Position| in |
| 14 // a document upon DOM tree changes even if the given |Position|'s original |
| 15 // anchor node is moved out of document. The class is implemented by using a |
| 16 // temporary |Range| object to keep track of the |Position|, and disposing the |
| 17 // |Range| when out of scope. |
| 18 class CORE_EXPORT RelocatablePosition final { |
| 19 STACK_ALLOCATED(); |
| 20 public: |
| 21 explicit RelocatablePosition(const Position&); |
| 22 ~RelocatablePosition(); |
| 23 |
| 24 Position position() const; |
| 25 |
| 26 private: |
| 27 const Member<Range> m_range; |
| 28 |
| 29 DISALLOW_COPY_AND_ASSIGN(RelocatablePosition); |
| 30 }; |
| 31 |
| 32 } // namespace blink |
| 33 |
| 34 #endif // RelocatablePosition_h |
OLD | NEW |