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

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

Issue 1287053007: Move rootUserSelectAllForNode() to EditingStrategy template class from PositionAlgorithm template cl (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-20T17:38:38 Created 5 years, 4 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 | « Source/core/editing/EditingStrategy.h ('k') | Source/core/editing/FrameSelection.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 #include "config.h" 5 #include "config.h"
6 #include "core/editing/EditingStrategy.h" 6 #include "core/editing/EditingStrategy.h"
7 7
8 #include "core/editing/EditingUtilities.h" 8 #include "core/editing/EditingUtilities.h"
9 #include "core/layout/LayoutObject.h" 9 #include "core/layout/LayoutObject.h"
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 if (!editingIgnoresContent(node)) 60 if (!editingIgnoresContent(node))
61 return 0; 61 return 0;
62 62
63 // editingIgnoresContent uses the same logic in 63 // editingIgnoresContent uses the same logic in
64 // isEmptyNonEditableNodeInEditable (EditingUtilities.cpp). We don't 64 // isEmptyNonEditableNodeInEditable (EditingUtilities.cpp). We don't
65 // understand why this function returns 1 even when the node doesn't have 65 // understand why this function returns 1 even when the node doesn't have
66 // children. 66 // children.
67 return 1; 67 return 1;
68 } 68 }
69 69
70 template <typename Strategy>
71 Node* EditingAlgorithm<Strategy>::rootUserSelectAllForNode(Node* node)
72 {
73 if (!node || !nodeIsUserSelectAll(node))
74 return nullptr;
75 Node* parent = Strategy::parent(*node);
76 if (!parent)
77 return node;
78
79 Node* candidateRoot = node;
80 while (parent) {
81 if (!parent->layoutObject()) {
82 parent = Strategy::parent(*parent);
83 continue;
84 }
85 if (!nodeIsUserSelectAll(parent))
86 break;
87 candidateRoot = parent;
88 parent = Strategy::parent(*candidateRoot);
89 }
90 return candidateRoot;
91 }
92
70 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<NodeTraversal>; 93 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<NodeTraversal>;
71 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<ComposedTreeTraversal>; 94 template class CORE_TEMPLATE_EXPORT EditingAlgorithm<ComposedTreeTraversal>;
72 95
73 } // namespace blink 96 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/EditingStrategy.h ('k') | Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698