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

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

Issue 1299873002: ALL-IN-ONE Introduce enum class TextAffinity (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T18:08:52 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 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 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 { 785 {
786 // If selection has not been set to a custom selection when the command was created, 786 // If selection has not been set to a custom selection when the command was created,
787 // use the current ending selection. 787 // use the current ending selection.
788 if (!m_hasSelectionToDelete) 788 if (!m_hasSelectionToDelete)
789 m_selectionToDelete = endingSelection(); 789 m_selectionToDelete = endingSelection();
790 790
791 if (!m_selectionToDelete.isNonOrphanedRange() || !m_selectionToDelete.isCont entEditable()) 791 if (!m_selectionToDelete.isNonOrphanedRange() || !m_selectionToDelete.isCont entEditable())
792 return; 792 return;
793 793
794 // save this to later make the selection with 794 // save this to later make the selection with
795 EAffinity affinity = m_selectionToDelete.affinity(); 795 TextAffinity affinity = m_selectionToDelete.affinity();
796 796
797 Position downstreamEnd = m_selectionToDelete.end().downstream(); 797 Position downstreamEnd = m_selectionToDelete.end().downstream();
798 bool rootWillStayOpenWithoutPlaceholder = downstreamEnd.computeContainerNode () == downstreamEnd.computeContainerNode()->rootEditableElement() 798 bool rootWillStayOpenWithoutPlaceholder = downstreamEnd.computeContainerNode () == downstreamEnd.computeContainerNode()->rootEditableElement()
799 || (downstreamEnd.computeContainerNode()->isTextNode() && downstreamEnd. computeContainerNode()->parentNode() == downstreamEnd.computeContainerNode()->ro otEditableElement()); 799 || (downstreamEnd.computeContainerNode()->isTextNode() && downstreamEnd. computeContainerNode()->parentNode() == downstreamEnd.computeContainerNode()->ro otEditableElement());
800 bool lineBreakAtEndOfSelectionToDelete = lineBreakExistsAtVisiblePosition(m_ selectionToDelete.visibleEnd()); 800 bool lineBreakAtEndOfSelectionToDelete = lineBreakExistsAtVisiblePosition(m_ selectionToDelete.visibleEnd());
801 m_needPlaceholder = !rootWillStayOpenWithoutPlaceholder 801 m_needPlaceholder = !rootWillStayOpenWithoutPlaceholder
802 && isStartOfParagraph(m_selectionToDelete.visibleStart(), CanCrossEditin gBoundary) 802 && isStartOfParagraph(m_selectionToDelete.visibleStart(), CanCrossEditin gBoundary)
803 && isEndOfParagraph(m_selectionToDelete.visibleEnd(), CanCrossEditingBou ndary) 803 && isEndOfParagraph(m_selectionToDelete.visibleEnd(), CanCrossEditingBou ndary)
804 && !lineBreakAtEndOfSelectionToDelete; 804 && !lineBreakAtEndOfSelectionToDelete;
805 if (m_needPlaceholder) { 805 if (m_needPlaceholder) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 visitor->trace(m_deleteIntoBlockquoteStyle); 899 visitor->trace(m_deleteIntoBlockquoteStyle);
900 visitor->trace(m_startRoot); 900 visitor->trace(m_startRoot);
901 visitor->trace(m_endRoot); 901 visitor->trace(m_endRoot);
902 visitor->trace(m_startTableRow); 902 visitor->trace(m_startTableRow);
903 visitor->trace(m_endTableRow); 903 visitor->trace(m_endTableRow);
904 visitor->trace(m_temporaryPlaceholder); 904 visitor->trace(m_temporaryPlaceholder);
905 CompositeEditCommand::trace(visitor); 905 CompositeEditCommand::trace(visitor);
906 } 906 }
907 907
908 } // namespace blink 908 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/commands/CreateLinkCommand.cpp ('k') | Source/core/editing/commands/EditorCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698