| 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 if (p.isNull() && shadowAncestor) | 643 if (p.isNull() && shadowAncestor) |
| 644 p = PositionTemplate<Strategy>::afterNode(shadowAncestor); | 644 p = PositionTemplate<Strategy>::afterNode(shadowAncestor); |
| 645 } | 645 } |
| 646 const VisiblePositionTemplate<Strategy> previous = | 646 const VisiblePositionTemplate<Strategy> previous = |
| 647 createVisiblePosition(p); | 647 createVisiblePosition(p); |
| 648 | 648 |
| 649 if (previous.isNull()) { | 649 if (previous.isNull()) { |
| 650 // The selection crosses an Editing boundary. This is a | 650 // The selection crosses an Editing boundary. This is a |
| 651 // programmer error in the editing code. Happy debugging! | 651 // programmer error in the editing code. Happy debugging! |
| 652 NOTREACHED(); | 652 NOTREACHED(); |
| 653 m_base = PositionTemplate<Strategy>(); | 653 *this = VisibleSelectionTemplate<Strategy>(); |
| 654 m_extent = PositionTemplate<Strategy>(); | |
| 655 validate(); | |
| 656 return; | 654 return; |
| 657 } | 655 } |
| 658 m_end = previous.deepEquivalent(); | 656 m_end = previous.deepEquivalent(); |
| 659 } | 657 } |
| 660 | 658 |
| 661 // The selection starts in editable content or non-editable content inside a | 659 // The selection starts in editable content or non-editable content inside a |
| 662 // different editable ancestor, move forward until non-editable content | 660 // different editable ancestor, move forward until non-editable content |
| 663 // inside the same lowest editable ancestor is reached. | 661 // inside the same lowest editable ancestor is reached. |
| 664 Element* startEditableAncestor = | 662 Element* startEditableAncestor = |
| 665 lowestEditableAncestor(m_start.computeContainerNode()); | 663 lowestEditableAncestor(m_start.computeContainerNode()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 681 : nextVisuallyDistinctCandidate(p); | 679 : nextVisuallyDistinctCandidate(p); |
| 682 if (p.isNull() && shadowAncestor) | 680 if (p.isNull() && shadowAncestor) |
| 683 p = PositionTemplate<Strategy>::beforeNode(shadowAncestor); | 681 p = PositionTemplate<Strategy>::beforeNode(shadowAncestor); |
| 684 } | 682 } |
| 685 const VisiblePositionTemplate<Strategy> next = createVisiblePosition(p); | 683 const VisiblePositionTemplate<Strategy> next = createVisiblePosition(p); |
| 686 | 684 |
| 687 if (next.isNull()) { | 685 if (next.isNull()) { |
| 688 // The selection crosses an Editing boundary. This is a | 686 // The selection crosses an Editing boundary. This is a |
| 689 // programmer error in the editing code. Happy debugging! | 687 // programmer error in the editing code. Happy debugging! |
| 690 NOTREACHED(); | 688 NOTREACHED(); |
| 691 m_base = PositionTemplate<Strategy>(); | 689 *this = VisibleSelectionTemplate<Strategy>(); |
| 692 m_extent = PositionTemplate<Strategy>(); | |
| 693 validate(); | |
| 694 return; | 690 return; |
| 695 } | 691 } |
| 696 m_start = next.deepEquivalent(); | 692 m_start = next.deepEquivalent(); |
| 697 } | 693 } |
| 698 } | 694 } |
| 699 | 695 |
| 700 // Correct the extent if necessary. | 696 // Correct the extent if necessary. |
| 701 if (baseEditableAncestor != | 697 if (baseEditableAncestor != |
| 702 lowestEditableAncestor(m_extent.computeContainerNode())) | 698 lowestEditableAncestor(m_extent.computeContainerNode())) |
| 703 m_extent = m_baseIsFirst ? m_end : m_start; | 699 m_extent = m_baseIsFirst ? m_end : m_start; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 | 820 |
| 825 void showTree(const blink::VisibleSelectionInFlatTree& sel) { | 821 void showTree(const blink::VisibleSelectionInFlatTree& sel) { |
| 826 sel.showTreeForThis(); | 822 sel.showTreeForThis(); |
| 827 } | 823 } |
| 828 | 824 |
| 829 void showTree(const blink::VisibleSelectionInFlatTree* sel) { | 825 void showTree(const blink::VisibleSelectionInFlatTree* sel) { |
| 830 if (sel) | 826 if (sel) |
| 831 sel->showTreeForThis(); | 827 sel->showTreeForThis(); |
| 832 } | 828 } |
| 833 #endif | 829 #endif |
| OLD | NEW |