| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2009 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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 bool PositionAlgorithm<Strategy>::atEndOfTree() const | 460 bool PositionAlgorithm<Strategy>::atEndOfTree() const |
| 461 { | 461 { |
| 462 if (isNull()) | 462 if (isNull()) |
| 463 return true; | 463 return true; |
| 464 // TODO(yosin) We should use |Strategy::lastOffsetForEditing()| instead of | 464 // TODO(yosin) We should use |Strategy::lastOffsetForEditing()| instead of |
| 465 // DOM tree version. | 465 // DOM tree version. |
| 466 return !Strategy::parent(*anchorNode()) && m_offset >= EditingStrategy::last
OffsetForEditing(anchorNode()); | 466 return !Strategy::parent(*anchorNode()) && m_offset >= EditingStrategy::last
OffsetForEditing(anchorNode()); |
| 467 } | 467 } |
| 468 | 468 |
| 469 template <typename Strategy> | 469 template <typename Strategy> |
| 470 PositionAlgorithm<Strategy> PositionAlgorithm<Strategy>::upstream(EditingBoundar
yCrossingRule rule) const | |
| 471 { | |
| 472 return mostBackwardCaretPosition(*this, rule); | |
| 473 } | |
| 474 | |
| 475 template <typename Strategy> | |
| 476 PositionAlgorithm<Strategy> PositionAlgorithm<Strategy>::downstream(EditingBound
aryCrossingRule rule) const | |
| 477 { | |
| 478 return mostForwardCaretPosition(*this, rule); | |
| 479 } | |
| 480 | |
| 481 template <typename Strategy> | |
| 482 void PositionAlgorithm<Strategy>::debugPosition(const char* msg) const | 470 void PositionAlgorithm<Strategy>::debugPosition(const char* msg) const |
| 483 { | 471 { |
| 484 static const char* const anchorTypes[] = { | 472 static const char* const anchorTypes[] = { |
| 485 "OffsetInAnchor", | 473 "OffsetInAnchor", |
| 486 "BeforeAnchor", | 474 "BeforeAnchor", |
| 487 "AfterAnchor", | 475 "AfterAnchor", |
| 488 "BeforeChildren", | 476 "BeforeChildren", |
| 489 "AfterChildren", | 477 "AfterChildren", |
| 490 "Invalid", | 478 "Invalid", |
| 491 }; | 479 }; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 | 642 |
| 655 void showTree(const blink::Position* pos) | 643 void showTree(const blink::Position* pos) |
| 656 { | 644 { |
| 657 if (pos) | 645 if (pos) |
| 658 pos->showTreeForThis(); | 646 pos->showTreeForThis(); |
| 659 else | 647 else |
| 660 fprintf(stderr, "Cannot showTree for (nil)\n"); | 648 fprintf(stderr, "Cannot showTree for (nil)\n"); |
| 661 } | 649 } |
| 662 | 650 |
| 663 #endif | 651 #endif |
| OLD | NEW |