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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1670 // if the selection starts just before a paragraph break, skip over it | 1675 // if the selection starts just before a paragraph break, skip over it |
1671 if (isEndOfParagraph(visiblePosition)) | 1676 if (isEndOfParagraph(visiblePosition)) |
1672 return mostForwardCaretPosition(nextPositionOf(visiblePosition).deepEqui
valent()); | 1677 return mostForwardCaretPosition(nextPositionOf(visiblePosition).deepEqui
valent()); |
1673 | 1678 |
1674 // otherwise, make sure to be at the start of the first selected node, | 1679 // otherwise, make sure to be at the start of the first selected node, |
1675 // instead of possibly at the end of the last node before the selection | 1680 // instead of possibly at the end of the last node before the selection |
1676 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); | 1681 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); |
1677 } | 1682 } |
1678 | 1683 |
1679 } // namespace blink | 1684 } // namespace blink |
OLD | NEW |