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

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

Issue 181283002: Fixing a crash in InsertListCommand. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update Created 6 years, 10 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 | « Source/core/dom/Range.cpp ('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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 VisiblePosition visibleEnd = endingSelection().visibleEnd(); 113 VisiblePosition visibleEnd = endingSelection().visibleEnd();
114 VisiblePosition visibleStart = endingSelection().visibleStart(); 114 VisiblePosition visibleStart = endingSelection().visibleStart();
115 // When a selection ends at the start of a paragraph, we rarely paint 115 // When a selection ends at the start of a paragraph, we rarely paint
116 // the selection gap before that paragraph, because there often is no gap. 116 // the selection gap before that paragraph, because there often is no gap.
117 // In a case like this, it's not obvious to the user that the selection 117 // In a case like this, it's not obvious to the user that the selection
118 // ends "inside" that paragraph, so it would be confusing if InsertUn{Ordere d}List 118 // ends "inside" that paragraph, so it would be confusing if InsertUn{Ordere d}List
119 // operated on that paragraph. 119 // operated on that paragraph.
120 // FIXME: We paint the gap before some paragraphs that are indented with lef t 120 // FIXME: We paint the gap before some paragraphs that are indented with lef t
121 // margin/padding, but not others. We should make the gap painting more con sistent and 121 // margin/padding, but not others. We should make the gap painting more con sistent and
122 // then use a left margin/padding rule here. 122 // then use a left margin/padding rule here.
123 if (visibleEnd != visibleStart && isStartOfParagraph(visibleEnd, CanSkipOver EditingBoundary)) 123 if (visibleEnd != visibleStart && isStartOfParagraph(visibleEnd, CanSkipOver EditingBoundary)) {
124 setEndingSelection(VisibleSelection(visibleStart, visibleEnd.previous(Ca nnotCrossEditingBoundary), endingSelection().isDirectional())); 124 setEndingSelection(VisibleSelection(visibleStart, visibleEnd.previous(Ca nnotCrossEditingBoundary), endingSelection().isDirectional()));
125 if (!endingSelection().rootEditableElement())
126 return;
127 }
125 128
126 const QualifiedName& listTag = (m_type == OrderedList) ? olTag : ulTag; 129 const QualifiedName& listTag = (m_type == OrderedList) ? olTag : ulTag;
127 if (endingSelection().isRange()) { 130 if (endingSelection().isRange()) {
128 VisibleSelection selection = selectionForParagraphIteration(endingSelect ion()); 131 VisibleSelection selection = selectionForParagraphIteration(endingSelect ion());
129 ASSERT(selection.isRange()); 132 ASSERT(selection.isRange());
130 VisiblePosition startOfSelection = selection.visibleStart(); 133 VisiblePosition startOfSelection = selection.visibleStart();
131 VisiblePosition endOfSelection = selection.visibleEnd(); 134 VisiblePosition endOfSelection = selection.visibleEnd();
132 VisiblePosition startOfLastParagraph = startOfParagraph(endOfSelection, CanSkipOverEditingBoundary); 135 VisiblePosition startOfLastParagraph = startOfParagraph(endOfSelection, CanSkipOverEditingBoundary);
133 136
134 if (startOfParagraph(startOfSelection, CanSkipOverEditingBoundary) != st artOfLastParagraph) { 137 if (startOfParagraph(startOfSelection, CanSkipOverEditingBoundary) != st artOfLastParagraph) {
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 if (listElement) 394 if (listElement)
392 return mergeWithNeighboringLists(listElement); 395 return mergeWithNeighboringLists(listElement);
393 396
394 if (canMergeLists(previousList, nextList)) 397 if (canMergeLists(previousList, nextList))
395 mergeIdenticalElements(previousList, nextList); 398 mergeIdenticalElements(previousList, nextList);
396 399
397 return listElement; 400 return listElement;
398 } 401 }
399 402
400 } 403 }
OLDNEW
« no previous file with comments | « Source/core/dom/Range.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698