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

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

Issue 1702233002: Editing: Make the |EditingState*| argument of CompositeEditCommand::insertNodeAt mandatory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/Source/core/editing/commands/InsertTextCommand.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, 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 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1203 1203
1204 // Scripts specified in javascript protocol may remove |enclosingBlockOfInse rtionPos| 1204 // Scripts specified in javascript protocol may remove |enclosingBlockOfInse rtionPos|
1205 // during insertion, e.g. <iframe src="javascript:..."> 1205 // during insertion, e.g. <iframe src="javascript:...">
1206 if (enclosingBlockOfInsertionPos && !enclosingBlockOfInsertionPos->inDocumen t()) 1206 if (enclosingBlockOfInsertionPos && !enclosingBlockOfInsertionPos->inDocumen t())
1207 enclosingBlockOfInsertionPos = nullptr; 1207 enclosingBlockOfInsertionPos = nullptr;
1208 1208
1209 VisiblePosition startOfInsertedContent = createVisiblePosition(firstPosition InOrBeforeNode(insertedNodes.firstNodeInserted())); 1209 VisiblePosition startOfInsertedContent = createVisiblePosition(firstPosition InOrBeforeNode(insertedNodes.firstNodeInserted()));
1210 1210
1211 // We inserted before the enclosingBlockOfInsertionPos to prevent nesting, a nd the content before the enclosingBlockOfInsertionPos wasn't in its own block a nd 1211 // We inserted before the enclosingBlockOfInsertionPos to prevent nesting, a nd the content before the enclosingBlockOfInsertionPos wasn't in its own block a nd
1212 // didn't have a br after it, so the inserted content ended up in the same p aragraph. 1212 // didn't have a br after it, so the inserted content ended up in the same p aragraph.
1213 if (!startOfInsertedContent.isNull() && enclosingBlockOfInsertionPos && inse rtionPos.anchorNode() == enclosingBlockOfInsertionPos->parentNode() && (unsigned )insertionPos.computeEditingOffset() < enclosingBlockOfInsertionPos->nodeIndex() && !isStartOfParagraph(startOfInsertedContent)) 1213 if (!startOfInsertedContent.isNull() && enclosingBlockOfInsertionPos && inse rtionPos.anchorNode() == enclosingBlockOfInsertionPos->parentNode() && (unsigned )insertionPos.computeEditingOffset() < enclosingBlockOfInsertionPos->nodeIndex() && !isStartOfParagraph(startOfInsertedContent)) {
1214 insertNodeAt(HTMLBRElement::create(document()).get(), startOfInsertedCon tent.deepEquivalent()); 1214 insertNodeAt(HTMLBRElement::create(document()).get(), startOfInsertedCon tent.deepEquivalent(), editingState);
1215 if (editingState->isAborted())
1216 return;
1217 }
1215 1218
1216 if (endBR && (plainTextFragment || (shouldRemoveEndBR(endBR, originalVisPosB eforeEndBR) && !(fragment.hasInterchangeNewlineAtEnd() && selectionIsPlainText)) )) { 1219 if (endBR && (plainTextFragment || (shouldRemoveEndBR(endBR, originalVisPosB eforeEndBR) && !(fragment.hasInterchangeNewlineAtEnd() && selectionIsPlainText)) )) {
1217 RefPtrWillBeRawPtr<ContainerNode> parent = endBR->parentNode(); 1220 RefPtrWillBeRawPtr<ContainerNode> parent = endBR->parentNode();
1218 insertedNodes.willRemoveNode(*endBR); 1221 insertedNodes.willRemoveNode(*endBR);
1219 removeNode(endBR, editingState); 1222 removeNode(endBR, editingState);
1220 if (editingState->isAborted()) 1223 if (editingState->isAborted())
1221 return; 1224 return;
1222 if (Node* nodeToRemove = highestNodeToRemoveInPruning(parent.get())) { 1225 if (Node* nodeToRemove = highestNodeToRemoveInPruning(parent.get())) {
1223 insertedNodes.willRemoveNode(*nodeToRemove); 1226 insertedNodes.willRemoveNode(*nodeToRemove);
1224 removeNode(nodeToRemove, editingState); 1227 removeNode(nodeToRemove, editingState);
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 visitor->trace(m_startOfInsertedContent); 1660 visitor->trace(m_startOfInsertedContent);
1658 visitor->trace(m_endOfInsertedContent); 1661 visitor->trace(m_endOfInsertedContent);
1659 visitor->trace(m_insertionStyle); 1662 visitor->trace(m_insertionStyle);
1660 visitor->trace(m_documentFragment); 1663 visitor->trace(m_documentFragment);
1661 visitor->trace(m_startOfInsertedRange); 1664 visitor->trace(m_startOfInsertedRange);
1662 visitor->trace(m_endOfInsertedRange); 1665 visitor->trace(m_endOfInsertedRange);
1663 CompositeEditCommand::trace(visitor); 1666 CompositeEditCommand::trace(visitor);
1664 } 1667 }
1665 1668
1666 } // namespace blink 1669 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698