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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp

Issue 2595783002: [Editing] Add null check in |DeleteSelectionCommand::removeRedundantBlocks()| (Closed)
Patch Set: dominicc's suggestion: Use unit test instead of layout test Created 4 years 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 | « third_party/WebKit/Source/core/editing/commands/ApplyStyleCommandTest.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) 2005 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005 Apple Computer, 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 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 m_referenceMovePosition = Position(); 1015 m_referenceMovePosition = Position();
1016 } 1016 }
1017 1017
1018 // This method removes div elements with no attributes that have only one child 1018 // This method removes div elements with no attributes that have only one child
1019 // or no children at all. 1019 // or no children at all.
1020 void DeleteSelectionCommand::removeRedundantBlocks(EditingState* editingState) { 1020 void DeleteSelectionCommand::removeRedundantBlocks(EditingState* editingState) {
1021 Node* node = m_endingPosition.computeContainerNode(); 1021 Node* node = m_endingPosition.computeContainerNode();
1022 Element* rootElement = rootEditableElement(*node); 1022 Element* rootElement = rootEditableElement(*node);
1023 1023
1024 while (node != rootElement) { 1024 while (node != rootElement) {
1025 ABORT_EDITING_COMMAND_IF(!node);
1025 if (isRemovableBlock(node)) { 1026 if (isRemovableBlock(node)) {
1026 if (node == m_endingPosition.anchorNode()) 1027 if (node == m_endingPosition.anchorNode())
1027 updatePositionForNodeRemovalPreservingChildren(m_endingPosition, *node); 1028 updatePositionForNodeRemovalPreservingChildren(m_endingPosition, *node);
1028 1029
1029 CompositeEditCommand::removeNodePreservingChildren(node, editingState); 1030 CompositeEditCommand::removeNodePreservingChildren(node, editingState);
1030 if (editingState->isAborted()) 1031 if (editingState->isAborted())
1031 return; 1032 return;
1032 node = m_endingPosition.anchorNode(); 1033 node = m_endingPosition.anchorNode();
1033 } else { 1034 } else {
1034 node = node->parentNode(); 1035 node = node->parentNode();
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 visitor->trace(m_deleteIntoBlockquoteStyle); 1227 visitor->trace(m_deleteIntoBlockquoteStyle);
1227 visitor->trace(m_startRoot); 1228 visitor->trace(m_startRoot);
1228 visitor->trace(m_endRoot); 1229 visitor->trace(m_endRoot);
1229 visitor->trace(m_startTableRow); 1230 visitor->trace(m_startTableRow);
1230 visitor->trace(m_endTableRow); 1231 visitor->trace(m_endTableRow);
1231 visitor->trace(m_temporaryPlaceholder); 1232 visitor->trace(m_temporaryPlaceholder);
1232 CompositeEditCommand::trace(visitor); 1233 CompositeEditCommand::trace(visitor);
1233 } 1234 }
1234 1235
1235 } // namespace blink 1236 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/ApplyStyleCommandTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698