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

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

Issue 1298633002: [Editing] Make InsertListCommand check endingSelection() editability. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: nit pick Created 5 years, 4 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
« no previous file with comments | « LayoutTests/editing/execCommand/insert-ordered-list-crash2.html ('k') | no next file » | 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, 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 // Save and restore endOfSelection and startOfLastParagraph when necessary 166 // Save and restore endOfSelection and startOfLastParagraph when necessary
167 // since moveParagraph and movePragraphWithClones can remove nod es. 167 // since moveParagraph and movePragraphWithClones can remove nod es.
168 if (!doApplyForSingleParagraph(forceListCreation, listTag, *curr entSelection)) 168 if (!doApplyForSingleParagraph(forceListCreation, listTag, *curr entSelection))
169 break; 169 break;
170 if (endOfSelection.isNull() || endOfSelection.isOrphan() || star tOfLastParagraph.isNull() || startOfLastParagraph.isOrphan()) { 170 if (endOfSelection.isNull() || endOfSelection.isOrphan() || star tOfLastParagraph.isNull() || startOfLastParagraph.isOrphan()) {
171 endOfSelection = visiblePositionForIndex(indexForEndOfSelect ion, scopeForEndOfSelection.get()); 171 endOfSelection = visiblePositionForIndex(indexForEndOfSelect ion, scopeForEndOfSelection.get());
172 // If endOfSelection is null, then some contents have been d eleted from the document. 172 // If endOfSelection is null, then some contents have been d eleted from the document.
173 // This should never happen and if it did, exit early immedi ately because we've lost the loop invariant. 173 // This should never happen and if it did, exit early immedi ately because we've lost the loop invariant.
174 ASSERT(endOfSelection.isNotNull()); 174 ASSERT(endOfSelection.isNotNull());
175 if (endOfSelection.isNull()) 175 if (endOfSelection.isNull() || !endOfSelection.rootEditableE lement())
176 return; 176 return;
177 startOfLastParagraph = startOfParagraph(endOfSelection, CanS kipOverEditingBoundary); 177 startOfLastParagraph = startOfParagraph(endOfSelection, CanS kipOverEditingBoundary);
178 } 178 }
179 179
180 startOfCurrentParagraph = startOfNextParagraph(endingSelection() .visibleStart()); 180 startOfCurrentParagraph = startOfNextParagraph(endingSelection() .visibleStart());
181 } 181 }
182 setEndingSelection(endOfSelection); 182 setEndingSelection(endOfSelection);
183 } 183 }
184 doApplyForSingleParagraph(forceListCreation, listTag, *currentSelection) ; 184 doApplyForSingleParagraph(forceListCreation, listTag, *currentSelection) ;
185 // Fetch the end of the selection, for the reason mentioned above. 185 // Fetch the end of the selection, for the reason mentioned above.
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 return listElement; 417 return listElement;
418 } 418 }
419 419
420 DEFINE_TRACE(InsertListCommand) 420 DEFINE_TRACE(InsertListCommand)
421 { 421 {
422 visitor->trace(m_listElement); 422 visitor->trace(m_listElement);
423 CompositeEditCommand::trace(visitor); 423 CompositeEditCommand::trace(visitor);
424 } 424 }
425 425
426 } 426 }
OLDNEW
« no previous file with comments | « LayoutTests/editing/execCommand/insert-ordered-list-crash2.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698