| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EditingStrategy_h | 5 #ifndef EditingStrategy_h |
| 6 #define EditingStrategy_h | 6 #define EditingStrategy_h |
| 7 | 7 |
| 8 #include "core/dom/NodeTraversal.h" | 8 #include "core/dom/NodeTraversal.h" |
| 9 #include "core/dom/shadow/ComposedTreeTraversal.h" | 9 #include "core/dom/shadow/ComposedTreeTraversal.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 template <typename Strategy> | 13 template <typename Strategy> |
| 14 class PositionAlgorithm; | 14 class PositionAlgorithm; |
| 15 | 15 |
| 16 template <typename Strategy> | 16 template <typename Strategy> |
| 17 class PositionIteratorAlgorithm; | 17 class PositionIteratorAlgorithm; |
| 18 | 18 |
| 19 class EditingStrategy : public NodeTraversal { | 19 // Editing algorithm defined on node traversal. |
| 20 template <typename Traversal> |
| 21 class EditingAlgorithm : public Traversal { |
| 20 public: | 22 public: |
| 21 using PositionType = PositionAlgorithm<EditingStrategy>; | |
| 22 using PositionIteratorType = PositionIteratorAlgorithm<EditingStrategy>; | |
| 23 | |
| 24 // |disconnected| is optional output parameter having true if specified | 23 // |disconnected| is optional output parameter having true if specified |
| 25 // positions don't have common ancestor. | 24 // positions don't have common ancestor. |
| 26 static short comparePositions(Node* containerA, int offsetA, Node* container
B, int offsetB, bool* disconnected = nullptr); | 25 static short comparePositions(Node* containerA, int offsetA, Node* container
B, int offsetB, bool* disconnected = nullptr); |
| 26 static bool isEmptyNonEditableNodeInEditable(const Node*); |
| 27 static bool editingIgnoresContent(const Node*); | 27 static bool editingIgnoresContent(const Node*); |
| 28 static int lastOffsetForEditing(const Node*); | 28 static int lastOffsetForEditing(const Node*); |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 // DOM tree version of editing algorithm |
| 32 class EditingStrategy : public EditingAlgorithm<NodeTraversal> { |
| 33 public: |
| 34 using PositionIteratorType = PositionIteratorAlgorithm<EditingStrategy>; |
| 35 using PositionType = PositionAlgorithm<EditingStrategy>; |
| 36 }; |
| 37 |
| 38 extern template class EditingAlgorithm<NodeTraversal>; |
| 39 |
| 31 } // namespace blink | 40 } // namespace blink |
| 32 | 41 |
| 33 #endif // EditingStrategy_h | 42 #endif // EditingStrategy_h |
| OLD | NEW |