Chromium Code Reviews| 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 |