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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 // Save and restore endOfSelection and startOfLastParagraph when
necessary | 173 // Save and restore endOfSelection and startOfLastParagraph when
necessary |
174 // since moveParagraph and movePragraphWithClones can remove nod
es. | 174 // since moveParagraph and movePragraphWithClones can remove nod
es. |
175 if (!doApplyForSingleParagraph(forceListCreation, listTag, *curr
entSelection)) | 175 if (!doApplyForSingleParagraph(forceListCreation, listTag, *curr
entSelection)) |
176 break; | 176 break; |
177 if (endOfSelection.isNull() || endOfSelection.isOrphan() || star
tOfLastParagraph.isNull() || startOfLastParagraph.isOrphan()) { | 177 if (endOfSelection.isNull() || endOfSelection.isOrphan() || star
tOfLastParagraph.isNull() || startOfLastParagraph.isOrphan()) { |
178 endOfSelection = visiblePositionForIndex(indexForEndOfSelect
ion, scopeForEndOfSelection.get()); | 178 endOfSelection = visiblePositionForIndex(indexForEndOfSelect
ion, scopeForEndOfSelection.get()); |
179 // If endOfSelection is null, then some contents have been d
eleted from the document. | 179 // If endOfSelection is null, then some contents have been d
eleted from the document. |
180 // This should never happen and if it did, exit early immedi
ately because we've lost the loop invariant. | 180 // This should never happen and if it did, exit early immedi
ately because we've lost the loop invariant. |
181 ASSERT(endOfSelection.isNotNull()); | 181 ASSERT(endOfSelection.isNotNull()); |
182 if (endOfSelection.isNull() || !endOfSelection.rootEditableE
lement()) | 182 if (endOfSelection.isNull() || !rootEditableElementOf(endOfS
election)) |
183 return; | 183 return; |
184 startOfLastParagraph = startOfParagraph(endOfSelection, CanS
kipOverEditingBoundary); | 184 startOfLastParagraph = startOfParagraph(endOfSelection, CanS
kipOverEditingBoundary); |
185 } | 185 } |
186 | 186 |
187 startOfCurrentParagraph = startOfNextParagraph(endingSelection()
.visibleStart()); | 187 startOfCurrentParagraph = startOfNextParagraph(endingSelection()
.visibleStart()); |
188 } | 188 } |
189 setEndingSelection(endOfSelection); | 189 setEndingSelection(endOfSelection); |
190 } | 190 } |
191 doApplyForSingleParagraph(forceListCreation, listTag, *currentSelection)
; | 191 doApplyForSingleParagraph(forceListCreation, listTag, *currentSelection)
; |
192 // Fetch the end of the selection, for the reason mentioned above. | 192 // Fetch the end of the selection, for the reason mentioned above. |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 return listElement; | 427 return listElement; |
428 } | 428 } |
429 | 429 |
430 DEFINE_TRACE(InsertListCommand) | 430 DEFINE_TRACE(InsertListCommand) |
431 { | 431 { |
432 visitor->trace(m_listElement); | 432 visitor->trace(m_listElement); |
433 CompositeEditCommand::trace(visitor); | 433 CompositeEditCommand::trace(visitor); |
434 } | 434 } |
435 | 435 |
436 } | 436 } |
OLD | NEW |