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

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

Issue 23950006: Patch for proper re-setting of frame selection's typing style. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: modifying as per review comments Created 7 years, 3 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
« no previous file with comments | « LayoutTests/editing/deleting/maintain-style-after-delete-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 // FIXME: We probably shouldn't remove m_endTableRow unless it's fully selected, even if it is empty. 697 // FIXME: We probably shouldn't remove m_endTableRow unless it's fully selected, even if it is empty.
698 // We'll need to start adjusting the selection endpoints during deletion to know whether or not m_endTableRow 698 // We'll need to start adjusting the selection endpoints during deletion to know whether or not m_endTableRow
699 // was fully selected here. 699 // was fully selected here.
700 CompositeEditCommand::removeNode(m_endTableRow.get()); 700 CompositeEditCommand::removeNode(m_endTableRow.get());
701 } 701 }
702 } 702 }
703 } 703 }
704 704
705 void DeleteSelectionCommand::calculateTypingStyleAfterDelete() 705 void DeleteSelectionCommand::calculateTypingStyleAfterDelete()
706 { 706 {
707 if (!m_typingStyle) 707 // Clearing any previously set typing style and doing an early return.
708 if (!m_typingStyle) {
709 document().frame()->selection().clearTypingStyle();
708 return; 710 return;
711 }
709 712
710 // Compute the difference between the style before the delete and the style now 713 // Compute the difference between the style before the delete and the style now
711 // after the delete has been done. Set this style on the frame, so other edi ting 714 // after the delete has been done. Set this style on the frame, so other edi ting
712 // commands being composed with this one will work, and also cache it on the command, 715 // commands being composed with this one will work, and also cache it on the command,
713 // so the Frame::appliedEditing can set it after the whole composite command 716 // so the Frame::appliedEditing can set it after the whole composite command
714 // has completed. 717 // has completed.
715 718
716 // If we deleted into a blockquote, but are now no longer in a blockquote, u se the alternate typing style 719 // If we deleted into a blockquote, but are now no longer in a blockquote, u se the alternate typing style
717 if (m_deleteIntoBlockquoteStyle && !enclosingNodeOfType(m_endingPosition, is MailBlockquote, CanCrossEditingBoundary)) 720 if (m_deleteIntoBlockquoteStyle && !enclosingNodeOfType(m_endingPosition, is MailBlockquote, CanCrossEditingBoundary))
718 m_typingStyle = m_deleteIntoBlockquoteStyle; 721 m_typingStyle = m_deleteIntoBlockquoteStyle;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 853
851 // Normally deletion doesn't preserve the typing style that was present before i t. For example, 854 // Normally deletion doesn't preserve the typing style that was present before i t. For example,
852 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't 855 // type a character, Bold, then delete the character and start typing. The Bold typing style shouldn't
853 // stick around. Deletion should preserve a typing style that *it* sets, howeve r. 856 // stick around. Deletion should preserve a typing style that *it* sets, howeve r.
854 bool DeleteSelectionCommand::preservesTypingStyle() const 857 bool DeleteSelectionCommand::preservesTypingStyle() const
855 { 858 {
856 return m_typingStyle; 859 return m_typingStyle;
857 } 860 }
858 861
859 } // namespace WebCore 862 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/deleting/maintain-style-after-delete-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698