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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/IndentOutdentCommand.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) 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 Position originalSelectionEnd = endingSelection().end(); 338 Position originalSelectionEnd = endingSelection().end();
339 Position endAfterSelection = 339 Position endAfterSelection =
340 endOfParagraph(nextPositionOf(endOfLastParagraph)).deepEquivalent(); 340 endOfParagraph(nextPositionOf(endOfLastParagraph)).deepEquivalent();
341 341
342 while (endOfCurrentParagraph.deepEquivalent() != endAfterSelection) { 342 while (endOfCurrentParagraph.deepEquivalent() != endAfterSelection) {
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 setEndingSelection(createVisibleSelection(originalSelectionEnd, 348 SelectionInDOMTree::Builder builder;
349 TextAffinity::Downstream)); 349 if (originalSelectionEnd.isNotNull())
350 builder.collapse(originalSelectionEnd);
351 setEndingSelection(createVisibleSelection(builder.build()));
350 } else { 352 } else {
351 setEndingSelection(endOfCurrentParagraph); 353 setEndingSelection(endOfCurrentParagraph);
352 } 354 }
353 355
354 outdentParagraph(editingState); 356 outdentParagraph(editingState);
355 if (editingState->isAborted()) 357 if (editingState->isAborted())
356 return; 358 return;
357 359
358 // outdentParagraph could move more than one paragraph if the paragraph 360 // outdentParagraph could move more than one paragraph if the paragraph
359 // is in a list item. As a result, endAfterSelection and endOfNextParagraph 361 // is in a list item. As a result, endAfterSelection and endOfNextParagraph
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 else 398 else
397 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState); 399 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState);
398 } 400 }
399 401
400 InputEvent::InputType IndentOutdentCommand::inputType() const { 402 InputEvent::InputType IndentOutdentCommand::inputType() const {
401 return m_typeOfAction == Indent ? InputEvent::InputType::Indent 403 return m_typeOfAction == Indent ? InputEvent::InputType::Indent
402 : InputEvent::InputType::Outdent; 404 : InputEvent::InputType::Outdent;
403 } 405 }
404 406
405 } // namespace blink 407 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698