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

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

Issue 305143002: Don't call moveParagraph() with null |VisiblePositon| (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2014-05-30T05:23:36 Created 6 years, 6 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/outdent-collapse-table-crash-2-expected.txt ('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, 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 Node* enclosingBlockFlow = enclosingBlock(visibleStartOfParagraph.deepEquiva lent().deprecatedNode()); 179 Node* enclosingBlockFlow = enclosingBlock(visibleStartOfParagraph.deepEquiva lent().deprecatedNode());
180 RefPtrWillBeRawPtr<Node> splitBlockquoteNode = enclosingNode; 180 RefPtrWillBeRawPtr<Node> splitBlockquoteNode = enclosingNode;
181 if (enclosingBlockFlow != enclosingNode) 181 if (enclosingBlockFlow != enclosingNode)
182 splitBlockquoteNode = splitTreeToNode(enclosingBlockFlow, enclosingNode, true); 182 splitBlockquoteNode = splitTreeToNode(enclosingBlockFlow, enclosingNode, true);
183 else { 183 else {
184 // We split the blockquote at where we start outdenting. 184 // We split the blockquote at where we start outdenting.
185 Node* highestInlineNode = highestEnclosingNodeOfType(visibleStartOfParag raph.deepEquivalent(), isInline, CannotCrossEditingBoundary, enclosingBlockFlow) ; 185 Node* highestInlineNode = highestEnclosingNodeOfType(visibleStartOfParag raph.deepEquivalent(), isInline, CannotCrossEditingBoundary, enclosingBlockFlow) ;
186 splitElement(toElement(enclosingNode), (highestInlineNode) ? highestInli neNode : visibleStartOfParagraph.deepEquivalent().deprecatedNode()); 186 splitElement(toElement(enclosingNode), (highestInlineNode) ? highestInli neNode : visibleStartOfParagraph.deepEquivalent().deprecatedNode());
187 } 187 }
188 VisiblePosition startOfParagraphToMove(startOfParagraph(visibleStartOfParagr aph));
189 VisiblePosition endOfParagraphToMove(endOfParagraph(visibleEndOfParagraph));
190 if (startOfParagraphToMove.isNull() || endOfParagraphToMove.isNull())
191 return;
188 RefPtrWillBeRawPtr<Node> placeholder = createBreakElement(document()); 192 RefPtrWillBeRawPtr<Node> placeholder = createBreakElement(document());
189 insertNodeBefore(placeholder, splitBlockquoteNode); 193 insertNodeBefore(placeholder, splitBlockquoteNode);
190 moveParagraph(startOfParagraph(visibleStartOfParagraph), endOfParagraph(visi bleEndOfParagraph), VisiblePosition(positionBeforeNode(placeholder.get())), true ); 194 moveParagraph(startOfParagraphToMove, endOfParagraphToMove, VisiblePosition( positionBeforeNode(placeholder.get())), true);
191 } 195 }
192 196
193 // FIXME: We should merge this function with ApplyBlockElementCommand::formatSel ection 197 // FIXME: We should merge this function with ApplyBlockElementCommand::formatSel ection
194 void IndentOutdentCommand::outdentRegion(const VisiblePosition& startOfSelection , const VisiblePosition& endOfSelection) 198 void IndentOutdentCommand::outdentRegion(const VisiblePosition& startOfSelection , const VisiblePosition& endOfSelection)
195 { 199 {
196 VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection); 200 VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection);
197 VisiblePosition endOfLastParagraph = endOfParagraph(endOfSelection); 201 VisiblePosition endOfLastParagraph = endOfParagraph(endOfSelection);
198 202
199 if (endOfCurrentParagraph == endOfLastParagraph) { 203 if (endOfCurrentParagraph == endOfLastParagraph) {
200 outdentParagraph(); 204 outdentParagraph();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 241
238 void IndentOutdentCommand::formatRange(const Position& start, const Position& en d, const Position&, RefPtrWillBeRawPtr<Element>& blockquoteForNextIndent) 242 void IndentOutdentCommand::formatRange(const Position& start, const Position& en d, const Position&, RefPtrWillBeRawPtr<Element>& blockquoteForNextIndent)
239 { 243 {
240 if (tryIndentingAsListItem(start, end)) 244 if (tryIndentingAsListItem(start, end))
241 blockquoteForNextIndent = nullptr; 245 blockquoteForNextIndent = nullptr;
242 else 246 else
243 indentIntoBlockquote(start, end, blockquoteForNextIndent); 247 indentIntoBlockquote(start, end, blockquoteForNextIndent);
244 } 248 }
245 249
246 } 250 }
OLDNEW
« no previous file with comments | « LayoutTests/editing/execCommand/outdent-collapse-table-crash-2-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698