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

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

Issue 2451093002: Get rid of EditCommand::setEndingSelection() taking one VisiblePosition (Closed)
Patch Set: 2016-10-26T16:39:39 Created 4 years, 1 month 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 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005, 2006 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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 return; 222 return;
223 // Even though this applyStyle operates on a Range, it still sets an 223 // Even though this applyStyle operates on a Range, it still sets an
224 // endingSelection(). It tries to set a VisibleSelection around the content 224 // endingSelection(). It tries to set a VisibleSelection around the content
225 // it operated on. So, that VisibleSelection will either 225 // it operated on. So, that VisibleSelection will either
226 // (a) select the line break we inserted, or it will 226 // (a) select the line break we inserted, or it will
227 // (b) be a caret just before the line break (if the line break is at the 227 // (b) be a caret just before the line break (if the line break is at the
228 // end of a block it isn't selectable). 228 // end of a block it isn't selectable).
229 // So, this next call sets the endingSelection() to a caret just after the 229 // So, this next call sets the endingSelection() to a caret just after the
230 // line break that we inserted, or just before it if it's at the end of a 230 // line break that we inserted, or just before it if it's at the end of a
231 // block. 231 // block.
232 document().updateStyleAndLayoutIgnorePendingStylesheets(); 232 setEndingSelection(SelectionInDOMTree::Builder()
233 setEndingSelection(endingSelection().visibleEnd()); 233 .collapse(endingSelection().end())
234 .build());
234 } 235 }
235 236
236 rebalanceWhitespace(); 237 rebalanceWhitespace();
237 } 238 }
238 239
239 } // namespace blink 240 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698