Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: third_party/WebKit/Source/core/editing/EditingUtilities.cpp

Issue 2374183004: Make non-null VisibleSelections creatable only by createVisibleSelection[Deprecated] (Closed)
Patch Set: Fix mac compile error Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 VisibleSelection newSelection(original); 1677 VisibleSelection newSelection(original);
1678 VisiblePosition startOfSelection(newSelection.visibleStart()); 1678 VisiblePosition startOfSelection(newSelection.visibleStart());
1679 VisiblePosition endOfSelection(newSelection.visibleEnd()); 1679 VisiblePosition endOfSelection(newSelection.visibleEnd());
1680 1680
1681 // If the end of the selection to modify is just after a table, and 1681 // If the end of the selection to modify is just after a table, and
1682 // if the start of the selection is inside that table, then the last paragra ph 1682 // if the start of the selection is inside that table, then the last paragra ph
1683 // that we'll want modify is the last one inside the table, not the table it self 1683 // that we'll want modify is the last one inside the table, not the table it self
1684 // (a table is itself a paragraph). 1684 // (a table is itself a paragraph).
1685 if (Element* table = tableElementJustBefore(endOfSelection)) { 1685 if (Element* table = tableElementJustBefore(endOfSelection)) {
1686 if (startOfSelection.deepEquivalent().anchorNode()->isDescendantOf(table )) 1686 if (startOfSelection.deepEquivalent().anchorNode()->isDescendantOf(table ))
1687 newSelection = VisibleSelection(startOfSelection, previousPositionOf (endOfSelection, CannotCrossEditingBoundary)); 1687 newSelection = createVisibleSelectionDeprecated(startOfSelection, pr eviousPositionOf(endOfSelection, CannotCrossEditingBoundary));
1688 } 1688 }
1689 1689
1690 // If the start of the selection to modify is just before a table, 1690 // If the start of the selection to modify is just before a table,
1691 // and if the end of the selection is inside that table, then the first para graph 1691 // and if the end of the selection is inside that table, then the first para graph
1692 // we'll want to modify is the first one inside the table, not the paragraph 1692 // we'll want to modify is the first one inside the table, not the paragraph
1693 // containing the table itself. 1693 // containing the table itself.
1694 if (Element* table = tableElementJustAfter(startOfSelection)) { 1694 if (Element* table = tableElementJustAfter(startOfSelection)) {
1695 if (endOfSelection.deepEquivalent().anchorNode()->isDescendantOf(table)) 1695 if (endOfSelection.deepEquivalent().anchorNode()->isDescendantOf(table))
1696 newSelection = VisibleSelection(nextPositionOf(startOfSelection, Can notCrossEditingBoundary), endOfSelection); 1696 newSelection = createVisibleSelectionDeprecated(nextPositionOf(start OfSelection, CannotCrossEditingBoundary), endOfSelection);
1697 } 1697 }
1698 1698
1699 return newSelection; 1699 return newSelection;
1700 } 1700 }
1701 1701
1702 // FIXME: indexForVisiblePosition and visiblePositionForIndex use TextIterators to convert between 1702 // FIXME: indexForVisiblePosition and visiblePositionForIndex use TextIterators to convert between
1703 // VisiblePositions and indices. But TextIterator iteration using TextIteratorEm itsCharactersBetweenAllVisiblePositions 1703 // VisiblePositions and indices. But TextIterator iteration using TextIteratorEm itsCharactersBetweenAllVisiblePositions
1704 // does not exactly match VisiblePosition iteration, so using them to preserve a selection during an editing 1704 // does not exactly match VisiblePosition iteration, so using them to preserve a selection during an editing
1705 // opertion is unreliable. TextIterator's TextIteratorEmitsCharactersBetweenAllV isiblePositions mode needs to be fixed, 1705 // opertion is unreliable. TextIterator's TextIteratorEmitsCharactersBetweenAllV isiblePositions mode needs to be fixed,
1706 // or these functions need to be changed to iterate using actual VisiblePosition s. 1706 // or these functions need to be changed to iterate using actual VisiblePosition s.
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1938 return InputType::DeleteWordBackward; 1938 return InputType::DeleteWordBackward;
1939 if (granularity == LineBoundary) 1939 if (granularity == LineBoundary)
1940 return InputType::DeleteLineBackward; 1940 return InputType::DeleteLineBackward;
1941 return InputType::DeleteContentBackward; 1941 return InputType::DeleteContentBackward;
1942 default: 1942 default:
1943 return InputType::None; 1943 return InputType::None;
1944 } 1944 }
1945 } 1945 }
1946 1946
1947 } // namespace blink 1947 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698