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

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

Issue 417113011: Cast highestEnclosingNodeOfType() return value to tighter type (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/editing/CompositeEditCommand.cpp ('k') | Source/core/editing/EditingStyle.cpp » ('j') | 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 284
285 if (shouldNotInheritStyleFrom(*m_selectionToDelete.start().anchorNode())) 285 if (shouldNotInheritStyleFrom(*m_selectionToDelete.start().anchorNode()))
286 return; 286 return;
287 287
288 // Figure out the typing style in effect before the delete is done. 288 // Figure out the typing style in effect before the delete is done.
289 m_typingStyle = EditingStyle::create(m_selectionToDelete.start(), EditingSty le::EditingPropertiesInEffect); 289 m_typingStyle = EditingStyle::create(m_selectionToDelete.start(), EditingSty le::EditingPropertiesInEffect);
290 m_typingStyle->removeStyleAddedByNode(enclosingAnchorElement(m_selectionToDe lete.start())); 290 m_typingStyle->removeStyleAddedByNode(enclosingAnchorElement(m_selectionToDe lete.start()));
291 291
292 // If we're deleting into a Mail blockquote, save the style at end() instead of start() 292 // If we're deleting into a Mail blockquote, save the style at end() instead of start()
293 // We'll use this later in computeTypingStyleAfterDelete if we end up outsid e of a Mail blockquote 293 // We'll use this later in computeTypingStyleAfterDelete if we end up outsid e of a Mail blockquote
294 if (enclosingNodeOfType(m_selectionToDelete.start(), isMailBlockquote)) 294 if (enclosingNodeOfType(m_selectionToDelete.start(), isMailHTMLBlockquoteEle ment))
295 m_deleteIntoBlockquoteStyle = EditingStyle::create(m_selectionToDelete.e nd()); 295 m_deleteIntoBlockquoteStyle = EditingStyle::create(m_selectionToDelete.e nd());
296 else 296 else
297 m_deleteIntoBlockquoteStyle = nullptr; 297 m_deleteIntoBlockquoteStyle = nullptr;
298 } 298 }
299 299
300 bool DeleteSelectionCommand::handleSpecialCaseBRDelete() 300 bool DeleteSelectionCommand::handleSpecialCaseBRDelete()
301 { 301 {
302 Node* nodeAfterUpstreamStart = m_upstreamStart.computeNodeAfterPosition(); 302 Node* nodeAfterUpstreamStart = m_upstreamStart.computeNodeAfterPosition();
303 Node* nodeAfterDownstreamStart = m_downstreamStart.computeNodeAfterPosition( ); 303 Node* nodeAfterDownstreamStart = m_downstreamStart.computeNodeAfterPosition( );
304 // Upstream end will appear before BR due to canonicalization 304 // Upstream end will appear before BR due to canonicalization
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 return; 724 return;
725 } 725 }
726 726
727 // Compute the difference between the style before the delete and the style now 727 // Compute the difference between the style before the delete and the style now
728 // after the delete has been done. Set this style on the frame, so other edi ting 728 // after the delete has been done. Set this style on the frame, so other edi ting
729 // commands being composed with this one will work, and also cache it on the command, 729 // commands being composed with this one will work, and also cache it on the command,
730 // so the LocalFrame::appliedEditing can set it after the whole composite co mmand 730 // so the LocalFrame::appliedEditing can set it after the whole composite co mmand
731 // has completed. 731 // has completed.
732 732
733 // If we deleted into a blockquote, but are now no longer in a blockquote, u se the alternate typing style 733 // If we deleted into a blockquote, but are now no longer in a blockquote, u se the alternate typing style
734 if (m_deleteIntoBlockquoteStyle && !enclosingNodeOfType(m_endingPosition, is MailBlockquote, CanCrossEditingBoundary)) 734 if (m_deleteIntoBlockquoteStyle && !enclosingNodeOfType(m_endingPosition, is MailHTMLBlockquoteElement, CanCrossEditingBoundary))
735 m_typingStyle = m_deleteIntoBlockquoteStyle; 735 m_typingStyle = m_deleteIntoBlockquoteStyle;
736 m_deleteIntoBlockquoteStyle = nullptr; 736 m_deleteIntoBlockquoteStyle = nullptr;
737 737
738 m_typingStyle->prepareToApplyAt(m_endingPosition); 738 m_typingStyle->prepareToApplyAt(m_endingPosition);
739 if (m_typingStyle->isEmpty()) 739 if (m_typingStyle->isEmpty())
740 m_typingStyle = nullptr; 740 m_typingStyle = nullptr;
741 // This is where we've deleted all traces of a style but not a whole paragra ph (that's handled above). 741 // This is where we've deleted all traces of a style but not a whole paragra ph (that's handled above).
742 // In this case if we start typing, the new characters should have the same style as the just deleted ones, 742 // In this case if we start typing, the new characters should have the same style as the just deleted ones,
743 // but, if we change the selection, come back and start typing that style sh ould be lost. Also see 743 // but, if we change the selection, come back and start typing that style sh ould be lost. Also see
744 // preserveTypingStyle() below. 744 // preserveTypingStyle() below.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 visitor->trace(m_deleteIntoBlockquoteStyle); 889 visitor->trace(m_deleteIntoBlockquoteStyle);
890 visitor->trace(m_startRoot); 890 visitor->trace(m_startRoot);
891 visitor->trace(m_endRoot); 891 visitor->trace(m_endRoot);
892 visitor->trace(m_startTableRow); 892 visitor->trace(m_startTableRow);
893 visitor->trace(m_endTableRow); 893 visitor->trace(m_endTableRow);
894 visitor->trace(m_temporaryPlaceholder); 894 visitor->trace(m_temporaryPlaceholder);
895 CompositeEditCommand::trace(visitor); 895 CompositeEditCommand::trace(visitor);
896 } 896 }
897 897
898 } // namespace blink 898 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/CompositeEditCommand.cpp ('k') | Source/core/editing/EditingStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698