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

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

Issue 2370253002: Mark calls of visible{Start,End} with dirty layout deprecated (Closed)
Patch Set: 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) 2005 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 while (1) { 122 while (1) {
123 startSpecialContainer = 0; 123 startSpecialContainer = 0;
124 endSpecialContainer = 0; 124 endSpecialContainer = 0;
125 125
126 Position s = positionBeforeContainingSpecialElement(start, &startSpecial Container); 126 Position s = positionBeforeContainingSpecialElement(start, &startSpecial Container);
127 Position e = positionAfterContainingSpecialElement(end, &endSpecialConta iner); 127 Position e = positionAfterContainingSpecialElement(end, &endSpecialConta iner);
128 128
129 if (!startSpecialContainer && !endSpecialContainer) 129 if (!startSpecialContainer && !endSpecialContainer)
130 break; 130 break;
131 131
132 if (createVisiblePositionDeprecated(start).deepEquivalent() != m_selecti onToDelete.visibleStart().deepEquivalent() || createVisiblePositionDeprecated(en d).deepEquivalent() != m_selectionToDelete.visibleEnd().deepEquivalent()) 132 if (createVisiblePositionDeprecated(start).deepEquivalent() != m_selecti onToDelete.visibleStartDeprecated().deepEquivalent() || createVisiblePositionDep recated(end).deepEquivalent() != m_selectionToDelete.visibleEndDeprecated().deep Equivalent())
133 break; 133 break;
134 134
135 // If we're going to expand to include the startSpecialContainer, it mus t be fully selected. 135 // If we're going to expand to include the startSpecialContainer, it mus t be fully selected.
136 if (startSpecialContainer && !endSpecialContainer && comparePositions(Po sition::inParentAfterNode(*startSpecialContainer), end) > -1) 136 if (startSpecialContainer && !endSpecialContainer && comparePositions(Po sition::inParentAfterNode(*startSpecialContainer), end) > -1)
137 break; 137 break;
138 138
139 // If we're going to expand to include the endSpecialContainer, it must be fully selected. 139 // If we're going to expand to include the endSpecialContainer, it must be fully selected.
140 if (endSpecialContainer && !startSpecialContainer && comparePositions(st art, Position::inParentBeforeNode(*endSpecialContainer)) > -1) 140 if (endSpecialContainer && !startSpecialContainer && comparePositions(st art, Position::inParentBeforeNode(*endSpecialContainer)) > -1)
141 break; 141 break;
142 142
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 837
838 if (!m_selectionToDelete.isNonOrphanedRange() || !m_selectionToDelete.isCont entEditable()) 838 if (!m_selectionToDelete.isNonOrphanedRange() || !m_selectionToDelete.isCont entEditable())
839 return; 839 return;
840 840
841 // save this to later make the selection with 841 // save this to later make the selection with
842 TextAffinity affinity = m_selectionToDelete.affinity(); 842 TextAffinity affinity = m_selectionToDelete.affinity();
843 843
844 Position downstreamEnd = mostForwardCaretPosition(m_selectionToDelete.end()) ; 844 Position downstreamEnd = mostForwardCaretPosition(m_selectionToDelete.end()) ;
845 bool rootWillStayOpenWithoutPlaceholder = downstreamEnd.computeContainerNode () == rootEditableElement(*downstreamEnd.computeContainerNode()) 845 bool rootWillStayOpenWithoutPlaceholder = downstreamEnd.computeContainerNode () == rootEditableElement(*downstreamEnd.computeContainerNode())
846 || (downstreamEnd.computeContainerNode()->isTextNode() && downstreamEnd. computeContainerNode()->parentNode() == rootEditableElement(*downstreamEnd.compu teContainerNode())); 846 || (downstreamEnd.computeContainerNode()->isTextNode() && downstreamEnd. computeContainerNode()->parentNode() == rootEditableElement(*downstreamEnd.compu teContainerNode()));
847 bool lineBreakAtEndOfSelectionToDelete = lineBreakExistsAtVisiblePosition(m_ selectionToDelete.visibleEnd()); 847 bool lineBreakAtEndOfSelectionToDelete = lineBreakExistsAtVisiblePosition(m_ selectionToDelete.visibleEndDeprecated());
848 m_needPlaceholder = !rootWillStayOpenWithoutPlaceholder 848 m_needPlaceholder = !rootWillStayOpenWithoutPlaceholder
849 && isStartOfParagraphDeprecated(m_selectionToDelete.visibleStart(), CanC rossEditingBoundary) 849 && isStartOfParagraphDeprecated(m_selectionToDelete.visibleStartDeprecat ed(), CanCrossEditingBoundary)
850 && isEndOfParagraphDeprecated(m_selectionToDelete.visibleEnd(), CanCross EditingBoundary) 850 && isEndOfParagraphDeprecated(m_selectionToDelete.visibleEndDeprecated() , CanCrossEditingBoundary)
851 && !lineBreakAtEndOfSelectionToDelete; 851 && !lineBreakAtEndOfSelectionToDelete;
852 if (m_needPlaceholder) { 852 if (m_needPlaceholder) {
853 // Don't need a placeholder when deleting a selection that starts just 853 // Don't need a placeholder when deleting a selection that starts just
854 // before a table and ends inside it (we do need placeholders to hold 854 // before a table and ends inside it (we do need placeholders to hold
855 // open empty cells, but that's handled elsewhere). 855 // open empty cells, but that's handled elsewhere).
856 if (Element* table = tableElementJustAfter(m_selectionToDelete.visibleSt art())) { 856 if (Element* table = tableElementJustAfter(m_selectionToDelete.visibleSt artDeprecated())) {
857 if (m_selectionToDelete.end().anchorNode()->isDescendantOf(table)) 857 if (m_selectionToDelete.end().anchorNode()->isDescendantOf(table))
858 m_needPlaceholder = false; 858 m_needPlaceholder = false;
859 } 859 }
860 } 860 }
861 861
862 // set up our state 862 // set up our state
863 initializePositionData(editingState); 863 initializePositionData(editingState);
864 if (editingState->isAborted()) 864 if (editingState->isAborted())
865 return; 865 return;
866 866
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 visitor->trace(m_deleteIntoBlockquoteStyle); 963 visitor->trace(m_deleteIntoBlockquoteStyle);
964 visitor->trace(m_startRoot); 964 visitor->trace(m_startRoot);
965 visitor->trace(m_endRoot); 965 visitor->trace(m_endRoot);
966 visitor->trace(m_startTableRow); 966 visitor->trace(m_startTableRow);
967 visitor->trace(m_endTableRow); 967 visitor->trace(m_endTableRow);
968 visitor->trace(m_temporaryPlaceholder); 968 visitor->trace(m_temporaryPlaceholder);
969 CompositeEditCommand::trace(visitor); 969 CompositeEditCommand::trace(visitor);
970 } 970 }
971 971
972 } // namespace blink 972 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698