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

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

Issue 2322853004: Convert an assertion to if-condition in ReplaceSelectionCommand::doApply() (Closed)
Patch Set: 2016-09-09T17:11:56 Created 4 years, 3 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 | « third_party/WebKit/LayoutTests/platform/win/editing/pasteboard/paste-text-009-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) 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 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 HTMLBRElement* endBR = isHTMLBRElement(*mostForwardCaretPosition(insertionPo s).anchorNode()) ? toHTMLBRElement(mostForwardCaretPosition(insertionPos).anchor Node()) : 0; 1141 HTMLBRElement* endBR = isHTMLBRElement(*mostForwardCaretPosition(insertionPo s).anchorNode()) ? toHTMLBRElement(mostForwardCaretPosition(insertionPos).anchor Node()) : 0;
1142 VisiblePosition originalVisPosBeforeEndBR; 1142 VisiblePosition originalVisPosBeforeEndBR;
1143 if (endBR) 1143 if (endBR)
1144 originalVisPosBeforeEndBR = previousPositionOf(VisiblePosition::beforeNo de(endBR)); 1144 originalVisPosBeforeEndBR = previousPositionOf(VisiblePosition::beforeNo de(endBR));
1145 1145
1146 Element* enclosingBlockOfInsertionPos = enclosingBlock(insertionPos.anchorNo de()); 1146 Element* enclosingBlockOfInsertionPos = enclosingBlock(insertionPos.anchorNo de());
1147 1147
1148 // Adjust insertionPos to prevent nesting. 1148 // Adjust insertionPos to prevent nesting.
1149 // If the start was in a Mail blockquote, we will have already handled adjus ting insertionPos above. 1149 // If the start was in a Mail blockquote, we will have already handled adjus ting insertionPos above.
1150 if (m_preventNesting && enclosingBlockOfInsertionPos && !isTableCell(enclosi ngBlockOfInsertionPos) && !startIsInsideMailBlockquote) { 1150 if (m_preventNesting && enclosingBlockOfInsertionPos && !isTableCell(enclosi ngBlockOfInsertionPos) && !startIsInsideMailBlockquote) {
1151 DCHECK_NE(enclosingBlockOfInsertionPos, currentRoot);
Xiaocheng 2016/09/12 04:58:56 What's the reason the assertion was introduced? Is
yosin_UTC9 2016/09/12 05:21:38 This assertion is introduced by https://bugs.webki
1152 VisiblePosition visibleInsertionPos = createVisiblePosition(insertionPos ); 1151 VisiblePosition visibleInsertionPos = createVisiblePosition(insertionPos );
1153 if (isEndOfBlock(visibleInsertionPos) && !(isStartOfBlock(visibleInserti onPos) && fragment.hasInterchangeNewlineAtEnd())) 1152 if (isEndOfBlock(visibleInsertionPos) && !(isStartOfBlock(visibleInserti onPos) && fragment.hasInterchangeNewlineAtEnd()))
1154 insertionPos = Position::inParentAfterNode(*enclosingBlockOfInsertio nPos); 1153 insertionPos = Position::inParentAfterNode(*enclosingBlockOfInsertio nPos);
1155 else if (isStartOfBlock(visibleInsertionPos)) 1154 else if (isStartOfBlock(visibleInsertionPos))
1156 insertionPos = Position::inParentBeforeNode(*enclosingBlockOfInserti onPos); 1155 insertionPos = Position::inParentBeforeNode(*enclosingBlockOfInserti onPos);
1157 } 1156 }
1158 1157
1159 // Paste at start or end of link goes outside of link. 1158 // Paste at start or end of link goes outside of link.
1160 insertionPos = positionAvoidingSpecialElementBoundary(insertionPos, editingS tate); 1159 insertionPos = positionAvoidingSpecialElementBoundary(insertionPos, editingS tate);
1161 if (editingState->isAborted()) 1160 if (editingState->isAborted())
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 visitor->trace(m_startOfInsertedContent); 1757 visitor->trace(m_startOfInsertedContent);
1759 visitor->trace(m_endOfInsertedContent); 1758 visitor->trace(m_endOfInsertedContent);
1760 visitor->trace(m_insertionStyle); 1759 visitor->trace(m_insertionStyle);
1761 visitor->trace(m_documentFragment); 1760 visitor->trace(m_documentFragment);
1762 visitor->trace(m_startOfInsertedRange); 1761 visitor->trace(m_startOfInsertedRange);
1763 visitor->trace(m_endOfInsertedRange); 1762 visitor->trace(m_endOfInsertedRange);
1764 CompositeEditCommand::trace(visitor); 1763 CompositeEditCommand::trace(visitor);
1765 } 1764 }
1766 1765
1767 } // namespace blink 1766 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win/editing/pasteboard/paste-text-009-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698