| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 m_leadingWhitespace = leadingWhitespacePosition(m_upstreamStart, vis
iblePos.affinity()); | 238 m_leadingWhitespace = leadingWhitespacePosition(m_upstreamStart, vis
iblePos.affinity()); |
| 239 | 239 |
| 240 setStartingSelectionOnSmartDelete(m_upstreamStart, m_upstreamEnd); | 240 setStartingSelectionOnSmartDelete(m_upstreamStart, m_upstreamEnd); |
| 241 } | 241 } |
| 242 | 242 |
| 243 // trailing whitespace is only considered for smart delete if there is n
o leading | 243 // trailing whitespace is only considered for smart delete if there is n
o leading |
| 244 // whitespace, as in the case where you double-click the first word of a
paragraph. | 244 // whitespace, as in the case where you double-click the first word of a
paragraph. |
| 245 if (!skipSmartDelete && !hasLeadingWhitespaceBeforeAdjustment && trailin
gWhitespacePosition(m_downstreamEnd, VP_DEFAULT_AFFINITY, ConsiderNonCollapsible
Whitespace).isNotNull()) { | 245 if (!skipSmartDelete && !hasLeadingWhitespaceBeforeAdjustment && trailin
gWhitespacePosition(m_downstreamEnd, VP_DEFAULT_AFFINITY, ConsiderNonCollapsible
Whitespace).isNotNull()) { |
| 246 // Expand out one character downstream for smart delete and recalcul
ate | 246 // Expand out one character downstream for smart delete and recalcul
ate |
| 247 // positions based on this change. | 247 // positions based on this change. |
| 248 pos = VisiblePosition(m_downstreamEnd, VP_DEFAULT_AFFINITY).next().d
eepEquivalent(); | 248 pos = nextPositionOf(VisiblePosition(m_downstreamEnd, VP_DEFAULT_AFF
INITY)).deepEquivalent(); |
| 249 m_upstreamEnd = mostBackwardCaretPosition(pos); | 249 m_upstreamEnd = mostBackwardCaretPosition(pos); |
| 250 m_downstreamEnd = mostForwardCaretPosition(pos); | 250 m_downstreamEnd = mostForwardCaretPosition(pos); |
| 251 m_trailingWhitespace = trailingWhitespacePosition(m_downstreamEnd, V
P_DEFAULT_AFFINITY); | 251 m_trailingWhitespace = trailingWhitespacePosition(m_downstreamEnd, V
P_DEFAULT_AFFINITY); |
| 252 | 252 |
| 253 setStartingSelectionOnSmartDelete(m_downstreamStart, m_downstreamEnd
); | 253 setStartingSelectionOnSmartDelete(m_downstreamStart, m_downstreamEnd
); |
| 254 } | 254 } |
| 255 } | 255 } |
| 256 | 256 |
| 257 // We must pass call parentAnchoredEquivalent on the positions since some ed
iting positions | 257 // We must pass call parentAnchoredEquivalent on the positions since some ed
iting positions |
| 258 // that appear inside their nodes aren't really inside them. [hr, 0] is one
example. | 258 // that appear inside their nodes aren't really inside them. [hr, 0] is one
example. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 } | 382 } |
| 383 return; | 383 return; |
| 384 } | 384 } |
| 385 | 385 |
| 386 if (node == m_startBlock) { | 386 if (node == m_startBlock) { |
| 387 VisiblePosition previous = previousPositionOf(VisiblePosition(firstPosit
ionInNode(m_startBlock.get()))); | 387 VisiblePosition previous = previousPositionOf(VisiblePosition(firstPosit
ionInNode(m_startBlock.get()))); |
| 388 if (previous.isNotNull() && !isEndOfBlock(previous)) | 388 if (previous.isNotNull() && !isEndOfBlock(previous)) |
| 389 m_needPlaceholder = true; | 389 m_needPlaceholder = true; |
| 390 } | 390 } |
| 391 if (node == m_endBlock) { | 391 if (node == m_endBlock) { |
| 392 VisiblePosition next = VisiblePosition(lastPositionInNode(m_endBlock.get
())).next(); | 392 VisiblePosition next = nextPositionOf(VisiblePosition(lastPositionInNode
(m_endBlock.get()))); |
| 393 if (next.isNotNull() && !isStartOfBlock(next)) | 393 if (next.isNotNull() && !isStartOfBlock(next)) |
| 394 m_needPlaceholder = true; | 394 m_needPlaceholder = true; |
| 395 } | 395 } |
| 396 | 396 |
| 397 // FIXME: Update the endpoints of the range being deleted. | 397 // FIXME: Update the endpoints of the range being deleted. |
| 398 updatePositionForNodeRemoval(m_endingPosition, *node); | 398 updatePositionForNodeRemoval(m_endingPosition, *node); |
| 399 updatePositionForNodeRemoval(m_leadingWhitespace, *node); | 399 updatePositionForNodeRemoval(m_leadingWhitespace, *node); |
| 400 updatePositionForNodeRemoval(m_trailingWhitespace, *node); | 400 updatePositionForNodeRemoval(m_trailingWhitespace, *node); |
| 401 | 401 |
| 402 CompositeEditCommand::removeNode(node, shouldAssumeContentIsAlwaysEditable); | 402 CompositeEditCommand::removeNode(node, shouldAssumeContentIsAlwaysEditable); |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 | 838 |
| 839 fixupWhitespace(); | 839 fixupWhitespace(); |
| 840 | 840 |
| 841 mergeParagraphs(); | 841 mergeParagraphs(); |
| 842 | 842 |
| 843 removePreviouslySelectedEmptyTableRows(); | 843 removePreviouslySelectedEmptyTableRows(); |
| 844 | 844 |
| 845 if (!m_needPlaceholder && rootWillStayOpenWithoutPlaceholder) { | 845 if (!m_needPlaceholder && rootWillStayOpenWithoutPlaceholder) { |
| 846 VisiblePosition visualEnding(m_endingPosition); | 846 VisiblePosition visualEnding(m_endingPosition); |
| 847 bool hasPlaceholder = lineBreakExistsAtVisiblePosition(visualEnding) | 847 bool hasPlaceholder = lineBreakExistsAtVisiblePosition(visualEnding) |
| 848 && visualEnding.next(CannotCrossEditingBoundary).isNull(); | 848 && nextPositionOf(visualEnding, CannotCrossEditingBoundary).isNull()
; |
| 849 m_needPlaceholder = hasPlaceholder && lineBreakBeforeStart && !lineBreak
AtEndOfSelectionToDelete; | 849 m_needPlaceholder = hasPlaceholder && lineBreakBeforeStart && !lineBreak
AtEndOfSelectionToDelete; |
| 850 } | 850 } |
| 851 | 851 |
| 852 RefPtrWillBeRawPtr<HTMLBRElement> placeholder = m_needPlaceholder ? createBr
eakElement(document()) : nullptr; | 852 RefPtrWillBeRawPtr<HTMLBRElement> placeholder = m_needPlaceholder ? createBr
eakElement(document()) : nullptr; |
| 853 | 853 |
| 854 if (placeholder) { | 854 if (placeholder) { |
| 855 if (m_sanitizeMarkup) | 855 if (m_sanitizeMarkup) |
| 856 removeRedundantBlocks(); | 856 removeRedundantBlocks(); |
| 857 // handleGeneralDelete cause DOM mutation events so |m_endingPosition| | 857 // handleGeneralDelete cause DOM mutation events so |m_endingPosition| |
| 858 // can be out of document. | 858 // can be out of document. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 visitor->trace(m_deleteIntoBlockquoteStyle); | 900 visitor->trace(m_deleteIntoBlockquoteStyle); |
| 901 visitor->trace(m_startRoot); | 901 visitor->trace(m_startRoot); |
| 902 visitor->trace(m_endRoot); | 902 visitor->trace(m_endRoot); |
| 903 visitor->trace(m_startTableRow); | 903 visitor->trace(m_startTableRow); |
| 904 visitor->trace(m_endTableRow); | 904 visitor->trace(m_endTableRow); |
| 905 visitor->trace(m_temporaryPlaceholder); | 905 visitor->trace(m_temporaryPlaceholder); |
| 906 CompositeEditCommand::trace(visitor); | 906 CompositeEditCommand::trace(visitor); |
| 907 } | 907 } |
| 908 | 908 |
| 909 } // namespace blink | 909 } // namespace blink |
| OLD | NEW |