| OLD | NEW |
| 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 Loading... |
| 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 (createVisiblePosition(start).deepEquivalent() != m_selectionToDelete
.visibleStart().deepEquivalent() || createVisiblePosition(end).deepEquivalent()
!= m_selectionToDelete.visibleEnd().deepEquivalent()) | 132 if (createVisiblePositionDeprecated(start).deepEquivalent() != m_selecti
onToDelete.visibleStart().deepEquivalent() || createVisiblePositionDeprecated(en
d).deepEquivalent() != m_selectionToDelete.visibleEnd().deepEquivalent()) |
| 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 |
| 143 if (startSpecialContainer && startSpecialContainer->isDescendantOf(endSp
ecialContainer)) { | 143 if (startSpecialContainer && startSpecialContainer->isDescendantOf(endSp
ecialContainer)) { |
| 144 // Don't adjust the end yet, it is the end of a special element that
contains the start | 144 // Don't adjust the end yet, it is the end of a special element that
contains the start |
| 145 // special element (which may or may not be fully selected). | 145 // special element (which may or may not be fully selected). |
| 146 start = s; | 146 start = s; |
| 147 } else if (endSpecialContainer && endSpecialContainer->isDescendantOf(st
artSpecialContainer)) { | 147 } else if (endSpecialContainer && endSpecialContainer->isDescendantOf(st
artSpecialContainer)) { |
| 148 // Don't adjust the start yet, it is the start of a special element
that contains the end | 148 // Don't adjust the start yet, it is the start of a special element
that contains the end |
| 149 // special element (which may or may not be fully selected). | 149 // special element (which may or may not be fully selected). |
| 150 end = e; | 150 end = e; |
| 151 } else { | 151 } else { |
| 152 start = s; | 152 start = s; |
| 153 end = e; | 153 end = e; |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 | 157 |
| 158 void DeleteSelectionCommand::setStartingSelectionOnSmartDelete(const Position& s
tart, const Position& end) | 158 void DeleteSelectionCommand::setStartingSelectionOnSmartDelete(const Position& s
tart, const Position& end) |
| 159 { | 159 { |
| 160 bool isBaseFirst = startingSelection().isBaseFirst(); | 160 bool isBaseFirst = startingSelection().isBaseFirst(); |
| 161 VisiblePosition newBase = createVisiblePosition(isBaseFirst ? start : end); | 161 VisiblePosition newBase = createVisiblePositionDeprecated(isBaseFirst ? star
t : end); |
| 162 VisiblePosition newExtent = createVisiblePosition(isBaseFirst ? end : start)
; | 162 VisiblePosition newExtent = createVisiblePositionDeprecated(isBaseFirst ? en
d : start); |
| 163 setStartingSelection(VisibleSelection(newBase, newExtent, startingSelection(
).isDirectional())); | 163 setStartingSelection(VisibleSelection(newBase, newExtent, startingSelection(
).isDirectional())); |
| 164 } | 164 } |
| 165 | 165 |
| 166 void DeleteSelectionCommand::initializePositionData(EditingState* editingState) | 166 void DeleteSelectionCommand::initializePositionData(EditingState* editingState) |
| 167 { | 167 { |
| 168 Position start, end; | 168 Position start, end; |
| 169 initializeStartEnd(start, end); | 169 initializeStartEnd(start, end); |
| 170 DCHECK(start.isNotNull()); | 170 DCHECK(start.isNotNull()); |
| 171 DCHECK(end.isNotNull()); | 171 DCHECK(end.isNotNull()); |
| 172 if (!isEditablePosition(start)) { | 172 if (!isEditablePosition(start)) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 195 // tell that function that we don't care if it returns non-editable nodes. | 195 // tell that function that we don't care if it returns non-editable nodes. |
| 196 Node* startCell = enclosingNodeOfType(m_upstreamStart, &isTableCell, CanCros
sEditingBoundary); | 196 Node* startCell = enclosingNodeOfType(m_upstreamStart, &isTableCell, CanCros
sEditingBoundary); |
| 197 Node* endCell = enclosingNodeOfType(m_downstreamEnd, &isTableCell, CanCrossE
ditingBoundary); | 197 Node* endCell = enclosingNodeOfType(m_downstreamEnd, &isTableCell, CanCrossE
ditingBoundary); |
| 198 // FIXME: This isn't right. A borderless table with two rows and a single c
olumn would appear as two paragraphs. | 198 // FIXME: This isn't right. A borderless table with two rows and a single c
olumn would appear as two paragraphs. |
| 199 if (endCell && endCell != startCell) | 199 if (endCell && endCell != startCell) |
| 200 m_mergeBlocksAfterDelete = false; | 200 m_mergeBlocksAfterDelete = false; |
| 201 | 201 |
| 202 // Usually the start and the end of the selection to delete are pulled toget
her as a result of the deletion. | 202 // Usually the start and the end of the selection to delete are pulled toget
her as a result of the deletion. |
| 203 // Sometimes they aren't (like when no merge is requested), so we must choos
e one position to hold the caret | 203 // Sometimes they aren't (like when no merge is requested), so we must choos
e one position to hold the caret |
| 204 // and receive the placeholder after deletion. | 204 // and receive the placeholder after deletion. |
| 205 VisiblePosition visibleEnd = createVisiblePosition(m_downstreamEnd); | 205 VisiblePosition visibleEnd = createVisiblePositionDeprecated(m_downstreamEnd
); |
| 206 if (m_mergeBlocksAfterDelete && !isEndOfParagraph(visibleEnd)) | 206 if (m_mergeBlocksAfterDelete && !isEndOfParagraph(visibleEnd)) |
| 207 m_endingPosition = m_downstreamEnd; | 207 m_endingPosition = m_downstreamEnd; |
| 208 else | 208 else |
| 209 m_endingPosition = m_downstreamStart; | 209 m_endingPosition = m_downstreamStart; |
| 210 | 210 |
| 211 // We don't want to merge into a block if it will mean changing the quote le
vel of content after deleting | 211 // We don't want to merge into a block if it will mean changing the quote le
vel of content after deleting |
| 212 // selections that contain a whole number paragraphs plus a line break, sinc
e it is unclear to most users | 212 // selections that contain a whole number paragraphs plus a line break, sinc
e it is unclear to most users |
| 213 // that such a selection actually ends at the start of the next paragraph. T
his matches TextEdit behavior | 213 // that such a selection actually ends at the start of the next paragraph. T
his matches TextEdit behavior |
| 214 // for indented paragraphs. | 214 // for indented paragraphs. |
| 215 // Only apply this rule if the endingSelection is a range selection. If it
is a caret, then other operations have created | 215 // Only apply this rule if the endingSelection is a range selection. If it
is a caret, then other operations have created |
| 216 // the selection we're deleting (like the process of creating a selection to
delete during a backspace), and the user isn't in the situation described above
. | 216 // the selection we're deleting (like the process of creating a selection to
delete during a backspace), and the user isn't in the situation described above
. |
| 217 if (numEnclosingMailBlockquotes(start) != numEnclosingMailBlockquotes(end) | 217 if (numEnclosingMailBlockquotes(start) != numEnclosingMailBlockquotes(end) |
| 218 && isStartOfParagraph(visibleEnd) && isStartOfParagraph(createVisiblePos
ition(start)) | 218 && isStartOfParagraph(visibleEnd) && isStartOfParagraph(createVisiblePos
itionDeprecated(start)) |
| 219 && endingSelection().isRange()) { | 219 && endingSelection().isRange()) { |
| 220 m_mergeBlocksAfterDelete = false; | 220 m_mergeBlocksAfterDelete = false; |
| 221 m_pruneStartBlockIfNecessary = true; | 221 m_pruneStartBlockIfNecessary = true; |
| 222 } | 222 } |
| 223 | 223 |
| 224 // Handle leading and trailing whitespace, as well as smart delete adjustmen
ts to the selection | 224 // Handle leading and trailing whitespace, as well as smart delete adjustmen
ts to the selection |
| 225 m_leadingWhitespace = leadingWhitespacePosition(m_upstreamStart, m_selection
ToDelete.affinity()); | 225 m_leadingWhitespace = leadingWhitespacePosition(m_upstreamStart, m_selection
ToDelete.affinity()); |
| 226 m_trailingWhitespace = trailingWhitespacePosition(m_downstreamEnd, VP_DEFAUL
T_AFFINITY); | 226 m_trailingWhitespace = trailingWhitespacePosition(m_downstreamEnd, VP_DEFAUL
T_AFFINITY); |
| 227 | 227 |
| 228 if (m_smartDelete) { | 228 if (m_smartDelete) { |
| 229 | 229 |
| 230 // skip smart delete if the selection to delete already starts or ends w
ith whitespace | 230 // skip smart delete if the selection to delete already starts or ends w
ith whitespace |
| 231 Position pos = createVisiblePosition(m_upstreamStart, m_selectionToDelet
e.affinity()).deepEquivalent(); | 231 Position pos = createVisiblePositionDeprecated(m_upstreamStart, m_select
ionToDelete.affinity()).deepEquivalent(); |
| 232 bool skipSmartDelete = trailingWhitespacePosition(pos, VP_DEFAULT_AFFINI
TY, ConsiderNonCollapsibleWhitespace).isNotNull(); | 232 bool skipSmartDelete = trailingWhitespacePosition(pos, VP_DEFAULT_AFFINI
TY, ConsiderNonCollapsibleWhitespace).isNotNull(); |
| 233 if (!skipSmartDelete) | 233 if (!skipSmartDelete) |
| 234 skipSmartDelete = leadingWhitespacePosition(m_downstreamEnd, VP_DEFA
ULT_AFFINITY, ConsiderNonCollapsibleWhitespace).isNotNull(); | 234 skipSmartDelete = leadingWhitespacePosition(m_downstreamEnd, VP_DEFA
ULT_AFFINITY, ConsiderNonCollapsibleWhitespace).isNotNull(); |
| 235 | 235 |
| 236 // extend selection upstream if there is whitespace there | 236 // extend selection upstream if there is whitespace there |
| 237 bool hasLeadingWhitespaceBeforeAdjustment = leadingWhitespacePosition(m_
upstreamStart, m_selectionToDelete.affinity(), ConsiderNonCollapsibleWhitespace)
.isNotNull(); | 237 bool hasLeadingWhitespaceBeforeAdjustment = leadingWhitespacePosition(m_
upstreamStart, m_selectionToDelete.affinity(), ConsiderNonCollapsibleWhitespace)
.isNotNull(); |
| 238 if (!skipSmartDelete && hasLeadingWhitespaceBeforeAdjustment) { | 238 if (!skipSmartDelete && hasLeadingWhitespaceBeforeAdjustment) { |
| 239 VisiblePosition visiblePos = previousPositionOf(createVisiblePositio
n(m_upstreamStart, VP_DEFAULT_AFFINITY)); | 239 VisiblePosition visiblePos = previousPositionOf(createVisiblePositio
nDeprecated(m_upstreamStart, VP_DEFAULT_AFFINITY)); |
| 240 pos = visiblePos.deepEquivalent(); | 240 pos = visiblePos.deepEquivalent(); |
| 241 // Expand out one character upstream for smart delete and recalculat
e | 241 // Expand out one character upstream for smart delete and recalculat
e |
| 242 // positions based on this change. | 242 // positions based on this change. |
| 243 m_upstreamStart = mostBackwardCaretPosition(pos); | 243 m_upstreamStart = mostBackwardCaretPosition(pos); |
| 244 m_downstreamStart = mostForwardCaretPosition(pos); | 244 m_downstreamStart = mostForwardCaretPosition(pos); |
| 245 m_leadingWhitespace = leadingWhitespacePosition(m_upstreamStart, vis
iblePos.affinity()); | 245 m_leadingWhitespace = leadingWhitespacePosition(m_upstreamStart, vis
iblePos.affinity()); |
| 246 | 246 |
| 247 setStartingSelectionOnSmartDelete(m_upstreamStart, m_upstreamEnd); | 247 setStartingSelectionOnSmartDelete(m_upstreamStart, m_upstreamEnd); |
| 248 } | 248 } |
| 249 | 249 |
| 250 // trailing whitespace is only considered for smart delete if there is n
o leading | 250 // trailing whitespace is only considered for smart delete if there is n
o leading |
| 251 // whitespace, as in the case where you double-click the first word of a
paragraph. | 251 // whitespace, as in the case where you double-click the first word of a
paragraph. |
| 252 if (!skipSmartDelete && !hasLeadingWhitespaceBeforeAdjustment && trailin
gWhitespacePosition(m_downstreamEnd, VP_DEFAULT_AFFINITY, ConsiderNonCollapsible
Whitespace).isNotNull()) { | 252 if (!skipSmartDelete && !hasLeadingWhitespaceBeforeAdjustment && trailin
gWhitespacePosition(m_downstreamEnd, VP_DEFAULT_AFFINITY, ConsiderNonCollapsible
Whitespace).isNotNull()) { |
| 253 // Expand out one character downstream for smart delete and recalcul
ate | 253 // Expand out one character downstream for smart delete and recalcul
ate |
| 254 // positions based on this change. | 254 // positions based on this change. |
| 255 pos = nextPositionOf(createVisiblePosition(m_downstreamEnd, VP_DEFAU
LT_AFFINITY)).deepEquivalent(); | 255 pos = nextPositionOf(createVisiblePositionDeprecated(m_downstreamEnd
, VP_DEFAULT_AFFINITY)).deepEquivalent(); |
| 256 m_upstreamEnd = mostBackwardCaretPosition(pos); | 256 m_upstreamEnd = mostBackwardCaretPosition(pos); |
| 257 m_downstreamEnd = mostForwardCaretPosition(pos); | 257 m_downstreamEnd = mostForwardCaretPosition(pos); |
| 258 m_trailingWhitespace = trailingWhitespacePosition(m_downstreamEnd, V
P_DEFAULT_AFFINITY); | 258 m_trailingWhitespace = trailingWhitespacePosition(m_downstreamEnd, V
P_DEFAULT_AFFINITY); |
| 259 | 259 |
| 260 setStartingSelectionOnSmartDelete(m_downstreamStart, m_downstreamEnd
); | 260 setStartingSelectionOnSmartDelete(m_downstreamStart, m_downstreamEnd
); |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 | 263 |
| 264 // We must pass call parentAnchoredEquivalent on the positions since some ed
iting positions | 264 // We must pass call parentAnchoredEquivalent on the positions since some ed
iting positions |
| 265 // that appear inside their nodes aren't really inside them. [hr, 0] is one
example. | 265 // that appear inside their nodes aren't really inside them. [hr, 0] is one
example. |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 return; | 638 return; |
| 639 | 639 |
| 640 // FIXME: The deletion algorithm shouldn't let this happen. | 640 // FIXME: The deletion algorithm shouldn't let this happen. |
| 641 if (comparePositions(m_upstreamStart, m_downstreamEnd) > 0) | 641 if (comparePositions(m_upstreamStart, m_downstreamEnd) > 0) |
| 642 return; | 642 return; |
| 643 | 643 |
| 644 // There's nothing to merge. | 644 // There's nothing to merge. |
| 645 if (m_upstreamStart == m_downstreamEnd) | 645 if (m_upstreamStart == m_downstreamEnd) |
| 646 return; | 646 return; |
| 647 | 647 |
| 648 VisiblePosition startOfParagraphToMove = createVisiblePosition(m_downstreamE
nd); | 648 VisiblePosition startOfParagraphToMove = createVisiblePositionDeprecated(m_d
ownstreamEnd); |
| 649 VisiblePosition mergeDestination = createVisiblePosition(m_upstreamStart); | 649 VisiblePosition mergeDestination = createVisiblePositionDeprecated(m_upstrea
mStart); |
| 650 | 650 |
| 651 // m_downstreamEnd's block has been emptied out by deletion. There is no co
ntent inside of it to | 651 // m_downstreamEnd's block has been emptied out by deletion. There is no co
ntent inside of it to |
| 652 // move, so just remove it. | 652 // move, so just remove it. |
| 653 Element* endBlock = enclosingBlock(m_downstreamEnd.anchorNode()); | 653 Element* endBlock = enclosingBlock(m_downstreamEnd.anchorNode()); |
| 654 if (!endBlock || !endBlock->contains(startOfParagraphToMove.deepEquivalent()
.anchorNode()) || !startOfParagraphToMove.deepEquivalent().anchorNode()) { | 654 if (!endBlock || !endBlock->contains(startOfParagraphToMove.deepEquivalent()
.anchorNode()) || !startOfParagraphToMove.deepEquivalent().anchorNode()) { |
| 655 removeNode(enclosingBlock(m_downstreamEnd.anchorNode()), editingState); | 655 removeNode(enclosingBlock(m_downstreamEnd.anchorNode()), editingState); |
| 656 return; | 656 return; |
| 657 } | 657 } |
| 658 | 658 |
| 659 // We need to merge into m_upstreamStart's block, but it's been emptied out
and collapsed by deletion. | 659 // We need to merge into m_upstreamStart's block, but it's been emptied out
and collapsed by deletion. |
| 660 if (!mergeDestination.deepEquivalent().anchorNode() || (!mergeDestination.de
epEquivalent().anchorNode()->isDescendantOf(enclosingBlock(m_upstreamStart.compu
teContainerNode())) && (!mergeDestination.deepEquivalent().anchorNode()->hasChil
dren() || !m_upstreamStart.computeContainerNode()->hasChildren())) || (m_startsA
tEmptyLine && mergeDestination.deepEquivalent() != startOfParagraphToMove.deepEq
uivalent())) { | 660 if (!mergeDestination.deepEquivalent().anchorNode() || (!mergeDestination.de
epEquivalent().anchorNode()->isDescendantOf(enclosingBlock(m_upstreamStart.compu
teContainerNode())) && (!mergeDestination.deepEquivalent().anchorNode()->hasChil
dren() || !m_upstreamStart.computeContainerNode()->hasChildren())) || (m_startsA
tEmptyLine && mergeDestination.deepEquivalent() != startOfParagraphToMove.deepEq
uivalent())) { |
| 661 insertNodeAt(HTMLBRElement::create(document()), m_upstreamStart, editing
State); | 661 insertNodeAt(HTMLBRElement::create(document()), m_upstreamStart, editing
State); |
| 662 if (editingState->isAborted()) | 662 if (editingState->isAborted()) |
| 663 return; | 663 return; |
| 664 mergeDestination = createVisiblePosition(m_upstreamStart); | 664 mergeDestination = createVisiblePositionDeprecated(m_upstreamStart); |
| 665 } | 665 } |
| 666 | 666 |
| 667 if (mergeDestination.deepEquivalent() == startOfParagraphToMove.deepEquivale
nt()) | 667 if (mergeDestination.deepEquivalent() == startOfParagraphToMove.deepEquivale
nt()) |
| 668 return; | 668 return; |
| 669 | 669 |
| 670 VisiblePosition endOfParagraphToMove = endOfParagraph(startOfParagraphToMove
, CanSkipOverEditingBoundary); | 670 VisiblePosition endOfParagraphToMove = endOfParagraph(startOfParagraphToMove
, CanSkipOverEditingBoundary); |
| 671 | 671 |
| 672 if (mergeDestination.deepEquivalent() == endOfParagraphToMove.deepEquivalent
()) | 672 if (mergeDestination.deepEquivalent() == endOfParagraphToMove.deepEquivalent
()) |
| 673 return; | 673 return; |
| 674 | 674 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 867 bool lineBreakBeforeStart = lineBreakExistsAtVisiblePosition(previousPositio
nOf(createVisiblePosition(m_upstreamStart))); | 867 bool lineBreakBeforeStart = lineBreakExistsAtVisiblePosition(previousPositio
nOf(createVisiblePositionDeprecated(m_upstreamStart))); |
| 868 | 868 |
| 869 // Delete any text that may hinder our ability to fixup whitespace after the | 869 // Delete any text that may hinder our ability to fixup whitespace after the |
| 870 // delete | 870 // delete |
| 871 deleteInsignificantTextDownstream(m_trailingWhitespace); | 871 deleteInsignificantTextDownstream(m_trailingWhitespace); |
| 872 | 872 |
| 873 saveTypingStyleState(); | 873 saveTypingStyleState(); |
| 874 | 874 |
| 875 // deleting just a BR is handled specially, at least because we do not | 875 // deleting just a BR is handled specially, at least because we do not |
| 876 // want to replace it with a placeholder BR! | 876 // want to replace it with a placeholder BR! |
| 877 bool brResult = handleSpecialCaseBRDelete(editingState); | 877 bool brResult = handleSpecialCaseBRDelete(editingState); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 893 | 893 |
| 894 mergeParagraphs(editingState); | 894 mergeParagraphs(editingState); |
| 895 if (editingState->isAborted()) | 895 if (editingState->isAborted()) |
| 896 return; | 896 return; |
| 897 | 897 |
| 898 removePreviouslySelectedEmptyTableRows(editingState); | 898 removePreviouslySelectedEmptyTableRows(editingState); |
| 899 if (editingState->isAborted()) | 899 if (editingState->isAborted()) |
| 900 return; | 900 return; |
| 901 | 901 |
| 902 if (!m_needPlaceholder && rootWillStayOpenWithoutPlaceholder) { | 902 if (!m_needPlaceholder && rootWillStayOpenWithoutPlaceholder) { |
| 903 VisiblePosition visualEnding = createVisiblePosition(m_endingPosition); | 903 VisiblePosition visualEnding = createVisiblePositionDeprecated(m_endingP
osition); |
| 904 bool hasPlaceholder = lineBreakExistsAtVisiblePosition(visualEnding) | 904 bool hasPlaceholder = lineBreakExistsAtVisiblePosition(visualEnding) |
| 905 && nextPositionOf(visualEnding, CannotCrossEditingBoundary).isNull()
; | 905 && nextPositionOf(visualEnding, CannotCrossEditingBoundary).isNull()
; |
| 906 m_needPlaceholder = hasPlaceholder && lineBreakBeforeStart && !lineBreak
AtEndOfSelectionToDelete; | 906 m_needPlaceholder = hasPlaceholder && lineBreakBeforeStart && !lineBreak
AtEndOfSelectionToDelete; |
| 907 } | 907 } |
| 908 | 908 |
| 909 HTMLBRElement* placeholder = m_needPlaceholder ? HTMLBRElement::create(docum
ent()) : nullptr; | 909 HTMLBRElement* placeholder = m_needPlaceholder ? HTMLBRElement::create(docum
ent()) : nullptr; |
| 910 | 910 |
| 911 if (placeholder) { | 911 if (placeholder) { |
| 912 if (m_sanitizeMarkup) { | 912 if (m_sanitizeMarkup) { |
| 913 removeRedundantBlocks(editingState); | 913 removeRedundantBlocks(editingState); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |