OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, 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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 } else { | 635 } else { |
636 // FIXME: Non-editable pieces inside editable content should be atomic,
in the same way that editable | 636 // FIXME: Non-editable pieces inside editable content should be atomic,
in the same way that editable |
637 // pieces in non-editable content are atomic. | 637 // pieces in non-editable content are atomic. |
638 | 638 |
639 // The selection ends in editable content or non-editable content inside
a different editable ancestor, | 639 // The selection ends in editable content or non-editable content inside
a different editable ancestor, |
640 // move backward until non-editable content inside the same lowest edita
ble ancestor is reached. | 640 // move backward until non-editable content inside the same lowest edita
ble ancestor is reached. |
641 Element* endEditableAncestor = lowestEditableAncestor(m_end.computeConta
inerNode()); | 641 Element* endEditableAncestor = lowestEditableAncestor(m_end.computeConta
inerNode()); |
642 if (endRoot || endEditableAncestor != baseEditableAncestor) { | 642 if (endRoot || endEditableAncestor != baseEditableAncestor) { |
643 | 643 |
644 PositionTemplate<Strategy>p = previousVisuallyDistinctCandidate(m_en
d); | 644 PositionTemplate<Strategy>p = previousVisuallyDistinctCandidate(m_en
d); |
645 Element* shadowAncestor = endRoot ? endRoot->shadowHost() : nullptr; | 645 Element* shadowAncestor = endRoot ? endRoot->ownerShadowHost() : nul
lptr; |
646 if (p.isNull() && shadowAncestor) | 646 if (p.isNull() && shadowAncestor) |
647 p = PositionTemplate<Strategy>::afterNode(shadowAncestor); | 647 p = PositionTemplate<Strategy>::afterNode(shadowAncestor); |
648 while (p.isNotNull() && !(lowestEditableAncestor(p.computeContainerN
ode()) == baseEditableAncestor && !isEditablePosition(p))) { | 648 while (p.isNotNull() && !(lowestEditableAncestor(p.computeContainerN
ode()) == baseEditableAncestor && !isEditablePosition(p))) { |
649 Element* root = rootEditableElementOf(p); | 649 Element* root = rootEditableElementOf(p); |
650 shadowAncestor = root ? root->shadowHost() : nullptr; | 650 shadowAncestor = root ? root->ownerShadowHost() : nullptr; |
651 p = isAtomicNode(p.computeContainerNode()) ? PositionTemplate<St
rategy>::inParentBeforeNode(*p.computeContainerNode()) : previousVisuallyDistinc
tCandidate(p); | 651 p = isAtomicNode(p.computeContainerNode()) ? PositionTemplate<St
rategy>::inParentBeforeNode(*p.computeContainerNode()) : previousVisuallyDistinc
tCandidate(p); |
652 if (p.isNull() && shadowAncestor) | 652 if (p.isNull() && shadowAncestor) |
653 p = PositionTemplate<Strategy>::afterNode(shadowAncestor); | 653 p = PositionTemplate<Strategy>::afterNode(shadowAncestor); |
654 } | 654 } |
655 const VisiblePositionTemplate<Strategy> previous = createVisiblePosi
tion(p); | 655 const VisiblePositionTemplate<Strategy> previous = createVisiblePosi
tion(p); |
656 | 656 |
657 if (previous.isNull()) { | 657 if (previous.isNull()) { |
658 // The selection crosses an Editing boundary. This is a | 658 // The selection crosses an Editing boundary. This is a |
659 // programmer error in the editing code. Happy debugging! | 659 // programmer error in the editing code. Happy debugging! |
660 NOTREACHED(); | 660 NOTREACHED(); |
661 m_base = PositionTemplate<Strategy>(); | 661 m_base = PositionTemplate<Strategy>(); |
662 m_extent = PositionTemplate<Strategy>(); | 662 m_extent = PositionTemplate<Strategy>(); |
663 validate(); | 663 validate(); |
664 return; | 664 return; |
665 } | 665 } |
666 m_end = previous.deepEquivalent(); | 666 m_end = previous.deepEquivalent(); |
667 } | 667 } |
668 | 668 |
669 // The selection starts in editable content or non-editable content insi
de a different editable ancestor, | 669 // The selection starts in editable content or non-editable content insi
de a different editable ancestor, |
670 // move forward until non-editable content inside the same lowest editab
le ancestor is reached. | 670 // move forward until non-editable content inside the same lowest editab
le ancestor is reached. |
671 Element* startEditableAncestor = lowestEditableAncestor(m_start.computeC
ontainerNode()); | 671 Element* startEditableAncestor = lowestEditableAncestor(m_start.computeC
ontainerNode()); |
672 if (startRoot || startEditableAncestor != baseEditableAncestor) { | 672 if (startRoot || startEditableAncestor != baseEditableAncestor) { |
673 PositionTemplate<Strategy> p = nextVisuallyDistinctCandidate(m_start
); | 673 PositionTemplate<Strategy> p = nextVisuallyDistinctCandidate(m_start
); |
674 Element* shadowAncestor = startRoot ? startRoot->shadowHost() : null
ptr; | 674 Element* shadowAncestor = startRoot ? startRoot->ownerShadowHost() :
nullptr; |
675 if (p.isNull() && shadowAncestor) | 675 if (p.isNull() && shadowAncestor) |
676 p = PositionTemplate<Strategy>::beforeNode(shadowAncestor); | 676 p = PositionTemplate<Strategy>::beforeNode(shadowAncestor); |
677 while (p.isNotNull() && !(lowestEditableAncestor(p.computeContainerN
ode()) == baseEditableAncestor && !isEditablePosition(p))) { | 677 while (p.isNotNull() && !(lowestEditableAncestor(p.computeContainerN
ode()) == baseEditableAncestor && !isEditablePosition(p))) { |
678 Element* root = rootEditableElementOf(p); | 678 Element* root = rootEditableElementOf(p); |
679 shadowAncestor = root ? root->shadowHost() : nullptr; | 679 shadowAncestor = root ? root->ownerShadowHost() : nullptr; |
680 p = isAtomicNode(p.computeContainerNode()) ? PositionTemplate<St
rategy>::inParentAfterNode(*p.computeContainerNode()) : nextVisuallyDistinctCand
idate(p); | 680 p = isAtomicNode(p.computeContainerNode()) ? PositionTemplate<St
rategy>::inParentAfterNode(*p.computeContainerNode()) : nextVisuallyDistinctCand
idate(p); |
681 if (p.isNull() && shadowAncestor) | 681 if (p.isNull() && shadowAncestor) |
682 p = PositionTemplate<Strategy>::beforeNode(shadowAncestor); | 682 p = PositionTemplate<Strategy>::beforeNode(shadowAncestor); |
683 } | 683 } |
684 const VisiblePositionTemplate<Strategy> next = createVisiblePosition
(p); | 684 const VisiblePositionTemplate<Strategy> next = createVisiblePosition
(p); |
685 | 685 |
686 if (next.isNull()) { | 686 if (next.isNull()) { |
687 // The selection crosses an Editing boundary. This is a | 687 // The selection crosses an Editing boundary. This is a |
688 // programmer error in the editing code. Happy debugging! | 688 // programmer error in the editing code. Happy debugging! |
689 NOTREACHED(); | 689 NOTREACHED(); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 { | 842 { |
843 sel.showTreeForThis(); | 843 sel.showTreeForThis(); |
844 } | 844 } |
845 | 845 |
846 void showTree(const blink::VisibleSelectionInFlatTree* sel) | 846 void showTree(const blink::VisibleSelectionInFlatTree* sel) |
847 { | 847 { |
848 if (sel) | 848 if (sel) |
849 sel->showTreeForThis(); | 849 sel->showTreeForThis(); |
850 } | 850 } |
851 #endif | 851 #endif |
OLD | NEW |