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

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

Issue 1245843003: [CodeHealth] Use Position::anchorNode instead of deprecatedNode. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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/dom/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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // Returns a node as past last as same as |Range::pastLastNode()|. This 160 // Returns a node as past last as same as |Range::pastLastNode()|. This
161 // function is supposed to used in HTML serialization and plain text 161 // function is supposed to used in HTML serialization and plain text
162 // iterator. This position must be a |PositionAnchorType::OffsetInAhcor| to 162 // iterator. This position must be a |PositionAnchorType::OffsetInAhcor| to
163 // behave as |Range| boundary point. 163 // behave as |Range| boundary point.
164 Node* nodeAsRangePastLastNode() const; 164 Node* nodeAsRangePastLastNode() const;
165 165
166 Node* commonAncestorContainer(const PositionAlgorithm<Strategy>&) const; 166 Node* commonAncestorContainer(const PositionAlgorithm<Strategy>&) const;
167 167
168 Node* anchorNode() const { return m_anchorNode.get(); } 168 Node* anchorNode() const { return m_anchorNode.get(); }
169 169
170 // FIXME: Callers should be moved off of node(), node() is not always the co ntainer for this position.
171 // For nodes which editingIgnoresContent(node()) returns true, positions lik e [ignoredNode, 0]
172 // will be treated as before ignoredNode (thus node() is really after the po sition, not containing it).
173 Node* deprecatedNode() const { return m_anchorNode.get(); }
174
175 Document* document() const { return m_anchorNode ? &m_anchorNode->document() : 0; } 170 Document* document() const { return m_anchorNode ? &m_anchorNode->document() : 0; }
176 bool inDocument() const { return m_anchorNode && m_anchorNode->inDocument(); } 171 bool inDocument() const { return m_anchorNode && m_anchorNode->inDocument(); }
177 Element* rootEditableElement() const 172 Element* rootEditableElement() const
178 { 173 {
179 Node* container = containerNode(); 174 Node* container = containerNode();
180 return container ? container->rootEditableElement() : 0; 175 return container ? container->rootEditableElement() : 0;
181 } 176 }
182 177
183 // These should only be used for PositionAnchorType::OffsetInAnchor 178 // These should only be used for PositionAnchorType::OffsetInAnchor
184 // positions, unless the position is a legacy editing position. 179 // positions, unless the position is a legacy editing position.
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 480
486 } // namespace blink 481 } // namespace blink
487 482
488 #ifndef NDEBUG 483 #ifndef NDEBUG
489 // Outside the WebCore namespace for ease of invocation from gdb. 484 // Outside the WebCore namespace for ease of invocation from gdb.
490 void showTree(const blink::Position&); 485 void showTree(const blink::Position&);
491 void showTree(const blink::Position*); 486 void showTree(const blink::Position*);
492 #endif 487 #endif
493 488
494 #endif // Position_h 489 #endif // Position_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/Position.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698