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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 RefPtr<ContainerNode> scope; |
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 RefPtr<Range> currentSelection = endingSelection().firstRange(); | 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 |
149 // the new location of endOfSelection and use it as the end of t
he new selection. | 149 // the new location of endOfSelection and use it as the end of t
he new selection. |
150 if (!startOfLastParagraph.deepEquivalent().inDocument()) | 150 if (!startOfLastParagraph.deepEquivalent().inDocument()) |
151 return; | 151 return; |
152 setEndingSelection(startOfCurrentParagraph); | 152 setEndingSelection(startOfCurrentParagraph); |
(...skipping 243 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 |