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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/InsertTextCommand.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 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 startPosition = positionBeforeStartNode; 184 startPosition = positionBeforeStartNode;
185 if (!isVisuallyEquivalentCandidate(startPosition)) 185 if (!isVisuallyEquivalentCandidate(startPosition))
186 startPosition = mostForwardCaretPosition(startPosition); 186 startPosition = mostForwardCaretPosition(startPosition);
187 187
188 startPosition = positionAvoidingSpecialElementBoundary(startPosition, editin gState); 188 startPosition = positionAvoidingSpecialElementBoundary(startPosition, editin gState);
189 if (editingState->isAborted()) 189 if (editingState->isAborted())
190 return; 190 return;
191 191
192 Position endPosition; 192 Position endPosition;
193 193
194 if (m_text == "\t") { 194 if (m_text == "\t" && isRichlyEditablePosition(startPosition)) {
195 endPosition = insertTab(startPosition, editingState); 195 endPosition = insertTab(startPosition, editingState);
196 if (editingState->isAborted()) 196 if (editingState->isAborted())
197 return; 197 return;
198 // TODO(yosin) We should use |PositionMoveType::Character| for 198 // TODO(yosin) We should use |PositionMoveType::Character| for
199 // |previousPositionOf()|. 199 // |previousPositionOf()|.
200 startPosition = previousPositionOf(endPosition, PositionMoveType::Charac ter); 200 startPosition = previousPositionOf(endPosition, PositionMoveType::Charac ter);
201 if (placeholder.isNotNull()) 201 if (placeholder.isNotNull())
202 removePlaceholderAt(placeholder); 202 removePlaceholderAt(placeholder);
203 } else { 203 } else {
204 // Make sure the document is set up to receive m_text 204 // Make sure the document is set up to receive m_text
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 282 }
283 } 283 }
284 if (editingState->isAborted()) 284 if (editingState->isAborted())
285 return Position(); 285 return Position();
286 286
287 // return the position following the new tab 287 // return the position following the new tab
288 return lastPositionInNode(spanElement.get()); 288 return lastPositionInNode(spanElement.get());
289 } 289 }
290 290
291 } // namespace blink 291 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698