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

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

Issue 308023003: Don't call splitTreeToNode() with null Node (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2014-05-30T05:17:51 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-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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 document().updateLayoutIgnorePendingStylesheets(); 169 document().updateLayoutIgnorePendingStylesheets();
170 visibleStartOfParagraph = VisiblePosition(visibleStartOfParagraph.deepEq uivalent()); 170 visibleStartOfParagraph = VisiblePosition(visibleStartOfParagraph.deepEq uivalent());
171 visibleEndOfParagraph = VisiblePosition(visibleEndOfParagraph.deepEquiva lent()); 171 visibleEndOfParagraph = VisiblePosition(visibleEndOfParagraph.deepEquiva lent());
172 if (visibleStartOfParagraph.isNotNull() && !isStartOfParagraph(visibleSt artOfParagraph)) 172 if (visibleStartOfParagraph.isNotNull() && !isStartOfParagraph(visibleSt artOfParagraph))
173 insertNodeAt(createBreakElement(document()), visibleStartOfParagraph .deepEquivalent()); 173 insertNodeAt(createBreakElement(document()), visibleStartOfParagraph .deepEquivalent());
174 if (visibleEndOfParagraph.isNotNull() && !isEndOfParagraph(visibleEndOfP aragraph)) 174 if (visibleEndOfParagraph.isNotNull() && !isEndOfParagraph(visibleEndOfP aragraph))
175 insertNodeAt(createBreakElement(document()), visibleEndOfParagraph.d eepEquivalent()); 175 insertNodeAt(createBreakElement(document()), visibleEndOfParagraph.d eepEquivalent());
176 176
177 return; 177 return;
178 } 178 }
179 Node* enclosingBlockFlow = enclosingBlock(visibleStartOfParagraph.deepEquiva lent().deprecatedNode());
180 RefPtrWillBeRawPtr<Node> splitBlockquoteNode = enclosingNode; 179 RefPtrWillBeRawPtr<Node> splitBlockquoteNode = enclosingNode;
181 if (enclosingBlockFlow != enclosingNode) 180 if (Node* enclosingBlockFlow = enclosingBlock(visibleStartOfParagraph.deepEq uivalent().deprecatedNode())) {
182 splitBlockquoteNode = splitTreeToNode(enclosingBlockFlow, enclosingNode, true); 181 if (enclosingBlockFlow != enclosingNode) {
183 else { 182 splitBlockquoteNode = splitTreeToNode(enclosingBlockFlow, enclosingN ode, true);
184 // We split the blockquote at where we start outdenting. 183 } else {
185 Node* highestInlineNode = highestEnclosingNodeOfType(visibleStartOfParag raph.deepEquivalent(), isInline, CannotCrossEditingBoundary, enclosingBlockFlow) ; 184 // We split the blockquote at where we start outdenting.
186 splitElement(toElement(enclosingNode), (highestInlineNode) ? highestInli neNode : visibleStartOfParagraph.deepEquivalent().deprecatedNode()); 185 Node* highestInlineNode = highestEnclosingNodeOfType(visibleStartOfP aragraph.deepEquivalent(), isInline, CannotCrossEditingBoundary, enclosingBlockF low);
186 splitElement(toElement(enclosingNode), (highestInlineNode) ? highest InlineNode : visibleStartOfParagraph.deepEquivalent().deprecatedNode());
187 }
187 } 188 }
188 RefPtrWillBeRawPtr<Node> placeholder = createBreakElement(document()); 189 RefPtrWillBeRawPtr<Node> placeholder = createBreakElement(document());
189 insertNodeBefore(placeholder, splitBlockquoteNode); 190 insertNodeBefore(placeholder, splitBlockquoteNode);
190 moveParagraph(startOfParagraph(visibleStartOfParagraph), endOfParagraph(visi bleEndOfParagraph), VisiblePosition(positionBeforeNode(placeholder.get())), true ); 191 moveParagraph(startOfParagraph(visibleStartOfParagraph), endOfParagraph(visi bleEndOfParagraph), VisiblePosition(positionBeforeNode(placeholder.get())), true );
191 } 192 }
192 193
193 // FIXME: We should merge this function with ApplyBlockElementCommand::formatSel ection 194 // FIXME: We should merge this function with ApplyBlockElementCommand::formatSel ection
194 void IndentOutdentCommand::outdentRegion(const VisiblePosition& startOfSelection , const VisiblePosition& endOfSelection) 195 void IndentOutdentCommand::outdentRegion(const VisiblePosition& startOfSelection , const VisiblePosition& endOfSelection)
195 { 196 {
196 VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection); 197 VisiblePosition endOfCurrentParagraph = endOfParagraph(startOfSelection);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 238
238 void IndentOutdentCommand::formatRange(const Position& start, const Position& en d, const Position&, RefPtrWillBeRawPtr<Element>& blockquoteForNextIndent) 239 void IndentOutdentCommand::formatRange(const Position& start, const Position& en d, const Position&, RefPtrWillBeRawPtr<Element>& blockquoteForNextIndent)
239 { 240 {
240 if (tryIndentingAsListItem(start, end)) 241 if (tryIndentingAsListItem(start, end))
241 blockquoteForNextIndent = nullptr; 242 blockquoteForNextIndent = nullptr;
242 else 243 else
243 indentIntoBlockquote(start, end, blockquoteForNextIndent); 244 indentIntoBlockquote(start, end, blockquoteForNextIndent);
244 } 245 }
245 246
246 } 247 }
OLDNEW
« no previous file with comments | « LayoutTests/editing/execCommand/outdent-collapse-table-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698