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

Side by Side Diff: Source/core/editing/commands/TypingCommand.cpp

Issue 1305963003: Introduce {next,previous}PositionOf() as replacement of {next,previous}() member functions in Positi (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-22T00:12:04 Rebase Created 5 years, 4 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) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 setEndingSelection(VisibleSelection(positionBeforeNode(table), endin gSelection().start(), TextAffinity::Downstream, endingSelection().isDirectional( ))); 468 setEndingSelection(VisibleSelection(positionBeforeNode(table), endin gSelection().start(), TextAffinity::Downstream, endingSelection().isDirectional( )));
469 typingAddedToOpenCommand(DeleteKey); 469 typingAddedToOpenCommand(DeleteKey);
470 return; 470 return;
471 } 471 }
472 472
473 selectionToDelete = selection->selection(); 473 selectionToDelete = selection->selection();
474 474
475 if (granularity == CharacterGranularity && selectionToDelete.end().compu teContainerNode() == selectionToDelete.start().computeContainerNode() 475 if (granularity == CharacterGranularity && selectionToDelete.end().compu teContainerNode() == selectionToDelete.start().computeContainerNode()
476 && selectionToDelete.end().computeOffsetInContainerNode() - selectio nToDelete.start().computeOffsetInContainerNode() > 1) { 476 && selectionToDelete.end().computeOffsetInContainerNode() - selectio nToDelete.start().computeOffsetInContainerNode() > 1) {
477 // If there are multiple Unicode code points to be deleted, adjust t he range to match platform conventions. 477 // If there are multiple Unicode code points to be deleted, adjust t he range to match platform conventions.
478 selectionToDelete.setWithoutValidation(selectionToDelete.end(), sele ctionToDelete.end().previous(BackwardDeletion)); 478 selectionToDelete.setWithoutValidation(selectionToDelete.end(), prev iousPositionOf(selectionToDelete.end(), PositionMoveType::BackwardDeletion));
479 } 479 }
480 480
481 if (!startingSelection().isRange() || selectionToDelete.base() != starti ngSelection().start()) { 481 if (!startingSelection().isRange() || selectionToDelete.base() != starti ngSelection().start()) {
482 selectionAfterUndo = selectionToDelete; 482 selectionAfterUndo = selectionToDelete;
483 } else { 483 } else {
484 // It's a little tricky to compute what the starting selection would have been in the original document. 484 // It's a little tricky to compute what the starting selection would have been in the original document.
485 // We can't let the VisibleSelection class's validation kick in or i t'll adjust for us based on 485 // We can't let the VisibleSelection class's validation kick in or i t'll adjust for us based on
486 // the current state of the document and we'll get the wrong result. 486 // the current state of the document and we'll get the wrong result.
487 selectionAfterUndo.setWithoutValidation(startingSelection().end(), s electionToDelete.extent()); 487 selectionAfterUndo.setWithoutValidation(startingSelection().end(), s electionToDelete.extent());
488 } 488 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 ASSERT_NOT_REACHED(); 626 ASSERT_NOT_REACHED();
627 m_preservesTypingStyle = false; 627 m_preservesTypingStyle = false;
628 } 628 }
629 629
630 bool TypingCommand::isTypingCommand() const 630 bool TypingCommand::isTypingCommand() const
631 { 631 {
632 return true; 632 return true;
633 } 633 }
634 634
635 } // namespace blink 635 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/commands/InsertTextCommand.cpp ('k') | Source/core/layout/PendingSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698