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

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

Issue 19477010: Background color applied on a selection of text is lost when the selection is deleted (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review comments addressed Created 7 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
« no previous file with comments | « LayoutTests/editing/style/background-color-retained-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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 // typing style at the start of the selection, nor is there a reason to 285 // typing style at the start of the selection, nor is there a reason to
286 // compute the style at the start of the selection after deletion (see the 286 // compute the style at the start of the selection after deletion (see the
287 // early return in calculateTypingStyleAfterDelete). 287 // early return in calculateTypingStyleAfterDelete).
288 if (m_upstreamStart.deprecatedNode() == m_downstreamEnd.deprecatedNode() && m_upstreamStart.deprecatedNode()->isTextNode()) 288 if (m_upstreamStart.deprecatedNode() == m_downstreamEnd.deprecatedNode() && m_upstreamStart.deprecatedNode()->isTextNode())
289 return; 289 return;
290 290
291 if (shouldNotInheritStyleFrom(*m_selectionToDelete.start().anchorNode())) 291 if (shouldNotInheritStyleFrom(*m_selectionToDelete.start().anchorNode()))
292 return; 292 return;
293 293
294 // Figure out the typing style in effect before the delete is done. 294 // Figure out the typing style in effect before the delete is done.
295 m_typingStyle = EditingStyle::create(m_selectionToDelete.start()); 295 m_typingStyle = EditingStyle::create(m_selectionToDelete.start(), EditingSty le::EditingPropertiesInEffect);
296 m_typingStyle->removeStyleAddedByNode(enclosingAnchorElement(m_selectionToDe lete.start())); 296 m_typingStyle->removeStyleAddedByNode(enclosingAnchorElement(m_selectionToDe lete.start()));
297 297
298 // If we're deleting into a Mail blockquote, save the style at end() instead of start() 298 // If we're deleting into a Mail blockquote, save the style at end() instead of start()
299 // We'll use this later in computeTypingStyleAfterDelete if we end up outsid e of a Mail blockquote 299 // We'll use this later in computeTypingStyleAfterDelete if we end up outsid e of a Mail blockquote
300 if (enclosingNodeOfType(m_selectionToDelete.start(), isMailBlockquote)) 300 if (enclosingNodeOfType(m_selectionToDelete.start(), isMailBlockquote))
301 m_deleteIntoBlockquoteStyle = EditingStyle::create(m_selectionToDelete.e nd()); 301 m_deleteIntoBlockquoteStyle = EditingStyle::create(m_selectionToDelete.e nd());
302 else 302 else
303 m_deleteIntoBlockquoteStyle = 0; 303 m_deleteIntoBlockquoteStyle = 0;
304 } 304 }
305 305
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 853
854 // 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,
855 // 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
856 // 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.
857 bool DeleteSelectionCommand::preservesTypingStyle() const 857 bool DeleteSelectionCommand::preservesTypingStyle() const
858 { 858 {
859 return m_typingStyle; 859 return m_typingStyle;
860 } 860 }
861 861
862 } // namespace WebCore 862 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/style/background-color-retained-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698