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

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

Issue 2082503003: ASSERT -> DCHECK conversions in core/editing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2009, 2010, 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 void ReplaceSelectionCommand::mergeEndIfNeeded(EditingState* editingState) 885 void ReplaceSelectionCommand::mergeEndIfNeeded(EditingState* editingState)
886 { 886 {
887 if (!m_shouldMergeEnd) 887 if (!m_shouldMergeEnd)
888 return; 888 return;
889 889
890 VisiblePosition startOfInsertedContent(positionAtStartOfInsertedContent()); 890 VisiblePosition startOfInsertedContent(positionAtStartOfInsertedContent());
891 VisiblePosition endOfInsertedContent(positionAtEndOfInsertedContent()); 891 VisiblePosition endOfInsertedContent(positionAtEndOfInsertedContent());
892 892
893 // Bail to avoid infinite recursion. 893 // Bail to avoid infinite recursion.
894 if (m_movingParagraph) { 894 if (m_movingParagraph) {
895 ASSERT_NOT_REACHED(); 895 NOTREACHED();
896 return; 896 return;
897 } 897 }
898 898
899 // Merging two paragraphs will destroy the moved one's block styles. Always move the end of inserted forward 899 // Merging two paragraphs will destroy the moved one's block styles. Always move the end of inserted forward
900 // to preserve the block style of the paragraph already in the document, unl ess the paragraph to move would 900 // to preserve the block style of the paragraph already in the document, unl ess the paragraph to move would
901 // include the what was the start of the selection that was pasted into, so that we preserve that paragraph's 901 // include the what was the start of the selection that was pasted into, so that we preserve that paragraph's
902 // block styles. 902 // block styles.
903 bool mergeForward = !(inSameParagraph(startOfInsertedContent, endOfInsertedC ontent) && !isStartOfParagraph(startOfInsertedContent)); 903 bool mergeForward = !(inSameParagraph(startOfInsertedContent, endOfInsertedC ontent) && !isStartOfParagraph(startOfInsertedContent));
904 904
905 VisiblePosition destination = mergeForward ? nextPositionOf(endOfInsertedCon tent) : endOfInsertedContent; 905 VisiblePosition destination = mergeForward ? nextPositionOf(endOfInsertedCon tent) : endOfInsertedContent;
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 if (editingState->isAborted()) 1634 if (editingState->isAborted())
1635 return nullptr; 1635 return nullptr;
1636 insertedNodes.respondToNodeInsertion(*listItem); 1636 insertedNodes.respondToNodeInsertion(*listItem);
1637 } else if (isEnd) { 1637 } else if (isEnd) {
1638 insertNodeAfter(listItem, lastNode, editingState); 1638 insertNodeAfter(listItem, lastNode, editingState);
1639 if (editingState->isAborted()) 1639 if (editingState->isAborted())
1640 return nullptr; 1640 return nullptr;
1641 insertedNodes.respondToNodeInsertion(*listItem); 1641 insertedNodes.respondToNodeInsertion(*listItem);
1642 lastNode = listItem; 1642 lastNode = listItem;
1643 } else { 1643 } else {
1644 ASSERT_NOT_REACHED(); 1644 NOTREACHED();
1645 } 1645 }
1646 } 1646 }
1647 if (isStart || isMiddle) { 1647 if (isStart || isMiddle) {
1648 if (Node* node = lastNode->previousSibling()) 1648 if (Node* node = lastNode->previousSibling())
1649 return node; 1649 return node;
1650 } 1650 }
1651 return lastNode; 1651 return lastNode;
1652 } 1652 }
1653 1653
1654 void ReplaceSelectionCommand::updateNodesInserted(Node *node) 1654 void ReplaceSelectionCommand::updateNodesInserted(Node *node)
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 visitor->trace(m_startOfInsertedContent); 1720 visitor->trace(m_startOfInsertedContent);
1721 visitor->trace(m_endOfInsertedContent); 1721 visitor->trace(m_endOfInsertedContent);
1722 visitor->trace(m_insertionStyle); 1722 visitor->trace(m_insertionStyle);
1723 visitor->trace(m_documentFragment); 1723 visitor->trace(m_documentFragment);
1724 visitor->trace(m_startOfInsertedRange); 1724 visitor->trace(m_startOfInsertedRange);
1725 visitor->trace(m_endOfInsertedRange); 1725 visitor->trace(m_endOfInsertedRange);
1726 CompositeEditCommand::trace(visitor); 1726 CompositeEditCommand::trace(visitor);
1727 } 1727 }
1728 1728
1729 } // namespace blink 1729 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698