OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2010 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 165 |
166 // Save and restore endOfSelection and startOfLastParagraph when
necessary | 166 // Save and restore endOfSelection and startOfLastParagraph when
necessary |
167 // since moveParagraph and movePragraphWithClones can remove nod
es. | 167 // since moveParagraph and movePragraphWithClones can remove nod
es. |
168 if (!doApplyForSingleParagraph(forceListCreation, listTag, *curr
entSelection)) | 168 if (!doApplyForSingleParagraph(forceListCreation, listTag, *curr
entSelection)) |
169 break; | 169 break; |
170 if (endOfSelection.isNull() || endOfSelection.isOrphan() || star
tOfLastParagraph.isNull() || startOfLastParagraph.isOrphan()) { | 170 if (endOfSelection.isNull() || endOfSelection.isOrphan() || star
tOfLastParagraph.isNull() || startOfLastParagraph.isOrphan()) { |
171 endOfSelection = visiblePositionForIndex(indexForEndOfSelect
ion, scopeForEndOfSelection.get()); | 171 endOfSelection = visiblePositionForIndex(indexForEndOfSelect
ion, scopeForEndOfSelection.get()); |
172 // If endOfSelection is null, then some contents have been d
eleted from the document. | 172 // If endOfSelection is null, then some contents have been d
eleted from the document. |
173 // This should never happen and if it did, exit early immedi
ately because we've lost the loop invariant. | 173 // This should never happen and if it did, exit early immedi
ately because we've lost the loop invariant. |
174 ASSERT(endOfSelection.isNotNull()); | 174 ASSERT(endOfSelection.isNotNull()); |
175 if (endOfSelection.isNull()) | 175 if (endOfSelection.isNull() || !endOfSelection.rootEditableE
lement()) |
176 return; | 176 return; |
177 startOfLastParagraph = startOfParagraph(endOfSelection, CanS
kipOverEditingBoundary); | 177 startOfLastParagraph = startOfParagraph(endOfSelection, CanS
kipOverEditingBoundary); |
178 } | 178 } |
179 | 179 |
180 startOfCurrentParagraph = startOfNextParagraph(endingSelection()
.visibleStart()); | 180 startOfCurrentParagraph = startOfNextParagraph(endingSelection()
.visibleStart()); |
181 } | 181 } |
182 setEndingSelection(endOfSelection); | 182 setEndingSelection(endOfSelection); |
183 } | 183 } |
184 doApplyForSingleParagraph(forceListCreation, listTag, *currentSelection)
; | 184 doApplyForSingleParagraph(forceListCreation, listTag, *currentSelection)
; |
185 // Fetch the end of the selection, for the reason mentioned above. | 185 // Fetch the end of the selection, for the reason mentioned above. |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 return listElement; | 417 return listElement; |
418 } | 418 } |
419 | 419 |
420 DEFINE_TRACE(InsertListCommand) | 420 DEFINE_TRACE(InsertListCommand) |
421 { | 421 { |
422 visitor->trace(m_listElement); | 422 visitor->trace(m_listElement); |
423 CompositeEditCommand::trace(visitor); | 423 CompositeEditCommand::trace(visitor); |
424 } | 424 } |
425 | 425 |
426 } | 426 } |
OLD | NEW |