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

Side by Side Diff: Source/core/editing/EditingStrategy.h

Issue 1085163002: Introduce EditingAlgorithm<Traversal> class (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-04-15T16:50:42 Rebase for Position.h updates Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/editing/EditingStrategy.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/EditingStrategy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698