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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/IndentOutdentCommand.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) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 PositionWithAffinity endOfNextParagraph = 343 PositionWithAffinity endOfNextParagraph =
344 endOfParagraph(nextPositionOf(endOfCurrentParagraph)) 344 endOfParagraph(nextPositionOf(endOfCurrentParagraph))
345 .toPositionWithAffinity(); 345 .toPositionWithAffinity();
346 if (endOfCurrentParagraph.deepEquivalent() == 346 if (endOfCurrentParagraph.deepEquivalent() ==
347 endOfLastParagraph.deepEquivalent()) { 347 endOfLastParagraph.deepEquivalent()) {
348 SelectionInDOMTree::Builder builder; 348 SelectionInDOMTree::Builder builder;
349 if (originalSelectionEnd.isNotNull()) 349 if (originalSelectionEnd.isNotNull())
350 builder.collapse(originalSelectionEnd); 350 builder.collapse(originalSelectionEnd);
351 setEndingSelection(createVisibleSelection(builder.build())); 351 setEndingSelection(createVisibleSelection(builder.build()));
352 } else { 352 } else {
353 setEndingSelection(endOfCurrentParagraph); 353 setEndingSelection(SelectionInDOMTree::Builder()
354 .collapse(endOfCurrentParagraph.deepEquivalent())
355 .build());
354 } 356 }
355 357
356 outdentParagraph(editingState); 358 outdentParagraph(editingState);
357 if (editingState->isAborted()) 359 if (editingState->isAborted())
358 return; 360 return;
359 361
360 // outdentParagraph could move more than one paragraph if the paragraph 362 // outdentParagraph could move more than one paragraph if the paragraph
361 // is in a list item. As a result, endAfterSelection and endOfNextParagraph 363 // is in a list item. As a result, endAfterSelection and endOfNextParagraph
362 // could refer to positions no longer in the document. 364 // could refer to positions no longer in the document.
363 if (endAfterSelection.isNotNull() && !endAfterSelection.isConnected()) 365 if (endAfterSelection.isNotNull() && !endAfterSelection.isConnected())
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 else 400 else
399 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState); 401 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState);
400 } 402 }
401 403
402 InputEvent::InputType IndentOutdentCommand::inputType() const { 404 InputEvent::InputType IndentOutdentCommand::inputType() const {
403 return m_typeOfAction == Indent ? InputEvent::InputType::Indent 405 return m_typeOfAction == Indent ? InputEvent::InputType::Indent
404 : InputEvent::InputType::Outdent; 406 : InputEvent::InputType::Outdent;
405 } 407 }
406 408
407 } // namespace blink 409 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698