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

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

Issue 171773008: Rename childNodeCount() / childNode() methods for clarity (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Further renaming for consistency Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Node.idl ('k') | 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 267 }
268 268
269 inline Position positionAfterNode(Node* anchorNode) 269 inline Position positionAfterNode(Node* anchorNode)
270 { 270 {
271 ASSERT(anchorNode); 271 ASSERT(anchorNode);
272 return Position(anchorNode, Position::PositionIsAfterAnchor); 272 return Position(anchorNode, Position::PositionIsAfterAnchor);
273 } 273 }
274 274
275 inline int lastOffsetInNode(Node* node) 275 inline int lastOffsetInNode(Node* node)
276 { 276 {
277 return node->offsetInCharacters() ? node->maxCharacterOffset() : static_cast <int>(node->childNodeCount()); 277 return node->offsetInCharacters() ? node->maxCharacterOffset() : static_cast <int>(node->countChildren());
278 } 278 }
279 279
280 // firstPositionInNode and lastPositionInNode return parent-anchored positions, lastPositionInNode construction is O(n) due to childNodeCount() 280 // firstPositionInNode and lastPositionInNode return parent-anchored positions, lastPositionInNode construction is O(n) due to countChildren()
281 inline Position firstPositionInNode(Node* anchorNode) 281 inline Position firstPositionInNode(Node* anchorNode)
282 { 282 {
283 if (anchorNode->isTextNode()) 283 if (anchorNode->isTextNode())
284 return Position(anchorNode, 0, Position::PositionIsOffsetInAnchor); 284 return Position(anchorNode, 0, Position::PositionIsOffsetInAnchor);
285 return Position(anchorNode, Position::PositionIsBeforeChildren); 285 return Position(anchorNode, Position::PositionIsBeforeChildren);
286 } 286 }
287 287
288 inline Position lastPositionInNode(Node* anchorNode) 288 inline Position lastPositionInNode(Node* anchorNode)
289 { 289 {
290 if (anchorNode->isTextNode()) 290 if (anchorNode->isTextNode())
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 340
341 } // namespace WebCore 341 } // namespace WebCore
342 342
343 #ifndef NDEBUG 343 #ifndef NDEBUG
344 // Outside the WebCore namespace for ease of invocation from gdb. 344 // Outside the WebCore namespace for ease of invocation from gdb.
345 void showTree(const WebCore::Position&); 345 void showTree(const WebCore::Position&);
346 void showTree(const WebCore::Position*); 346 void showTree(const WebCore::Position*);
347 #endif 347 #endif
348 348
349 #endif // Position_h 349 #endif // Position_h
OLDNEW
« no previous file with comments | « Source/core/dom/Node.idl ('k') | Source/core/dom/Position.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698