| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 { | 103 { |
| 104 HTMLElement* startSpecialContainer = nullptr; | 104 HTMLElement* startSpecialContainer = nullptr; |
| 105 HTMLElement* endSpecialContainer = nullptr; | 105 HTMLElement* endSpecialContainer = nullptr; |
| 106 | 106 |
| 107 start = m_selectionToDelete.start(); | 107 start = m_selectionToDelete.start(); |
| 108 end = m_selectionToDelete.end(); | 108 end = m_selectionToDelete.end(); |
| 109 | 109 |
| 110 // For HRs, we'll get a position at (HR,1) when hitting delete from the begi
nning of the previous line, or (HR,0) when forward deleting, | 110 // For HRs, we'll get a position at (HR,1) when hitting delete from the begi
nning of the previous line, or (HR,0) when forward deleting, |
| 111 // but in these cases, we want to delete it, so manually expand the selectio
n | 111 // but in these cases, we want to delete it, so manually expand the selectio
n |
| 112 if (isHTMLHRElement(*start.anchorNode())) | 112 if (isHTMLHRElement(*start.anchorNode())) |
| 113 start = positionBeforeNode(start.anchorNode()); | 113 start = Position::beforeNode(start.anchorNode()); |
| 114 else if (isHTMLHRElement(*end.anchorNode())) | 114 else if (isHTMLHRElement(*end.anchorNode())) |
| 115 end = Position::afterNode(end.anchorNode()); | 115 end = Position::afterNode(end.anchorNode()); |
| 116 | 116 |
| 117 // FIXME: This is only used so that moveParagraphs can avoid the bugs in spe
cial element expansion. | 117 // FIXME: This is only used so that moveParagraphs can avoid the bugs in spe
cial element expansion. |
| 118 if (!m_expandForSpecialElements) | 118 if (!m_expandForSpecialElements) |
| 119 return; | 119 return; |
| 120 | 120 |
| 121 while (1) { | 121 while (1) { |
| 122 startSpecialContainer = 0; | 122 startSpecialContainer = 0; |
| 123 endSpecialContainer = 0; | 123 endSpecialContainer = 0; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 bool upstreamStartIsBR = isHTMLBRElement(*nodeAfterUpstreamStart); | 317 bool upstreamStartIsBR = isHTMLBRElement(*nodeAfterUpstreamStart); |
| 318 bool downstreamStartIsBR = isHTMLBRElement(*nodeAfterDownstreamStart); | 318 bool downstreamStartIsBR = isHTMLBRElement(*nodeAfterDownstreamStart); |
| 319 bool isBROnLineByItself = upstreamStartIsBR && downstreamStartIsBR && nodeAf
terDownstreamStart == nodeAfterUpstreamEnd; | 319 bool isBROnLineByItself = upstreamStartIsBR && downstreamStartIsBR && nodeAf
terDownstreamStart == nodeAfterUpstreamEnd; |
| 320 if (isBROnLineByItself) { | 320 if (isBROnLineByItself) { |
| 321 removeNode(nodeAfterDownstreamStart, editingState); | 321 removeNode(nodeAfterDownstreamStart, editingState); |
| 322 return true; | 322 return true; |
| 323 } | 323 } |
| 324 | 324 |
| 325 // FIXME: This code doesn't belong in here. | 325 // FIXME: This code doesn't belong in here. |
| 326 // We detect the case where the start is an empty line consisting of BR not
wrapped in a block element. | 326 // We detect the case where the start is an empty line consisting of BR not
wrapped in a block element. |
| 327 if (upstreamStartIsBR && downstreamStartIsBR && !(isStartOfBlock(createVisib
lePosition(positionBeforeNode(nodeAfterUpstreamStart))) && isEndOfBlock(createVi
siblePosition(Position::afterNode(nodeAfterUpstreamStart))))) { | 327 if (upstreamStartIsBR && downstreamStartIsBR && !(isStartOfBlock(createVisib
lePosition(Position::beforeNode(nodeAfterUpstreamStart))) && isEndOfBlock(create
VisiblePosition(Position::afterNode(nodeAfterUpstreamStart))))) { |
| 328 m_startsAtEmptyLine = true; | 328 m_startsAtEmptyLine = true; |
| 329 m_endingPosition = m_downstreamEnd; | 329 m_endingPosition = m_downstreamEnd; |
| 330 } | 330 } |
| 331 | 331 |
| 332 return false; | 332 return false; |
| 333 } | 333 } |
| 334 | 334 |
| 335 static Position firstEditablePositionInNode(Node* node) | 335 static Position firstEditablePositionInNode(Node* node) |
| 336 { | 336 { |
| 337 DCHECK(node); | 337 DCHECK(node); |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 visitor->trace(m_deleteIntoBlockquoteStyle); | 962 visitor->trace(m_deleteIntoBlockquoteStyle); |
| 963 visitor->trace(m_startRoot); | 963 visitor->trace(m_startRoot); |
| 964 visitor->trace(m_endRoot); | 964 visitor->trace(m_endRoot); |
| 965 visitor->trace(m_startTableRow); | 965 visitor->trace(m_startTableRow); |
| 966 visitor->trace(m_endTableRow); | 966 visitor->trace(m_endTableRow); |
| 967 visitor->trace(m_temporaryPlaceholder); | 967 visitor->trace(m_temporaryPlaceholder); |
| 968 CompositeEditCommand::trace(visitor); | 968 CompositeEditCommand::trace(visitor); |
| 969 } | 969 } |
| 970 | 970 |
| 971 } // namespace blink | 971 } // namespace blink |
| OLD | NEW |