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

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

Issue 1785603002: TEXTAREA: Cutting last line without EOL should not remove the remaining EOL in the previous line. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove an ASSERT, update a comment Created 4 years, 9 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 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 if (selectionEndWasEndOfParagraph || !isEndOfParagraph(endOfInsertedCont ent) || next.isNull()) { 1306 if (selectionEndWasEndOfParagraph || !isEndOfParagraph(endOfInsertedCont ent) || next.isNull()) {
1307 if (!isStartOfParagraph(endOfInsertedContent)) { 1307 if (!isStartOfParagraph(endOfInsertedContent)) {
1308 setEndingSelection(endOfInsertedContent); 1308 setEndingSelection(endOfInsertedContent);
1309 Element* enclosingBlockElement = enclosingBlock(endOfInsertedCon tent.deepEquivalent().anchorNode()); 1309 Element* enclosingBlockElement = enclosingBlock(endOfInsertedCon tent.deepEquivalent().anchorNode());
1310 if (isListItem(enclosingBlockElement)) { 1310 if (isListItem(enclosingBlockElement)) {
1311 RefPtrWillBeRawPtr<HTMLLIElement> newListItem = HTMLLIElemen t::create(document()); 1311 RefPtrWillBeRawPtr<HTMLLIElement> newListItem = HTMLLIElemen t::create(document());
1312 insertNodeAfter(newListItem, enclosingBlockElement, editingS tate); 1312 insertNodeAfter(newListItem, enclosingBlockElement, editingS tate);
1313 if (editingState->isAborted()) 1313 if (editingState->isAborted())
1314 return; 1314 return;
1315 setEndingSelection(createVisiblePosition(firstPositionInNode (newListItem.get()))); 1315 setEndingSelection(createVisiblePosition(firstPositionInNode (newListItem.get())));
1316 } else if (HTMLTextFormControlElement* textControl = enclosingTe xtFormControl(enclosingBlockElement)) {
1317 insertNodeAfter(textControl->createPlaceholderBreakElement() , insertedNodes.lastLeafInserted(), editingState);
1318 if (editingState->isAborted())
1319 return;
1320 setEndingSelection(createVisiblePosition(positionAfterNode(i nsertedNodes.lastLeafInserted())));
1316 } else { 1321 } else {
1317 // Use a default paragraph element (a plain div) for the emp ty paragraph, using the last paragraph 1322 // Use a default paragraph element (a plain div) for the emp ty paragraph, using the last paragraph
1318 // block's style seems to annoy users. 1323 // block's style seems to annoy users.
1319 insertParagraphSeparator(editingState, true, !startIsInsideM ailBlockquote && highestEnclosingNodeOfType(endOfInsertedContent.deepEquivalent( ), 1324 insertParagraphSeparator(editingState, true, !startIsInsideM ailBlockquote && highestEnclosingNodeOfType(endOfInsertedContent.deepEquivalent( ),
1320 isMailHTMLBlockquoteElement, CannotCrossEditingBoundary, insertedNodes.firstNodeInserted()->parentNode())); 1325 isMailHTMLBlockquoteElement, CannotCrossEditingBoundary, insertedNodes.firstNodeInserted()->parentNode()));
1321 if (editingState->isAborted()) 1326 if (editingState->isAborted())
1322 return; 1327 return;
1323 } 1328 }
1324 1329
1325 // Select up to the paragraph separator that was added. 1330 // Select up to the paragraph separator that was added.
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 visitor->trace(m_startOfInsertedContent); 1674 visitor->trace(m_startOfInsertedContent);
1670 visitor->trace(m_endOfInsertedContent); 1675 visitor->trace(m_endOfInsertedContent);
1671 visitor->trace(m_insertionStyle); 1676 visitor->trace(m_insertionStyle);
1672 visitor->trace(m_documentFragment); 1677 visitor->trace(m_documentFragment);
1673 visitor->trace(m_startOfInsertedRange); 1678 visitor->trace(m_startOfInsertedRange);
1674 visitor->trace(m_endOfInsertedRange); 1679 visitor->trace(m_endOfInsertedRange);
1675 CompositeEditCommand::trace(visitor); 1680 CompositeEditCommand::trace(visitor);
1676 } 1681 }
1677 1682
1678 } // namespace blink 1683 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698