| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 const QualifiedName& listTag = (m_type == OrderedList) ? olTag : ulTag; | 129 const QualifiedName& listTag = (m_type == OrderedList) ? olTag : ulTag; |
| 130 if (endingSelection().isRange()) { | 130 if (endingSelection().isRange()) { |
| 131 VisibleSelection selection = selectionForParagraphIteration(endingSelect
ion()); | 131 VisibleSelection selection = selectionForParagraphIteration(endingSelect
ion()); |
| 132 ASSERT(selection.isRange()); | 132 ASSERT(selection.isRange()); |
| 133 VisiblePosition startOfSelection = selection.visibleStart(); | 133 VisiblePosition startOfSelection = selection.visibleStart(); |
| 134 VisiblePosition endOfSelection = selection.visibleEnd(); | 134 VisiblePosition endOfSelection = selection.visibleEnd(); |
| 135 VisiblePosition startOfLastParagraph = startOfParagraph(endOfSelection,
CanSkipOverEditingBoundary); | 135 VisiblePosition startOfLastParagraph = startOfParagraph(endOfSelection,
CanSkipOverEditingBoundary); |
| 136 | 136 |
| 137 if (startOfParagraph(startOfSelection, CanSkipOverEditingBoundary) != st
artOfLastParagraph) { | 137 if (startOfParagraph(startOfSelection, CanSkipOverEditingBoundary) != st
artOfLastParagraph) { |
| 138 RefPtr<ContainerNode> scope; | 138 RefPtrWillBeRawPtr<ContainerNode> scope = nullptr; |
| 139 int indexForEndOfSelection = indexForVisiblePosition(endOfSelection,
scope); | 139 int indexForEndOfSelection = indexForVisiblePosition(endOfSelection,
scope); |
| 140 bool forceCreateList = !selectionHasListOfType(selection, listTag); | 140 bool forceCreateList = !selectionHasListOfType(selection, listTag); |
| 141 | 141 |
| 142 RefPtrWillBeRawPtr<Range> currentSelection = endingSelection().first
Range(); | 142 RefPtrWillBeRawPtr<Range> currentSelection = endingSelection().first
Range(); |
| 143 VisiblePosition startOfCurrentParagraph = startOfSelection; | 143 VisiblePosition startOfCurrentParagraph = startOfSelection; |
| 144 while (!inSameParagraph(startOfCurrentParagraph, startOfLastParagrap
h, CanCrossEditingBoundary)) { | 144 while (!inSameParagraph(startOfCurrentParagraph, startOfLastParagrap
h, CanCrossEditingBoundary)) { |
| 145 // doApply() may operate on and remove the last paragraph of the
selection from the document | 145 // doApply() may operate on and remove the last paragraph of the
selection from the document |
| 146 // if it's in the same list item as startOfCurrentParagraph. Re
turn early to avoid an | 146 // if it's in the same list item as startOfCurrentParagraph. Re
turn early to avoid an |
| 147 // infinite loop and because there is no more work to be done. | 147 // infinite loop and because there is no more work to be done. |
| 148 // FIXME(<rdar://problem/5983974>): The endingSelection() may be
incorrect here. Compute | 148 // FIXME(<rdar://problem/5983974>): The endingSelection() may be
incorrect here. Compute |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 if (listElement) | 396 if (listElement) |
| 397 return mergeWithNeighboringLists(listElement); | 397 return mergeWithNeighboringLists(listElement); |
| 398 | 398 |
| 399 if (canMergeLists(previousList, nextList)) | 399 if (canMergeLists(previousList, nextList)) |
| 400 mergeIdenticalElements(previousList, nextList); | 400 mergeIdenticalElements(previousList, nextList); |
| 401 | 401 |
| 402 return listElement; | 402 return listElement; |
| 403 } | 403 } |
| 404 | 404 |
| 405 } | 405 } |
| OLD | NEW |