| 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 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1766 VisibleSelection newSelection(original); | 1766 VisibleSelection newSelection(original); |
| 1767 VisiblePosition startOfSelection(newSelection.visibleStart()); | 1767 VisiblePosition startOfSelection(newSelection.visibleStart()); |
| 1768 VisiblePosition endOfSelection(newSelection.visibleEnd()); | 1768 VisiblePosition endOfSelection(newSelection.visibleEnd()); |
| 1769 | 1769 |
| 1770 // If the end of the selection to modify is just after a table, and | 1770 // If the end of the selection to modify is just after a table, and |
| 1771 // if the start of the selection is inside that table, then the last paragraph | 1771 // if the start of the selection is inside that table, then the last paragraph |
| 1772 // that we'll want modify is the last one inside the table, not the table itse
lf | 1772 // that we'll want modify is the last one inside the table, not the table itse
lf |
| 1773 // (a table is itself a paragraph). | 1773 // (a table is itself a paragraph). |
| 1774 if (Element* table = tableElementJustBefore(endOfSelection)) { | 1774 if (Element* table = tableElementJustBefore(endOfSelection)) { |
| 1775 if (startOfSelection.deepEquivalent().anchorNode()->isDescendantOf(table)) | 1775 if (startOfSelection.deepEquivalent().anchorNode()->isDescendantOf(table)) |
| 1776 newSelection = createVisibleSelectionDeprecated( | 1776 newSelection = createVisibleSelection( |
| 1777 startOfSelection, | 1777 startOfSelection, |
| 1778 previousPositionOf(endOfSelection, CannotCrossEditingBoundary)); | 1778 previousPositionOf(endOfSelection, CannotCrossEditingBoundary)); |
| 1779 } | 1779 } |
| 1780 | 1780 |
| 1781 // If the start of the selection to modify is just before a table, | 1781 // If the start of the selection to modify is just before a table, |
| 1782 // and if the end of the selection is inside that table, then the first paragr
aph | 1782 // and if the end of the selection is inside that table, then the first paragr
aph |
| 1783 // we'll want to modify is the first one inside the table, not the paragraph | 1783 // we'll want to modify is the first one inside the table, not the paragraph |
| 1784 // containing the table itself. | 1784 // containing the table itself. |
| 1785 if (Element* table = tableElementJustAfter(startOfSelection)) { | 1785 if (Element* table = tableElementJustAfter(startOfSelection)) { |
| 1786 if (endOfSelection.deepEquivalent().anchorNode()->isDescendantOf(table)) | 1786 if (endOfSelection.deepEquivalent().anchorNode()->isDescendantOf(table)) |
| 1787 newSelection = createVisibleSelectionDeprecated( | 1787 newSelection = createVisibleSelection( |
| 1788 nextPositionOf(startOfSelection, CannotCrossEditingBoundary), | 1788 nextPositionOf(startOfSelection, CannotCrossEditingBoundary), |
| 1789 endOfSelection); | 1789 endOfSelection); |
| 1790 } | 1790 } |
| 1791 | 1791 |
| 1792 return newSelection; | 1792 return newSelection; |
| 1793 } | 1793 } |
| 1794 | 1794 |
| 1795 // FIXME: indexForVisiblePosition and visiblePositionForIndex use TextIterators
to convert between | 1795 // FIXME: indexForVisiblePosition and visiblePositionForIndex use TextIterators
to convert between |
| 1796 // VisiblePositions and indices. But TextIterator iteration using TextIteratorEm
itsCharactersBetweenAllVisiblePositions | 1796 // VisiblePositions and indices. But TextIterator iteration using TextIteratorEm
itsCharactersBetweenAllVisiblePositions |
| 1797 // does not exactly match VisiblePosition iteration, so using them to preserve a
selection during an editing | 1797 // does not exactly match VisiblePosition iteration, so using them to preserve a
selection during an editing |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2058 return InputType::DeleteWordBackward; | 2058 return InputType::DeleteWordBackward; |
| 2059 if (granularity == LineBoundary) | 2059 if (granularity == LineBoundary) |
| 2060 return InputType::DeleteLineBackward; | 2060 return InputType::DeleteLineBackward; |
| 2061 return InputType::DeleteContentBackward; | 2061 return InputType::DeleteContentBackward; |
| 2062 default: | 2062 default: |
| 2063 return InputType::None; | 2063 return InputType::None; |
| 2064 } | 2064 } |
| 2065 } | 2065 } |
| 2066 | 2066 |
| 2067 } // namespace blink | 2067 } // namespace blink |
| OLD | NEW |