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

Side by Side Diff: third_party/WebKit/Source/core/editing/Position.h

Issue 2950053002: Make Position::BeforeNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-21T17:56:36 Created 3 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 PositionTemplate() 60 PositionTemplate()
61 : offset_(0), anchor_type_(PositionAnchorType::kOffsetInAnchor) {} 61 : offset_(0), anchor_type_(PositionAnchorType::kOffsetInAnchor) {}
62 62
63 static const TreeScope* CommonAncestorTreeScope( 63 static const TreeScope* CommonAncestorTreeScope(
64 const PositionTemplate<Strategy>&, 64 const PositionTemplate<Strategy>&,
65 const PositionTemplate<Strategy>& b); 65 const PositionTemplate<Strategy>& b);
66 static PositionTemplate<Strategy> EditingPositionOf(Node* anchor_node, 66 static PositionTemplate<Strategy> EditingPositionOf(Node* anchor_node,
67 int offset); 67 int offset);
68 68
69 // For creating before/after positions: 69 // For creating before/after positions:
70 PositionTemplate(Node* anchor_node, PositionAnchorType); 70 PositionTemplate(const Node* anchor_node, PositionAnchorType);
71 71
72 // For creating offset positions: 72 // For creating offset positions:
73 PositionTemplate(const Node& anchor_node, int offset); 73 PositionTemplate(const Node& anchor_node, int offset);
74 // TODO(editing-dev): We should not pass |nullptr| as |anchor_node| for 74 // TODO(editing-dev): We should not pass |nullptr| as |anchor_node| for
75 // |Position| constructor. 75 // |Position| constructor.
76 // TODO(editing-dev): This constructor should eventually go away. See bug 76 // TODO(editing-dev): This constructor should eventually go away. See bug
77 // http://wkb.ug/63040. 77 // http://wkb.ug/63040.
78 PositionTemplate(const Node* anchor_node, int offset); 78 PositionTemplate(const Node* anchor_node, int offset);
79 79
80 PositionTemplate(const PositionTemplate&); 80 PositionTemplate(const PositionTemplate&);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 // These can be either inside or just before/after the node, depending on 182 // These can be either inside or just before/after the node, depending on
183 // if the node is ignored by editing or not. 183 // if the node is ignored by editing or not.
184 // FIXME: These should go away. They only make sense for legacy positions. 184 // FIXME: These should go away. They only make sense for legacy positions.
185 bool AtFirstEditingPositionForNode() const; 185 bool AtFirstEditingPositionForNode() const;
186 bool AtLastEditingPositionForNode() const; 186 bool AtLastEditingPositionForNode() const;
187 187
188 bool AtStartOfTree() const; 188 bool AtStartOfTree() const;
189 bool AtEndOfTree() const; 189 bool AtEndOfTree() const;
190 190
191 static PositionTemplate<Strategy> BeforeNode(Node* anchor_node); 191 static PositionTemplate<Strategy> BeforeNode(const Node& anchor_node);
192 static PositionTemplate<Strategy> AfterNode(Node* anchor_node); 192 static PositionTemplate<Strategy> AfterNode(Node* anchor_node);
193 static PositionTemplate<Strategy> InParentBeforeNode(const Node& anchor_node); 193 static PositionTemplate<Strategy> InParentBeforeNode(const Node& anchor_node);
194 static PositionTemplate<Strategy> InParentAfterNode(const Node& anchor_node); 194 static PositionTemplate<Strategy> InParentAfterNode(const Node& anchor_node);
195 static int LastOffsetInNode(Node* anchor_node); 195 static int LastOffsetInNode(Node* anchor_node);
196 static PositionTemplate<Strategy> FirstPositionInNode(Node* anchor_node); 196 static PositionTemplate<Strategy> FirstPositionInNode(Node* anchor_node);
197 static PositionTemplate<Strategy> LastPositionInNode(Node* anchor_node); 197 static PositionTemplate<Strategy> LastPositionInNode(Node* anchor_node);
198 static PositionTemplate<Strategy> FirstPositionInOrBeforeNode( 198 static PositionTemplate<Strategy> FirstPositionInOrBeforeNode(
199 Node* anchor_node); 199 Node* anchor_node);
200 static PositionTemplate<Strategy> LastPositionInOrAfterNode( 200 static PositionTemplate<Strategy> LastPositionInOrAfterNode(
201 Node* anchor_node); 201 Node* anchor_node);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 } // namespace blink 284 } // namespace blink
285 285
286 #ifndef NDEBUG 286 #ifndef NDEBUG
287 // Outside the WebCore namespace for ease of invocation from gdb. 287 // Outside the WebCore namespace for ease of invocation from gdb.
288 void showTree(const blink::Position&); 288 void showTree(const blink::Position&);
289 void showTree(const blink::Position*); 289 void showTree(const blink::Position*);
290 #endif 290 #endif
291 291
292 #endif // Position_h 292 #endif // Position_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp ('k') | third_party/WebKit/Source/core/editing/Position.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698