| OLD | NEW |
| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 return PositionTemplate<Strategy>(Strategy::parent(node), Strategy::index(no
de)); | 246 return PositionTemplate<Strategy>(Strategy::parent(node), Strategy::index(no
de)); |
| 247 } | 247 } |
| 248 | 248 |
| 249 template <typename Strategy> | 249 template <typename Strategy> |
| 250 PositionTemplate<Strategy> PositionTemplate<Strategy>::inParentAfterNode(const N
ode& node) | 250 PositionTemplate<Strategy> PositionTemplate<Strategy>::inParentAfterNode(const N
ode& node) |
| 251 { | 251 { |
| 252 DCHECK(node.parentNode()) << node; | 252 DCHECK(node.parentNode()) << node; |
| 253 return PositionTemplate<Strategy>(Strategy::parent(node), Strategy::index(no
de) + 1); | 253 return PositionTemplate<Strategy>(Strategy::parent(node), Strategy::index(no
de) + 1); |
| 254 } | 254 } |
| 255 | 255 |
| 256 // positionBeforeNode and Position::afterNode return neighbor-anchored positions
, | 256 // |Position::beforeNode()| and |Position::afterNode()| return neighbor-anchored |
| 257 // construction is O(1) | 257 // positions, construction is O(1) |
| 258 template <typename Strategy> | 258 template <typename Strategy> |
| 259 PositionTemplate<Strategy> PositionTemplate<Strategy>::beforeNode(Node* anchorNo
de) | 259 PositionTemplate<Strategy> PositionTemplate<Strategy>::beforeNode(Node* anchorNo
de) |
| 260 { | 260 { |
| 261 DCHECK(anchorNode); | 261 DCHECK(anchorNode); |
| 262 return PositionTemplate<Strategy>(anchorNode, PositionAnchorType::BeforeAnch
or); | 262 return PositionTemplate<Strategy>(anchorNode, PositionAnchorType::BeforeAnch
or); |
| 263 } | 263 } |
| 264 | 264 |
| 265 inline Position positionBeforeNode(Node* anchorNode) | |
| 266 { | |
| 267 return Position::beforeNode(anchorNode); | |
| 268 } | |
| 269 | |
| 270 template <typename Strategy> | 265 template <typename Strategy> |
| 271 PositionTemplate<Strategy> PositionTemplate<Strategy>::afterNode(Node* anchorNod
e) | 266 PositionTemplate<Strategy> PositionTemplate<Strategy>::afterNode(Node* anchorNod
e) |
| 272 { | 267 { |
| 273 DCHECK(anchorNode); | 268 DCHECK(anchorNode); |
| 274 return PositionTemplate<Strategy>(anchorNode, PositionAnchorType::AfterAncho
r); | 269 return PositionTemplate<Strategy>(anchorNode, PositionAnchorType::AfterAncho
r); |
| 275 } | 270 } |
| 276 | 271 |
| 277 template <typename Strategy> | 272 template <typename Strategy> |
| 278 int PositionTemplate<Strategy>::lastOffsetInNode(Node* node) | 273 int PositionTemplate<Strategy>::lastOffsetInNode(Node* node) |
| 279 { | 274 { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 345 |
| 351 } // namespace blink | 346 } // namespace blink |
| 352 | 347 |
| 353 #ifndef NDEBUG | 348 #ifndef NDEBUG |
| 354 // Outside the WebCore namespace for ease of invocation from gdb. | 349 // Outside the WebCore namespace for ease of invocation from gdb. |
| 355 void showTree(const blink::Position&); | 350 void showTree(const blink::Position&); |
| 356 void showTree(const blink::Position*); | 351 void showTree(const blink::Position*); |
| 357 #endif | 352 #endif |
| 358 | 353 |
| 359 #endif // Position_h | 354 #endif // Position_h |
| OLD | NEW |