OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 if (endOfCurrentParagraph == endOfLastParagraph) | 199 if (endOfCurrentParagraph == endOfLastParagraph) |
200 setEndingSelection(VisibleSelection(originalSelectionEnd, DOWNSTREAM
)); | 200 setEndingSelection(VisibleSelection(originalSelectionEnd, DOWNSTREAM
)); |
201 else | 201 else |
202 setEndingSelection(endOfCurrentParagraph); | 202 setEndingSelection(endOfCurrentParagraph); |
203 | 203 |
204 outdentParagraph(); | 204 outdentParagraph(); |
205 | 205 |
206 // outdentParagraph could move more than one paragraph if the paragraph | 206 // outdentParagraph could move more than one paragraph if the paragraph |
207 // is in a list item. As a result, endAfterSelection and endOfNextParagr
aph | 207 // is in a list item. As a result, endAfterSelection and endOfNextParagr
aph |
208 // could refer to positions no longer in the document. | 208 // could refer to positions no longer in the document. |
209 if (endAfterSelection.isNotNull() && !endAfterSelection.deepEquivalent()
.anchorNode()->inDocument()) | 209 if (endAfterSelection.isNotNull() && !endAfterSelection.deepEquivalent()
.inDocument()) |
210 break; | 210 break; |
211 | 211 |
212 if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent
().anchorNode()->inDocument()) { | 212 if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.deepEquivalent
().inDocument()) { |
213 endOfCurrentParagraph = endingSelection().end(); | 213 endOfCurrentParagraph = endingSelection().end(); |
214 endOfNextParagraph = endOfParagraph(endOfCurrentParagraph.next()); | 214 endOfNextParagraph = endOfParagraph(endOfCurrentParagraph.next()); |
215 } | 215 } |
216 endOfCurrentParagraph = endOfNextParagraph; | 216 endOfCurrentParagraph = endOfNextParagraph; |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 void IndentOutdentCommand::formatSelection(const VisiblePosition& startOfSelecti
on, const VisiblePosition& endOfSelection) | 220 void IndentOutdentCommand::formatSelection(const VisiblePosition& startOfSelecti
on, const VisiblePosition& endOfSelection) |
221 { | 221 { |
222 if (m_typeOfAction == Indent) | 222 if (m_typeOfAction == Indent) |
223 ApplyBlockElementCommand::formatSelection(startOfSelection, endOfSelecti
on); | 223 ApplyBlockElementCommand::formatSelection(startOfSelection, endOfSelecti
on); |
224 else | 224 else |
225 outdentRegion(startOfSelection, endOfSelection); | 225 outdentRegion(startOfSelection, endOfSelection); |
226 } | 226 } |
227 | 227 |
228 void IndentOutdentCommand::formatRange(const Position& start, const Position& en
d, const Position&, RefPtr<Element>& blockquoteForNextIndent) | 228 void IndentOutdentCommand::formatRange(const Position& start, const Position& en
d, const Position&, RefPtr<Element>& blockquoteForNextIndent) |
229 { | 229 { |
230 if (tryIndentingAsListItem(start, end)) | 230 if (tryIndentingAsListItem(start, end)) |
231 blockquoteForNextIndent = 0; | 231 blockquoteForNextIndent = 0; |
232 else | 232 else |
233 indentIntoBlockquote(start, end, blockquoteForNextIndent); | 233 indentIntoBlockquote(start, end, blockquoteForNextIndent); |
234 } | 234 } |
235 | 235 |
236 } | 236 } |
OLD | NEW |