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

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

Issue 2406163004: Simplify the usage of PositionWithAffinity (Closed)
Patch Set: Created 4 years, 2 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) 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 if (editingState->isAborted()) 352 if (editingState->isAborted())
353 return; 353 return;
354 354
355 // outdentParagraph could move more than one paragraph if the paragraph 355 // outdentParagraph could move more than one paragraph if the paragraph
356 // is in a list item. As a result, endAfterSelection and endOfNextParagraph 356 // is in a list item. As a result, endAfterSelection and endOfNextParagraph
357 // could refer to positions no longer in the document. 357 // could refer to positions no longer in the document.
358 if (endAfterSelection.isNotNull() && !endAfterSelection.isConnected()) 358 if (endAfterSelection.isNotNull() && !endAfterSelection.isConnected())
359 break; 359 break;
360 360
361 document().updateStyleAndLayoutIgnorePendingStylesheets(); 361 document().updateStyleAndLayoutIgnorePendingStylesheets();
362 if (endOfNextParagraph.isNotNull() && 362 if (endOfNextParagraph.isNotNull() && !endOfNextParagraph.isConnected()) {
363 !endOfNextParagraph.position().isConnected()) {
364 endOfCurrentParagraph = createVisiblePosition(endingSelection().end()); 363 endOfCurrentParagraph = createVisiblePosition(endingSelection().end());
365 endOfNextParagraph = endOfParagraph(nextPositionOf(endOfCurrentParagraph)) 364 endOfNextParagraph = endOfParagraph(nextPositionOf(endOfCurrentParagraph))
366 .toPositionWithAffinity(); 365 .toPositionWithAffinity();
367 } 366 }
368 endOfCurrentParagraph = createVisiblePosition(endOfNextParagraph); 367 endOfCurrentParagraph = createVisiblePosition(endOfNextParagraph);
369 } 368 }
370 } 369 }
371 370
372 void IndentOutdentCommand::formatSelection( 371 void IndentOutdentCommand::formatSelection(
373 const VisiblePosition& startOfSelection, 372 const VisiblePosition& startOfSelection,
(...skipping 20 matching lines...) Expand all
394 else 393 else
395 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState); 394 indentIntoBlockquote(start, end, blockquoteForNextIndent, editingState);
396 } 395 }
397 396
398 InputEvent::InputType IndentOutdentCommand::inputType() const { 397 InputEvent::InputType IndentOutdentCommand::inputType() const {
399 return m_typeOfAction == Indent ? InputEvent::InputType::Indent 398 return m_typeOfAction == Indent ? InputEvent::InputType::Indent
400 : InputEvent::InputType::Outdent; 399 : InputEvent::InputType::Outdent;
401 } 400 }
402 401
403 } // namespace blink 402 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698