| 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 | 480 |
| 481 template <typename Strategy> | 481 template <typename Strategy> |
| 482 PositionTemplate<Strategy> firstEditablePositionAfterPositionInRootAlgorithm(con
st PositionTemplate<Strategy>& position, Node& highestRoot) | 482 PositionTemplate<Strategy> firstEditablePositionAfterPositionInRootAlgorithm(con
st PositionTemplate<Strategy>& position, Node& highestRoot) |
| 483 { | 483 { |
| 484 // position falls before highestRoot. | 484 // position falls before highestRoot. |
| 485 if (position.compareTo(PositionTemplate<Strategy>::firstPositionInNode(&high
estRoot)) == -1 && highestRoot.hasEditableStyle()) | 485 if (position.compareTo(PositionTemplate<Strategy>::firstPositionInNode(&high
estRoot)) == -1 && highestRoot.hasEditableStyle()) |
| 486 return PositionTemplate<Strategy>::firstPositionInNode(&highestRoot); | 486 return PositionTemplate<Strategy>::firstPositionInNode(&highestRoot); |
| 487 | 487 |
| 488 PositionTemplate<Strategy> editablePosition = position; | 488 PositionTemplate<Strategy> editablePosition = position; |
| 489 | 489 |
| 490 if (position.anchorNode()->treeScope() != highestRoot.treeScope()) { | 490 if (position.anchorNode()->treeScopeOrDocument() != highestRoot.treeScopeOrD
ocument()) { |
| 491 Node* shadowAncestor = highestRoot.treeScope().ancestorInThisScope(edita
blePosition.anchorNode()); | 491 Node* shadowAncestor = highestRoot.treeScopeOrDocument().ancestorInThisS
cope(editablePosition.anchorNode()); |
| 492 if (!shadowAncestor) | 492 if (!shadowAncestor) |
| 493 return PositionTemplate<Strategy>(); | 493 return PositionTemplate<Strategy>(); |
| 494 | 494 |
| 495 editablePosition = PositionTemplate<Strategy>::afterNode(shadowAncestor)
; | 495 editablePosition = PositionTemplate<Strategy>::afterNode(shadowAncestor)
; |
| 496 } | 496 } |
| 497 | 497 |
| 498 while (editablePosition.anchorNode() && !isEditablePosition(editablePosition
) && editablePosition.anchorNode()->isDescendantOf(&highestRoot)) | 498 while (editablePosition.anchorNode() && !isEditablePosition(editablePosition
) && editablePosition.anchorNode()->isDescendantOf(&highestRoot)) |
| 499 editablePosition = isAtomicNode(editablePosition.anchorNode()) ? Positio
nTemplate<Strategy>::inParentAfterNode(*editablePosition.anchorNode()) : nextVis
uallyDistinctCandidate(editablePosition); | 499 editablePosition = isAtomicNode(editablePosition.anchorNode()) ? Positio
nTemplate<Strategy>::inParentAfterNode(*editablePosition.anchorNode()) : nextVis
uallyDistinctCandidate(editablePosition); |
| 500 | 500 |
| 501 if (editablePosition.anchorNode() && editablePosition.anchorNode() != &highe
stRoot && !editablePosition.anchorNode()->isDescendantOf(&highestRoot)) | 501 if (editablePosition.anchorNode() && editablePosition.anchorNode() != &highe
stRoot && !editablePosition.anchorNode()->isDescendantOf(&highestRoot)) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 526 | 526 |
| 527 template <typename Strategy> | 527 template <typename Strategy> |
| 528 PositionTemplate<Strategy> lastEditablePositionBeforePositionInRootAlgorithm(con
st PositionTemplate<Strategy>& position, Node& highestRoot) | 528 PositionTemplate<Strategy> lastEditablePositionBeforePositionInRootAlgorithm(con
st PositionTemplate<Strategy>& position, Node& highestRoot) |
| 529 { | 529 { |
| 530 // When position falls after highestRoot, the result is easy to compute. | 530 // When position falls after highestRoot, the result is easy to compute. |
| 531 if (position.compareTo(PositionTemplate<Strategy>::lastPositionInNode(&highe
stRoot)) == 1) | 531 if (position.compareTo(PositionTemplate<Strategy>::lastPositionInNode(&highe
stRoot)) == 1) |
| 532 return PositionTemplate<Strategy>::lastPositionInNode(&highestRoot); | 532 return PositionTemplate<Strategy>::lastPositionInNode(&highestRoot); |
| 533 | 533 |
| 534 PositionTemplate<Strategy> editablePosition = position; | 534 PositionTemplate<Strategy> editablePosition = position; |
| 535 | 535 |
| 536 if (position.anchorNode()->treeScope() != highestRoot.treeScope()) { | 536 if (position.anchorNode()->treeScopeOrDocument() != highestRoot.treeScopeOrD
ocument()) { |
| 537 Node* shadowAncestor = highestRoot.treeScope().ancestorInThisScope(edita
blePosition.anchorNode()); | 537 Node* shadowAncestor = highestRoot.treeScopeOrDocument().ancestorInThisS
cope(editablePosition.anchorNode()); |
| 538 if (!shadowAncestor) | 538 if (!shadowAncestor) |
| 539 return PositionTemplate<Strategy>(); | 539 return PositionTemplate<Strategy>(); |
| 540 | 540 |
| 541 editablePosition = PositionTemplate<Strategy>::firstPositionInOrBeforeNo
de(shadowAncestor); | 541 editablePosition = PositionTemplate<Strategy>::firstPositionInOrBeforeNo
de(shadowAncestor); |
| 542 } | 542 } |
| 543 | 543 |
| 544 while (editablePosition.anchorNode() && !isEditablePosition(editablePosition
) && editablePosition.anchorNode()->isDescendantOf(&highestRoot)) | 544 while (editablePosition.anchorNode() && !isEditablePosition(editablePosition
) && editablePosition.anchorNode()->isDescendantOf(&highestRoot)) |
| 545 editablePosition = isAtomicNode(editablePosition.anchorNode()) ? Positio
nTemplate<Strategy>::inParentBeforeNode(*editablePosition.anchorNode()) : previo
usVisuallyDistinctCandidate(editablePosition); | 545 editablePosition = isAtomicNode(editablePosition.anchorNode()) ? Positio
nTemplate<Strategy>::inParentBeforeNode(*editablePosition.anchorNode()) : previo
usVisuallyDistinctCandidate(editablePosition); |
| 546 | 546 |
| 547 if (editablePosition.anchorNode() && editablePosition.anchorNode() != &highe
stRoot && !editablePosition.anchorNode()->isDescendantOf(&highestRoot)) | 547 if (editablePosition.anchorNode() && editablePosition.anchorNode() != &highe
stRoot && !editablePosition.anchorNode()->isDescendantOf(&highestRoot)) |
| (...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1725 // instead of possibly at the end of the last node before the selection | 1725 // instead of possibly at the end of the last node before the selection |
| 1726 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); | 1726 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); |
| 1727 } | 1727 } |
| 1728 | 1728 |
| 1729 bool isTextSecurityNode(const Node* node) | 1729 bool isTextSecurityNode(const Node* node) |
| 1730 { | 1730 { |
| 1731 return node && node->layoutObject() && node->layoutObject()->style()->textSe
curity() != TSNONE; | 1731 return node && node->layoutObject() && node->layoutObject()->style()->textSe
curity() != TSNONE; |
| 1732 } | 1732 } |
| 1733 | 1733 |
| 1734 } // namespace blink | 1734 } // namespace blink |
| OLD | NEW |