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

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

Issue 1298233004: Move a member function parentEditingBoundary() out from PositionAlgorithm<Strategy> template class (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T22:31:05 Rebase 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 | « no previous file | Source/core/editing/Position.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 /* 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 static int uncheckedNextOffset(const Node*, int current); 175 static int uncheckedNextOffset(const Node*, int current);
176 176
177 int compareTo(const PositionAlgorithm<Strategy>&) const; 177 int compareTo(const PositionAlgorithm<Strategy>&) const;
178 178
179 // These can be either inside or just before/after the node, depending on 179 // These can be either inside or just before/after the node, depending on
180 // if the node is ignored by editing or not. 180 // if the node is ignored by editing or not.
181 // FIXME: These should go away. They only make sense for legacy positions. 181 // FIXME: These should go away. They only make sense for legacy positions.
182 bool atFirstEditingPositionForNode() const; 182 bool atFirstEditingPositionForNode() const;
183 bool atLastEditingPositionForNode() const; 183 bool atLastEditingPositionForNode() const;
184 184
185 Node* parentEditingBoundary() const;
186
187 bool atStartOfTree() const; 185 bool atStartOfTree() const;
188 bool atEndOfTree() const; 186 bool atEndOfTree() const;
189 187
190 // These return useful visually equivalent positions. 188 // These return useful visually equivalent positions.
191 PositionAlgorithm<Strategy> upstream(EditingBoundaryCrossingRule = CannotCro ssEditingBoundary) const; 189 PositionAlgorithm<Strategy> upstream(EditingBoundaryCrossingRule = CannotCro ssEditingBoundary) const;
192 PositionAlgorithm<Strategy> downstream(EditingBoundaryCrossingRule = CannotC rossEditingBoundary) const; 190 PositionAlgorithm<Strategy> downstream(EditingBoundaryCrossingRule = CannotC rossEditingBoundary) const;
193 191
194 bool isCandidate() const; 192 bool isCandidate() const;
195 bool inRenderedText() const; 193 bool inRenderedText() const;
196 194
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 243
246 using Position = PositionAlgorithm<EditingStrategy>; 244 using Position = PositionAlgorithm<EditingStrategy>;
247 using PositionInComposedTree = PositionAlgorithm<EditingInComposedTreeStrategy>; 245 using PositionInComposedTree = PositionAlgorithm<EditingInComposedTreeStrategy>;
248 246
249 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should use 247 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should use
250 // |VisiblePosition::characterAfter()| and |VisiblePosition::characterBefore()|. 248 // |VisiblePosition::characterAfter()| and |VisiblePosition::characterBefore()|.
251 // TODO(yosin) We should move |isRenderedCharacter()| to "VisibleUnits.cpp", 249 // TODO(yosin) We should move |isRenderedCharacter()| to "VisibleUnits.cpp",
252 // since it is used only in "editing/commands/" 250 // since it is used only in "editing/commands/"
253 CORE_EXPORT bool isRenderedCharacter(const Position&); 251 CORE_EXPORT bool isRenderedCharacter(const Position&);
254 252
253 // TODO(yosin) We should make |parentEditingBoundary()| as static function
254 // in "VisibleUnits.cpp", since it is used only there.
255 CORE_EXPORT Node* parentEditingBoundary(const Position&);
256 CORE_EXPORT Node* parentEditingBoundary(const PositionInComposedTree&);
257
255 template <typename Strategy> 258 template <typename Strategy>
256 bool operator==(const PositionAlgorithm<Strategy>& a, const PositionAlgorithm<St rategy>& b) 259 bool operator==(const PositionAlgorithm<Strategy>& a, const PositionAlgorithm<St rategy>& b)
257 { 260 {
258 if (a.isNull()) 261 if (a.isNull())
259 return b.isNull(); 262 return b.isNull();
260 263
261 if (a.anchorNode() != b.anchorNode() || a.anchorType() != b.anchorType()) 264 if (a.anchorNode() != b.anchorNode() || a.anchorType() != b.anchorType())
262 return false; 265 return false;
263 266
264 if (!a.isOffsetInAnchor()) { 267 if (!a.isOffsetInAnchor()) {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 447
445 } // namespace blink 448 } // namespace blink
446 449
447 #ifndef NDEBUG 450 #ifndef NDEBUG
448 // Outside the WebCore namespace for ease of invocation from gdb. 451 // Outside the WebCore namespace for ease of invocation from gdb.
449 void showTree(const blink::Position&); 452 void showTree(const blink::Position&);
450 void showTree(const blink::Position*); 453 void showTree(const blink::Position*);
451 #endif 454 #endif
452 455
453 #endif // Position_h 456 #endif // Position_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/Position.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698