OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 PositionInComposedTree firstEditablePositionAfterPositionInRoot(const PositionIn
ComposedTree& position, Node* highestRoot) | 490 PositionInComposedTree firstEditablePositionAfterPositionInRoot(const PositionIn
ComposedTree& position, Node* highestRoot) |
491 { | 491 { |
492 return firstEditablePositionAfterPositionInRootAlgorithm<EditingInComposedTr
eeStrategy>(position, highestRoot); | 492 return firstEditablePositionAfterPositionInRootAlgorithm<EditingInComposedTr
eeStrategy>(position, highestRoot); |
493 } | 493 } |
494 | 494 |
495 VisiblePosition lastEditableVisiblePositionBeforePositionInRoot(const Position&
position, ContainerNode* highestRoot) | 495 VisiblePosition lastEditableVisiblePositionBeforePositionInRoot(const Position&
position, ContainerNode* highestRoot) |
496 { | 496 { |
497 return createVisiblePosition(lastEditablePositionBeforePositionInRoot(positi
on, highestRoot)); | 497 return createVisiblePosition(lastEditablePositionBeforePositionInRoot(positi
on, highestRoot)); |
498 } | 498 } |
499 | 499 |
| 500 VisiblePositionInComposedTree lastEditableVisiblePositionBeforePositionInRoot(co
nst PositionInComposedTree& position, ContainerNode* highestRoot) |
| 501 { |
| 502 return createVisiblePosition(lastEditablePositionBeforePositionInRoot(positi
on, highestRoot)); |
| 503 } |
| 504 |
500 template <typename Strategy> | 505 template <typename Strategy> |
501 PositionAlgorithm<Strategy> lastEditablePositionBeforePositionInRootAlgorithm(co
nst PositionAlgorithm<Strategy>& position, Node* highestRoot) | 506 PositionAlgorithm<Strategy> lastEditablePositionBeforePositionInRootAlgorithm(co
nst PositionAlgorithm<Strategy>& position, Node* highestRoot) |
502 { | 507 { |
503 // When position falls after highestRoot, the result is easy to compute. | 508 // When position falls after highestRoot, the result is easy to compute. |
504 if (position.compareTo(PositionAlgorithm<Strategy>::lastPositionInNode(highe
stRoot)) == 1) | 509 if (position.compareTo(PositionAlgorithm<Strategy>::lastPositionInNode(highe
stRoot)) == 1) |
505 return PositionAlgorithm<Strategy>::lastPositionInNode(highestRoot); | 510 return PositionAlgorithm<Strategy>::lastPositionInNode(highestRoot); |
506 | 511 |
507 PositionAlgorithm<Strategy> editablePosition = position; | 512 PositionAlgorithm<Strategy> editablePosition = position; |
508 | 513 |
509 if (position.anchorNode()->treeScope() != highestRoot->treeScope()) { | 514 if (position.anchorNode()->treeScope() != highestRoot->treeScope()) { |
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1659 // if the selection starts just before a paragraph break, skip over it | 1664 // if the selection starts just before a paragraph break, skip over it |
1660 if (isEndOfParagraph(visiblePosition)) | 1665 if (isEndOfParagraph(visiblePosition)) |
1661 return mostForwardCaretPosition(nextPositionOf(visiblePosition).deepEqui
valent()); | 1666 return mostForwardCaretPosition(nextPositionOf(visiblePosition).deepEqui
valent()); |
1662 | 1667 |
1663 // otherwise, make sure to be at the start of the first selected node, | 1668 // otherwise, make sure to be at the start of the first selected node, |
1664 // instead of possibly at the end of the last node before the selection | 1669 // instead of possibly at the end of the last node before the selection |
1665 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); | 1670 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); |
1666 } | 1671 } |
1667 | 1672 |
1668 } // namespace blink | 1673 } // namespace blink |
OLD | NEW |