Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: Source/core/editing/IndentOutdentCommand.cpp

Issue 23450030: Introduce Position::inDocument() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/editing/Editor.cpp ('k') | Source/core/editing/InsertListCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « Source/core/editing/Editor.cpp ('k') | Source/core/editing/InsertListCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698