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

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

Issue 2442673002: Get rid of createVisibleSelection() taking one Position (Closed)
Patch Set: 2016-10-24T17:42:38 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 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 EditingStyle::PreserveWritingDirection); 276 EditingStyle::PreserveWritingDirection);
277 if (!typingStyle->isEmpty()) { 277 if (!typingStyle->isEmpty()) {
278 applyStyle(typingStyle, editingState); 278 applyStyle(typingStyle, editingState);
279 if (editingState->isAborted()) 279 if (editingState->isAborted())
280 return; 280 return;
281 } 281 }
282 } 282 }
283 283
284 if (!m_selectInsertedText) { 284 if (!m_selectInsertedText) {
285 document().updateStyleAndLayoutIgnorePendingStylesheets(); 285 document().updateStyleAndLayoutIgnorePendingStylesheets();
286 setEndingSelection(createVisibleSelection( 286 SelectionInDOMTree::Builder builder;
287 endingSelection().end(), endingSelection().affinity(), 287 builder.setAffinity(endingSelection().affinity());
288 endingSelection().isDirectional())); 288 builder.setIsDirectional(endingSelection().isDirectional());
289 if (endingSelection().end().isNotNull())
290 builder.collapse(endingSelection().end());
291 setEndingSelection(createVisibleSelection(builder.build()));
289 } 292 }
290 } 293 }
291 294
292 Position InsertTextCommand::insertTab(const Position& pos, 295 Position InsertTextCommand::insertTab(const Position& pos,
293 EditingState* editingState) { 296 EditingState* editingState) {
294 document().updateStyleAndLayoutIgnorePendingStylesheets(); 297 document().updateStyleAndLayoutIgnorePendingStylesheets();
295 298
296 Position insertPos = createVisiblePosition(pos).deepEquivalent(); 299 Position insertPos = createVisiblePosition(pos).deepEquivalent();
297 if (insertPos.isNull()) 300 if (insertPos.isNull())
298 return pos; 301 return pos;
(...skipping 29 matching lines...) Expand all
328 } 331 }
329 } 332 }
330 if (editingState->isAborted()) 333 if (editingState->isAborted())
331 return Position(); 334 return Position();
332 335
333 // return the position following the new tab 336 // return the position following the new tab
334 return Position::lastPositionInNode(spanElement); 337 return Position::lastPositionInNode(spanElement);
335 } 338 }
336 339
337 } // namespace blink 340 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698